nat.builder.sync_builder#

Synchronous wrapper for accessing Builder instances.

Classes#

SyncBuilder

Synchronous wrapper for the Builder class.

Module Contents#

class SyncBuilder(builder: nat.builder.builder.Builder)#

Synchronous wrapper for the Builder class.

Provides synchronous access to Builder methods by wrapping async calls with run_until_complete.

_builder#
static current() SyncBuilder#

Get the SyncBuilder object from the current context.

Returns:

The SyncBuilder object wrapping the current Builder, or raises ValueError if not set.

property async_builder: nat.builder.builder.Builder#

Get the async version of the builder.

Returns:

The Builder object (async).

get_function(
name: str | nat.data_models.component_ref.FunctionRef,
) nat.builder.function.Function#

Get a function by name.

Args:

name: The name or reference of the function

Returns:

The built function instance

get_function_group(
name: str | nat.data_models.component_ref.FunctionGroupRef,
) nat.builder.function.FunctionGroup#

Get a function group by name.

Args:

name: The name or reference of the function group

Returns:

The built function group instance

get_functions(
function_names: collections.abc.Sequence[str | nat.data_models.component_ref.FunctionRef],
) list[nat.builder.function.Function]#

Get multiple functions by name.

Args:

function_names: The names or references of the functions

Returns:

List of built function instances

get_function_groups(
function_group_names: collections.abc.Sequence[str | nat.data_models.component_ref.FunctionGroupRef],
) list[nat.builder.function.FunctionGroup]#

Get multiple function groups by name.

Args:

function_group_names: The names or references of the function groups

Returns:

List of built function group instances

get_function_config(
name: str | nat.data_models.component_ref.FunctionRef,
) nat.data_models.function.FunctionBaseConfig#

Get the configuration for a function.

Args:

name: The name or reference of the function

Returns:

The configuration for the function

get_function_group_config(
name: str | nat.data_models.component_ref.FunctionGroupRef,
) nat.data_models.function.FunctionGroupBaseConfig#

Get the configuration for a function group.

Args:

name: The name or reference of the function group

Returns:

The configuration for the function group

get_workflow() nat.builder.function.Function#

Get the workflow function.

Returns:

The workflow function instance

get_workflow_config() nat.data_models.function.FunctionBaseConfig#

Get the configuration for the workflow.

Returns:

The configuration for the workflow function

get_tools(
tool_names: collections.abc.Sequence[str | nat.data_models.component_ref.FunctionRef | nat.data_models.component_ref.FunctionGroupRef],
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str,
) list[Any]#

Get multiple tools by name wrapped in the specified framework type.

Args:

tool_names: The names or references of the tools (functions or function groups) wrapper_type: The LLM framework type to wrap the tools in

Returns:

List of tools wrapped in the specified framework type

get_tool(
fn_name: str | nat.data_models.component_ref.FunctionRef,
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str,
) Any#

Get a tool by name wrapped in the specified framework type.

Args:

fn_name: The name or reference of the tool (function) wrapper_type: The LLM framework type to wrap the tool in

Returns:

The tool wrapped in the specified framework type

get_llm(
llm_name: str | nat.data_models.component_ref.LLMRef,
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str,
) Any#

Get an LLM by name wrapped in the specified framework type.

Args:

llm_name: The name or reference of the LLM wrapper_type: The LLM framework type to wrap the LLM in

Returns:

The LLM wrapped in the specified framework type

get_llms(
llm_names: collections.abc.Sequence[str | nat.data_models.component_ref.LLMRef],
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str,
) list[Any]#

Get multiple LLMs by name wrapped in the specified framework type.

Args:

llm_names: The names or references of the LLMs wrapper_type: The LLM framework type to wrap the LLMs in

Returns:

List of LLMs wrapped in the specified framework type

get_llm_config(
llm_name: str | nat.data_models.component_ref.LLMRef,
) nat.data_models.llm.LLMBaseConfig#

Get the configuration for an LLM.

Args:

llm_name: The name or reference of the LLM

Returns:

The configuration for the LLM

get_auth_provider(
auth_provider_name: str | nat.data_models.component_ref.AuthenticationRef,
) nat.authentication.interfaces.AuthProviderBase#

Get an authentication provider by name.

Args:

auth_provider_name: The name or reference of the authentication provider

Returns:

The authentication provider instance

get_auth_providers(
auth_provider_names: list[str | nat.data_models.component_ref.AuthenticationRef],
) list[nat.authentication.interfaces.AuthProviderBase]#

