utcp_client
File: core/src/utcp/utcp_client.py
class UtcpClient
No class documentation available
Methods:
async create(cls, root_dir: Optional[str], config: Optional[Union[str, Dict[str, Any], 'UtcpClientConfig']]) -> 'UtcpClient'
Create a new instance of UtcpClient.
Args
root_dir
: The root directory for the client to resolve relative paths from. Defaults to the current working directory.config
: The configuration for the client. Can be a path to a configuration file, a dictionary, or UtcpClientConfig object.tool_repository
: The tool repository to use. Defaults to InMemToolRepository.search_strategy
: The tool search strategy to use. Defaults to TagSearchStrategy.
Returns
A new instance of UtcpClient.
async register_manual(self, manual_call_template: CallTemplate) -> RegisterManualResult
Register a tool CallTemplate and its tools.
Args
manual_call_template
: The CallTemplate to register.
Returns
A RegisterManualResult object containing the registered CallTemplate and its tools.
async register_manuals(self, manual_call_templates: List[CallTemplate]) -> List[RegisterManualResult]
Register multiple tool CallTemplates and their tools.
Args
manual_call_templates
: List of CallTemplates to register.
Returns
A list of RegisterManualResult objects containing the registered CallTemplates and their tools. Order is not preserved.
async deregister_manual(self, manual_call_template_name: str) -> bool
Deregister a tool CallTemplate.
Args
manual_call_template_name
: The name of the CallTemplate to deregister.
Returns
True if the CallTemplate was deregistered, False otherwise.
async call_tool(self, tool_name: str, tool_args: Dict[str, Any]) -> Any
Call a tool.
Args
tool_name
: The name of the tool to call.tool_args
: The arguments to pass to the tool.
Returns
The result of the tool call.
async call_tool_streaming(self, tool_name: str, tool_args: Dict[str, Any]) -> AsyncGenerator[Any, None]
Call a tool streamingly.
Args
tool_name
: The name of the tool to call.tool_args
: The arguments to pass to the tool.
Returns
An async generator that yields the result of the tool call.
async search_tools(self, query: str, limit: int, any_of_tags_required: Optional[List[str]]) -> List[Tool]
Search for tools relevant to the query.
Args
query
: The search query.limit
: The maximum number of tools to return. 0 for no limit.any_of_tags_required
: Optional list of tags where one of them must be present in the tool's tags
Returns
A list of tools that match the search query.
async get_required_variables_for_manual_and_tools(self, manual_call_template: CallTemplate) -> List[str]
Get the required variables for a manual CallTemplate and its tools.
Args
manual_call_template
: The manual CallTemplate.
Returns
A list of required variables for the manual CallTemplate and its tools.
async get_required_variables_for_registered_tool(self, tool_name: str) -> List[str]
Get the required variables for a registered tool.
Args
tool_name
: The name of a registered tool.
Returns
A list of required variables for the tool.