convert_to_watsonx_tool#
- langchain_ibm.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:
from langchain_ibm 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) # Return # { # "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"], # }, # }, # }