Get multiple authentication providers by name.

Args:

auth_provider_names: The names or references of the authentication providers

Returns:

List of authentication provider instances

get_object_store_clients(
object_store_names: collections.abc.Sequence[str | nat.data_models.component_ref.ObjectStoreRef],
) list[nat.object_store.interfaces.ObjectStore]#

Return a list of all object store clients.

get_object_store_client(
object_store_name: str | nat.data_models.component_ref.ObjectStoreRef,
) nat.object_store.interfaces.ObjectStore#

Get an object store client by name.

Args:

object_store_name: The name or reference of the object store

Returns:

The object store client instance

get_object_store_config(
object_store_name: str | nat.data_models.component_ref.ObjectStoreRef,
) nat.data_models.object_store.ObjectStoreBaseConfig#

Get the configuration for an object store.

Args:

object_store_name: The name or reference of the object store

Returns:

The configuration for the object store

get_embedders(
embedder_names: collections.abc.Sequence[str | nat.data_models.component_ref.EmbedderRef],
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str,
) list[Any]#

Get multiple embedders by name wrapped in the specified framework type.

Args:

embedder_names: The names or references of the embedders wrapper_type: The LLM framework type to wrap the embedders in

Returns:

List of embedders wrapped in the specified framework type

get_embedder(
embedder_name: str | nat.data_models.component_ref.EmbedderRef,
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str,
) Any#

Get an embedder by name wrapped in the specified framework type.

Args:

embedder_name: The name or reference of the embedder wrapper_type: The LLM framework type to wrap the embedder in

Returns:

The embedder wrapped in the specified framework type

get_embedder_config(
embedder_name: str | nat.data_models.component_ref.EmbedderRef,
) nat.data_models.embedder.EmbedderBaseConfig#

Get the configuration for an embedder.

Args:

embedder_name: The name or reference of the embedder

Returns:

The configuration for the embedder

get_memory_clients(
memory_names: collections.abc.Sequence[str | nat.data_models.component_ref.MemoryRef],
) list[nat.memory.interfaces.MemoryEditor]#

Return a list of memory clients for the specified names.

get_memory_client(
memory_name: str | nat.data_models.component_ref.MemoryRef,
) nat.memory.interfaces.MemoryEditor#

Return the instantiated memory client for the given name.

get_memory_client_config(
memory_name: str | nat.data_models.component_ref.MemoryRef,
) nat.data_models.memory.MemoryBaseConfig#

Get the configuration for a memory client.

Args:

memory_name: The name or reference of the memory client

Returns:

The configuration for the memory client

get_retrievers(
retriever_names: collections.abc.Sequence[str | nat.data_models.component_ref.RetrieverRef],
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str | None = None,
) list[nat.retriever.interface.Retriever]#

Get multiple retrievers by name.

Args:

retriever_names: The names or references of the retrievers wrapper_type: Optional LLM framework type to wrap the retrievers in

Returns:

List of retriever instances

get_retriever(
retriever_name: str | nat.data_models.component_ref.RetrieverRef,
wrapper_type: nat.builder.framework_enum.LLMFrameworkEnum | str,
) Any#
get_retriever(
retriever_name: str | nat.data_models.component_ref.RetrieverRef,
wrapper_type: None,
) nat.retriever.interface.Retriever
get_retriever(
retriever_name: str | nat.data_models.component_ref.RetrieverRef,
) nat.retriever.interface.Retriever

Get a retriever by name.

Args:

retriever_name: The name or reference of the retriever wrapper_type: Optional LLM framework type to wrap the retriever in

Returns:

The retriever instance, optionally wrapped in the specified framework type

get_retriever_config(
retriever_name: str | nat.data_models.component_ref.RetrieverRef,
) nat.data_models.retriever.RetrieverBaseConfig#

Get the configuration for a retriever.

Args:

retriever_name: The name or reference of the retriever

Returns:

The configuration for the retriever

get_trainer(
trainer_name: str | nat.data_models.component_ref.TrainerRef,
trajectory_builder: nat.finetuning.interfaces.trajectory_builder.TrajectoryBuilder,
trainer_adapter: nat.finetuning.interfaces.trainer_adapter.TrainerAdapter,
) nat.finetuning.interfaces.finetuning_runner.Trainer#

Get a trainer by name with the specified trajectory builder and trainer adapter.

Args:

