nat.agent.prompt_optimizer.register#
Classes#
Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions. |
|
Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions. |
Functions#
|
Function to optimize prompts for LLMs. |
|
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.FunctionBaseConfigSubclass 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.selfis explicitly positional-only to allowselfas a field name.- optimizer_llm: nat.data_models.component_ref.LLMRef = 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.FunctionBaseConfigSubclass 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.selfis explicitly positional-only to allowselfas a field name.- optimizer_llm: nat.data_models.component_ref.LLMRef = 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.