autogen.interop.pydantic_ai.pydantic_ai_tool.PydanticAITool
PydanticAITool
A class representing a Pydantic AI Tool that extends the general Tool functionality with additional functionality specific to Pydantic AI tools.
This class inherits from the Tool class and adds functionality for registering tools with a ConversableAgent, along with providing additional schema information specific to Pydantic AI tools, such as parameters and function signatures.
Attributes: parameters_json_schema (Dict[str, Any]): A schema describing the parameters that the tool’s function expects.
Initializes a PydanticAITool object with the provided name, description, function, and parameter schema.
Parameters:Name | Description |
---|---|
name | The name of the tool. Type: str |
description | A description of what the tool does. Type: str |
func | The function that is executed when the tool is called. Type: Callable[..., Any] |
parameters_json_schema | A schema describing the parameters that the function accepts. Type: dict[str, typing.Any] |
Instance Methods
register_for_llm
Registers the tool with the ConversableAgent for use with a language model (LLM).
This method updates the agent’s tool signature to include the function schema, allowing the agent to invoke the tool correctly during interactions with the LLM.
Parameters:Name | Description |
---|---|
agent | The agent with which the tool will be registered. Type: autogen.agentchat.conversable_agent.ConversableAgent |