WatsonxToolkit¶
Reference docs
This page contains reference documentation for WatsonxToolkit. See the docs for conceptual guides, tutorials, and examples on using WatsonxToolkit.
langchain_ibm.agent_toolkits.utility.toolkit.WatsonxToolkit
¶
Bases: BaseToolkit
IBM watsonx.ai Toolkit.
Setup
To use, you should have langchain_ibm python package installed,
and the environment variable WATSONX_API_KEY set with your API key, or pass
it as a named parameter api_key to the constructor.
Deprecated
apikey and WATSONX_APIKEY are deprecated and will be removed in
version 2.0.0. Use api_key and WATSONX_API_KEY instead.
Instantiate
IBM watsonx.ai for IBM Cloud:
from langchain_ibm.agent_toolkits.utility import WatsonxToolkit
watsonx_toolkit = WatsonxToolkit(
url="https://us-south.ml.cloud.ibm.com",
project_id="*****", # or `space_id`
api_key="*****", # not needed if `WATSONX_API_KEY` is set
)
IBM watsonx.ai software:
Invoke
Run
| METHOD | DESCRIPTION |
|---|---|
validate_environment |
Validate that credentials and python package exists in environment. |
get_tools |
Get the tools in the toolkit. |
get_tool |
Get the tool with a given name. |
project_id
class-attribute
instance-attribute
¶
project_id: str | None = None
ID of the watsonx.ai Studio project.
space_id
class-attribute
instance-attribute
¶
space_id: str | None = None
ID of the watsonx.ai Studio space.
url
class-attribute
instance-attribute
¶
URL to the watsonx.ai Runtime.
api_key
class-attribute
instance-attribute
¶
api_key: SecretStr | None = Field(
default_factory=secret_from_env_multi(
names_priority=["WATSONX_API_KEY", "WATSONX_APIKEY"],
deprecated={"WATSONX_APIKEY"},
),
serialization_alias="api_key",
validation_alias=AliasChoices("api_key", "apikey"),
description="API key to the Watson Machine Learning or CPD instance.",
)
API key to the watsonx.ai Runtime.
token
class-attribute
instance-attribute
¶
token: SecretStr | None = Field(
alias="token", default_factory=secret_from_env("WATSONX_TOKEN", default=None)
)
Token to the watsonx.ai Runtime.
password
class-attribute
instance-attribute
¶
password: SecretStr | None = Field(
alias="password", default_factory=secret_from_env("WATSONX_PASSWORD", default=None)
)
Password to the CPD instance.
username
class-attribute
instance-attribute
¶
username: SecretStr | None = Field(
alias="username", default_factory=secret_from_env("WATSONX_USERNAME", default=None)
)
Username to the CPD instance.
instance_id
class-attribute
instance-attribute
¶
instance_id: SecretStr | None = Field(
alias="instance_id",
default_factory=secret_from_env("WATSONX_INSTANCE_ID", default=None),
)
Instance_id of the CPD instance.
version
class-attribute
instance-attribute
¶
version: SecretStr | None = None
Version of the CPD instance.
verify
class-attribute
instance-attribute
¶
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