agents.reasoning_and_critique.tot.models¶
Tree of Thoughts (ToT) models and data structures.
This module defines the core data models for the Tree of Thoughts reasoning algorithm, including candidate solutions and structured output models.
Classes¶
A candidate solution in the Tree of Thoughts algorithm. |
|
Structured output model for evaluating a candidate solution. |
|
Structured output model for generating multiple candidate solutions. |
|
An equation in reverse-polish notation that combines numbers to reach a target value. |
|
Specialized candidate generation for equation problems. |
|
A score with feedback. |
|
A candidate solution with its evaluation score. |
Functions¶
|
Update candidate list, handling special cases like clearing. |
Module Contents¶
- class agents.reasoning_and_critique.tot.models.Candidate(/, **data)¶
Bases:
pydantic.BaseModel
,Generic
[T
]A candidate solution in the Tree of Thoughts algorithm.
This represents an unscored candidate solution generated by the LLM.
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.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.reasoning_and_critique.tot.models.CandidateEvaluation(/, **data)¶
Bases:
pydantic.BaseModel
Structured output model for evaluating a candidate solution.
This model is used when the evaluator LLM produces structured output.
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.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.reasoning_and_critique.tot.models.CandidateGeneration(/, **data)¶
Bases:
pydantic.BaseModel
,Generic
[T
]Structured output model for generating multiple candidate solutions.
This model is used when the generator LLM produces structured output.
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.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.reasoning_and_critique.tot.models.Equation(/, **data)¶
Bases:
pydantic.BaseModel
An equation in reverse-polish notation that combines numbers to reach a target value.
This is one possible implementation of a solution type for mathematical problems.
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.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.reasoning_and_critique.tot.models.EquationGeneration(/, **data)¶
Bases:
pydantic.BaseModel
Specialized candidate generation for equation problems.
This is a structured output model for equation-specific generation.
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.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.reasoning_and_critique.tot.models.Score(/, **data)¶
Bases:
pydantic.BaseModel
A score with feedback.
This represents the evaluation of a candidate solution.
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.
- Parameters:
data (Any)
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.reasoning_and_critique.tot.models.ScoredCandidate(/, **data)¶
Bases:
pydantic.BaseModel
,Generic
[T
]A candidate solution with its evaluation score.
This combines a candidate solution with its score and feedback.
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.
- Parameters:
data (Any)
- property content: T¶
Get the content of the candidate.
- Return type:
T
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- agents.reasoning_and_critique.tot.models.update_candidates(existing=None, updates=None)¶
Update candidate list, handling special cases like clearing.