Convert WatsonxTool to watsonx tool structure.
convert_to_watsonx_tool(
tool: WatsonxTool,
) -> dict[str, Any]from langchain_ibm.agents_toolkits.utility import WatsonxToolkit
watsonx_toolkit = WatsonxToolkit(
url="https://us-south.ml.cloud.ibm.com",
api_key="*****",
)
weather_tool = watsonx_toolkit.get_tool("Weather")
convert_to_watsonx_tool(weather_tool)
{
"type": "function",
"function": {
"name": "Weather",
"description": "Find the weather for a city.",
"parameters": {
"type": "object",
"properties": {
"location": {
"title": "location",
"description": "Name of the location",
"type": "string",
},
"country": {
"title": "country",
"description": "Name of the state or country",
"type": "string",
},
},
"required": ["location"],
},
},
}| Name | Type | Description |
|---|---|---|
tool* | WatsonxTool |
|