WatsonxToolkit#
- class langchain_ibm.agent_toolkits.utility.toolkit.WatsonxToolkit[source]#
Bases:
BaseToolkit
IBM watsonx.ai Toolkit.
???+ info “Setup”
To use, you should have langchain_ibm python package installed, and the environment variable WATSONX_APIKEY set with your API key, or pass it as a named parameter apikey to the constructor.
```bash pip install -U langchain-ibm
# or using uv uv add langchain-ibm ```
`bash export WATSONX_APIKEY="your-api-key" `
??? info “Instantiate”
IBM watsonx.ai for IBM Cloud:
```python from langchain_ibm.agent_toolkits.utility import WatsonxToolkit
- watsonx_toolkit = WatsonxToolkit(
url=”https://us-south.ml.cloud.ibm.com”, project_id=”*”, # or space_id apikey=”*”, # not needed if WATSONX_APIKEY is set
IBM watsonx.ai software: ```python from langchain_ibm.agent_toolkits.utility import WatsonxToolkit
- watsonx_toolkit = WatsonxToolkit(
url=”<CPD_URL>”, project_id=”*”, # or space_id username=”*”, password=”*”, instance_id=”*”, version=”*”, # optional
??? info “Invoke”
??? info “Run”
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- param apikey: SecretStr | None [Optional]#
API key to the watsonx.ai Runtime.
- param instance_id: SecretStr | None [Optional]#
Instance_id of the CPD instance.
- param password: SecretStr | None [Optional]#
Password to the CPD instance.
- param project_id: str | None = None#
ID of the watsonx.ai Studio project.
- param space_id: str | None = None#
ID of the watsonx.ai Studio space.
- param token: SecretStr | None [Optional]#
Token to the watsonx.ai Runtime.
- param url: SecretStr [Optional]#
URL to the watsonx.ai Runtime.
- param username: SecretStr | None [Optional]#
Username to the CPD instance.
- param verify: str | bool | None = None#
You can pass one of following as verify: * the path to a CA_BUNDLE file * the path of directory with certificates of trusted CAs * True - default path to truststore will be taken * False - no verification will be made
- param version: SecretStr | None = None#
Version of the CPD instance.
- param watsonx_client: APIClient | None = None#
- get_tool(
- tool_name: str,
Get the tool with a given name.
- Parameters:
tool_name (str)
- Return type:
- get_tools() list[WatsonxTool] [source]#
Get the tools in the toolkit.
- Return type:
list[WatsonxTool]