Skip to content

Reasoning

Reasoning agent model.

WaldiezReasoningAgent

Bases: WaldiezAgent

Reasoning agent model.

get_reasoning_config

get_reasoning_config() -> dict[str, Any]

Get the reasoning configuration based on its method.

Returns:

TypeDescription
dict

The reasoning configuration.

Source code in waldiez/models/agents/reasoning/reasoning_agent.py
def get_reasoning_config(self) -> dict[str, Any]:
    """Get the reasoning configuration based on its method.

    Returns
    -------
    dict
        The reasoning configuration.
    """
    return self.data.get_reasoning_config()

WaldiezReasoningAgentData

Bases: WaldiezAgentData

Reasoning agent data model.

answer_approach property

answer_approach: str

Get the answer approach of the reasoning agent.

Returns:

TypeDescription
str

The answer approach of the reasoning agent.

beam_size property

beam_size: int

Get the beam size of the reasoning agent.

Returns:

TypeDescription
int

The beam size of the reasoning agent.

exploration_constant property

exploration_constant: float

Get the exploration constant of the reasoning agent.

Returns:

TypeDescription
float

The exploration constant of the reasoning agent.

forest_size property

forest_size: int

Get the forest size of the reasoning agent.

Returns:

TypeDescription
int

The forest size of the reasoning agent.

get_reasoning_config

get_reasoning_config() -> dict[str, Any]

Get the reasoning configuration based on the reason_config method.

Returns:

TypeDescription
dict[str, Any]

The reasoning configuration.

Source code in waldiez/models/agents/reasoning/reasoning_agent_data.py
def get_reasoning_config(self) -> dict[str, Any]:
    """Get the reasoning configuration based on the reason_config method.

    Returns
    -------
    dict[str, Any]
        The reasoning configuration.

    """
    reason_dict: dict[str, Any] = {
        "method": self.reason_config.method,
        "max_depth": self.reason_config.max_depth,
        "forest_size": self.reason_config.forest_size,
        "rating_scale": self.reason_config.rating_scale,
    }
    if self.reason_config.method == "beam_search":
        reason_dict["beam_size"] = self.reason_config.beam_size
        reason_dict["answer_approach"] = self.reason_config.answer_approach
    if self.reason_config.method in ("mcts", "lats"):
        reason_dict["nsim"] = self.reason_config.nsim
        reason_dict["exploration_constant"] = (
            self.reason_config.exploration_constant
        )
    return reason_dict

max_depth property

max_depth: int

Get the maximum depth of the reasoning agent.

Returns:

TypeDescription
int

The maximum depth of the reasoning agent.

method property

method: str

Get the method of the reasoning agent.

Returns:

TypeDescription
str

The method of the reasoning agent.

nsim property

nsim: int

Get the number of simulations of the reasoning agent.

Returns:

TypeDescription
int

The number of simulations of the reasoning agent.

rating_scale property

rating_scale: int

Get the rating scale of the reasoning agent.

Returns:

TypeDescription
int

The rating scale of the reasoning agent.

WaldiezReasoningAgentReasonConfig

Bases: WaldiezBase

Reasoning agent's reason configuration model.

Configuration for the reasoning method.

Attributes:

NameTypeDescription
methodLiteral['beam_search', 'mcts', 'lats', 'dfs']

The search strategy to use, default is "beam_search".

max_depthint

Maximum depth of reasoning tree, default is 3.

forest_sizeint

Number of independent trees to maintain, default is 1.

rating_scaleint

Scale for grading responses, e.g. 1-10, default is 10.

beam_sizeint

Number of parallel paths to maintain, default is 3 (for beam_search).

answer_approachLiteral['pool', 'best']

How to select final answer, default is "pool" (only for beam_search).

nsimint

Number of simulations to run, default is 3 (only for mcts and lats).

exploration_constantfloat

UCT exploration parameter, default is 1.41 (only for mcts and lats).

reasoning_agent

Reasoning agent model.

WaldiezReasoningAgent

Bases: WaldiezAgent

Reasoning agent model.

