convert_to_watsonx_tool#
- langchain_ibm.agent_toolkits.utility.utils.convert_to_watsonx_tool(tool: WatsonxTool) dict [source]#
Convert WatsonxTool to watsonx tool structure.
- Parameters:
tool (WatsonxTool) – WatsonxTool from WatsonxToolkit
- Return type:
dict
???+ example “Example”
```python from langchain_ibm.agents_toolkits.utility import WatsonxToolkit
- watsonx_toolkit = WatsonxToolkit(
url=”https://us-south.ml.cloud.ibm.com”, apikey=”*”,
) 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”],
},
},