trainer_name: The name or reference of the trainer trajectory_builder: The trajectory builder instance trainer_adapter: The trainer adapter instance

Returns:

The trainer instance

get_trainer_adapter(
trainer_adapter_name: str | nat.data_models.component_ref.TrainerAdapterRef,
) nat.finetuning.interfaces.trainer_adapter.TrainerAdapter#

Get a trainer adapter by name.

Args:

trainer_adapter_name: The name or reference of the trainer adapter

Returns:

The trainer adapter instance

get_trajectory_builder(
trajectory_builder_name: str | nat.data_models.component_ref.TrajectoryBuilderRef,
) nat.finetuning.interfaces.trajectory_builder.TrajectoryBuilder#

Get a trajectory builder by name.

Args:

trajectory_builder_name: The name or reference of the trajectory builder

Returns:

The trajectory builder instance

get_trainer_config(
trainer_name: str | nat.data_models.component_ref.TrainerRef,
) nat.data_models.finetuning.TrainerConfig#

Get the configuration for a trainer.

Args:

trainer_name: The name or reference of the trainer

Returns:

The configuration for the trainer

get_trainer_adapter_config(
trainer_adapter_name: str | nat.data_models.component_ref.TrainerAdapterRef,
) nat.data_models.finetuning.TrainerAdapterConfig#

Get the configuration for a trainer adapter.

Args:

trainer_adapter_name: The name or reference of the trainer adapter

Returns:

The configuration for the trainer adapter

get_trajectory_builder_config(
trajectory_builder_name: str | nat.data_models.component_ref.TrajectoryBuilderRef,
) nat.data_models.finetuning.TrajectoryBuilderConfig#

Get the configuration for a trajectory builder.

Args:

trajectory_builder_name: The name or reference of the trajectory builder

Returns:

The configuration for the trajectory builder

get_ttc_strategy(
strategy_name: str | nat.data_models.component_ref.TTCStrategyRef,
pipeline_type: nat.experimental.test_time_compute.models.stage_enums.PipelineTypeEnum,
stage_type: nat.experimental.test_time_compute.models.stage_enums.StageTypeEnum,
) nat.experimental.test_time_compute.models.strategy_base.StrategyBase#

Get a test-time compute strategy by name.

Args:

strategy_name: The name or reference of the TTC strategy pipeline_type: The pipeline type for the strategy stage_type: The stage type for the strategy

Returns:

The TTC strategy instance

get_ttc_strategy_config(
strategy_name: str | nat.data_models.component_ref.TTCStrategyRef,
pipeline_type: nat.experimental.test_time_compute.models.stage_enums.PipelineTypeEnum,
stage_type: nat.experimental.test_time_compute.models.stage_enums.StageTypeEnum,
) nat.data_models.ttc_strategy.TTCStrategyBaseConfig#

Get the configuration for a test-time compute strategy.

Args:

strategy_name: The name or reference of the TTC strategy pipeline_type: The pipeline type for the strategy stage_type: The stage type for the strategy

Returns:

The configuration for the TTC strategy

get_user_manager() nat.builder.builder.UserManagerHolder#

Get the user manager holder.

Returns:

The user manager holder instance

get_function_dependencies(
fn_name: str,
) nat.data_models.function_dependencies.FunctionDependencies#

Get the dependencies for a function.

Args:

fn_name: The name of the function

Returns:

The function dependencies

get_function_group_dependencies(
fn_name: str,
) nat.data_models.function_dependencies.FunctionDependencies#

Get the dependencies for a function group.

Args:

fn_name: The name of the function group

Returns:

The function group dependencies

get_middleware(
middleware_name: str | nat.data_models.component_ref.MiddlewareRef,
) nat.middleware.middleware.Middleware#

Get built middleware by name.

Args:

middleware_name: The name or reference of the middleware

Returns:

The built middleware instance

get_middleware_config(
middleware_name: str | nat.data_models.component_ref.MiddlewareRef,
) nat.data_models.middleware.MiddlewareBaseConfig#

Get the configuration for middleware.

Args:

middleware_name: The name or reference of the middleware

Returns:

The configuration for the middleware

get_middleware_list(
middleware_names: collections.abc.Sequence[str | nat.data_models.component_ref.MiddlewareRef],
) list[nat.middleware.middleware.Middleware]#

Get multiple middleware by name.

Args:

middleware_names: The names or references of the middleware

Returns:

List of built middleware instances