haive.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 haive.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 haive.agents.reasoning_and_critique.tot.models.CandidateEvaluation(/, **data)ΒΆ
Bases:
pydantic.BaseModelStructured 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 haive.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 haive.agents.reasoning_and_critique.tot.models.Equation(/, **data)ΒΆ
Bases:
pydantic.BaseModelAn 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 haive.agents.reasoning_and_critique.tot.models.EquationGeneration(/, **data)ΒΆ
Bases:
pydantic.BaseModelSpecialized 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 haive.agents.reasoning_and_critique.tot.models.Score(/, **data)ΒΆ
Bases:
pydantic.BaseModelA 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 haive.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].
- haive.agents.reasoning_and_critique.tot.models.update_candidates(existing=None, updates=None)ΒΆ
Update candidate list, handling special cases like clearing.