nat.agent.prompt_optimizer.register#

Classes#

PromptOptimizerConfig

Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions.

PromptRecombinerConfig

Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions.

Functions#

prompt_optimizer_function(config, builder)

Function to optimize prompts for LLMs.

prompt_recombiner_function(config, builder)

Function to recombine two parent prompts into a child prompt using the optimizer LLM.

Module Contents#

class PromptOptimizerConfig(/, **data: Any)#

Bases: nat.data_models.function.FunctionBaseConfig

Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

optimizer_llm: nat.data_models.component_ref.LLMRef = None#
optimizer_prompt: str = None#
system_objective: str = None#
async prompt_optimizer_function(
config: PromptOptimizerConfig,
builder: nat.builder.builder.Builder,
)#

Function to optimize prompts for LLMs.

class PromptRecombinerConfig(/, **data: Any)#

Bases: nat.data_models.function.FunctionBaseConfig

Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

optimizer_llm: nat.data_models.component_ref.LLMRef = None#
optimizer_prompt: str = None#
system_objective: str = None#
async prompt_recombiner_function(
config: PromptRecombinerConfig,
builder: nat.builder.builder.Builder,
)#

Function to recombine two parent prompts into a child prompt using the optimizer LLM. Uses the same base template and objective instructions.