get_reasoning_config

get_reasoning_config() -> dict[str, Any]

Get the reasoning configuration based on its method.

Returns:

TypeDescription
dict

The reasoning configuration.

Source code in waldiez/models/agents/reasoning/reasoning_agent.py
def get_reasoning_config(self) -> dict[str, Any]:
    """Get the reasoning configuration based on its method.

    Returns
    -------
    dict
        The reasoning configuration.
    """
    return self.data.get_reasoning_config()

reasoning_agent_data

Reasoning agent data model.

WaldiezReasoningAgentData

Bases: WaldiezAgentData

Reasoning agent data model.

answer_approach property

answer_approach: str

Get the answer approach of the reasoning agent.

Returns:

TypeDescription
str

The answer approach of the reasoning agent.

beam_size property

beam_size: int

Get the beam size of the reasoning agent.

Returns:

TypeDescription
int

The beam size of the reasoning agent.

exploration_constant property

exploration_constant: float

Get the exploration constant of the reasoning agent.

Returns:

TypeDescription
float

The exploration constant of the reasoning agent.

forest_size property

forest_size: int

Get the forest size of the reasoning agent.

Returns:

TypeDescription
int

The forest size of the reasoning agent.

get_reasoning_config

get_reasoning_config() -> dict[str, Any]

Get the reasoning configuration based on the reason_config method.

Returns:

TypeDescription
dict[str, Any]

The reasoning configuration.

Source code in waldiez/models/agents/reasoning/reasoning_agent_data.py
def get_reasoning_config(self) -> dict[str, Any]:
    """Get the reasoning configuration based on the reason_config method.

    Returns
    -------
    dict[str, Any]
        The reasoning configuration.

    """
    reason_dict: dict[str, Any] = {
        "method": self.reason_config.method,
        "max_depth": self.reason_config.max_depth,
        "forest_size": self.reason_config.forest_size,
        "rating_scale": self.reason_config.rating_scale,
    }
    if self.reason_config.method == "beam_search":
        reason_dict["beam_size"] = self.reason_config.beam_size
        reason_dict["answer_approach"] = self.reason_config.answer_approach
    if self.reason_config.method in ("mcts", "lats"):
        reason_dict["nsim"] = self.reason_config.nsim
        reason_dict["exploration_constant"] = (
            self.reason_config.exploration_constant
        )
    return reason_dict

max_depth property

max_depth: int

Get the maximum depth of the reasoning agent.

Returns:

TypeDescription
int

The maximum depth of the reasoning agent.

method property

method: str

Get the method of the reasoning agent.

Returns:

TypeDescription
str

The method of the reasoning agent.

nsim property

nsim: int

Get the number of simulations of the reasoning agent.

Returns:

TypeDescription
int

The number of simulations of the reasoning agent.

rating_scale property

rating_scale: int

Get the rating scale of the reasoning agent.

Returns:

TypeDescription
int

The rating scale of the reasoning agent.

reasoning_agent_reason_config

Reasoning agent's reason configuration model.

ReasonConfigMethod module-attribute

ReasonConfigMethod = Literal[
    "beam_search", "mcts", "lats", "dfs"
]

Possible reasoning methods.

WaldiezReasoningAgentReasonConfig

Bases: WaldiezBase

Reasoning agent's reason configuration model.

Configuration for the reasoning method.

Attributes:

NameTypeDescription
methodLiteral['beam_search', 'mcts', 'lats', 'dfs']

The search strategy to use, default is "beam_search".

max_depthint

Maximum depth of reasoning tree, default is 3.

forest_sizeint

Number of independent trees to maintain, default is 1.

rating_scaleint

Scale for grading responses, e.g. 1-10, default is 10.

beam_sizeint

Number of parallel paths to maintain, default is 3 (for beam_search).

answer_approachLiteral['pool', 'best']

How to select final answer, default is "pool" (only for beam_search).

nsimint

Number of simulations to run, default is 3 (only for mcts and lats).

exploration_constantfloat

UCT exploration parameter, default is 1.41 (only for mcts and lats).