Skip to content

The agent engineering platform.

docs: fix import path in `WatsonxToolkit` after releasing langchain-ibm 0.3.17 (#32746)

Mateusz Świtała221c96e7b4ca
diff --git a/docs/docs/integrations/providers/ibm.mdx b/docs/docs/integrations/providers/ibm.mdx
index a0ef1e76f7..ec1fc38874 100644
--- a/docs/docs/integrations/providers/ibm.mdx
+++ b/docs/docs/integrations/providers/ibm.mdx
@@ -77,7 +77,7 @@ from langchain_ibm import WatsonxRerank
See a [usage example](/docs/integrations/tools/ibm_watsonx).
```python
-from langchain_ibm import WatsonxToolkit
+from langchain_ibm.agent_toolkits.utility import WatsonxToolkit
```
## DB2
diff --git a/docs/docs/integrations/tools/ibm_watsonx.ipynb b/docs/docs/integrations/tools/ibm_watsonx.ipynb
index 50f8963cda..c0c4a3b119 100644
--- a/docs/docs/integrations/tools/ibm_watsonx.ipynb
+++ b/docs/docs/integrations/tools/ibm_watsonx.ipynb
@@ -30,7 +30,7 @@
"\n",
"| Class | Package | Serializable | [JS support](https://js.langchain.com/docs/integrations/toolkits/ibm/) | Package downloads | Package latest |\n",
"| :--- | :--- | :---: | :---: | :---: | :---: |\n",
- "| [WatsonxToolkit](https://python.langchain.com/api_reference/ibm/toolkit/langchain_ibm.toolkit.WatsonxToolkit.html) | [langchain-ibm](https://python.langchain.com/api_reference/ibm/index.html) | ❌ | ✅ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-ibm?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-ibm?style=flat-square&label=%20) |"
+ "| [WatsonxToolkit](https://python.langchain.com/api_reference/ibm/agent_toolkits/langchain_ibm.agent_toolkits.utility.toolkit.WatsonxToolkit.html) | [langchain-ibm](https://python.langchain.com/api_reference/ibm/index.html) | ❌ | ✅ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-ibm?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-ibm?style=flat-square&label=%20) |"
]
},
{
@@ -78,7 +78,9 @@
"import os\n",
"\n",
"os.environ[\"WATSONX_URL\"] = \"your service instance url\"\n",
- "os.environ[\"WATSONX_TOKEN\"] = \"your token for accessing the service instance\""
+ "os.environ[\"WATSONX_TOKEN\"] = \"your token for accessing the CLOUD or CPD cluster\"\n",
+ "os.environ[\"WATSONX_PASSWORD\"] = \"your password for accessing the CPD cluster\"\n",
+ "os.environ[\"WATSONX_USERNAME\"] = \"your username for accessing the CPD cluster\""
]
},
{
@@ -116,17 +118,38 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
- "from langchain_ibm import WatsonxToolkit\n",
+ "from langchain_ibm.agent_toolkits.utility import WatsonxToolkit\n",
"\n",
"watsonx_toolkit = WatsonxToolkit(\n",
" url=\"https://us-south.ml.cloud.ibm.com\",\n",
")"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Alternatively, you can use Cloud Pak for Data credentials. For details, see [watsonx.ai software setup](https://ibm.github.io/watsonx-ai-python-sdk/setup_cpd.html). "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "watsonx_toolkit = WatsonxToolkit(\n",
+ " url=\"PASTE YOUR URL HERE\",\n",
+ " username=\"PASTE YOUR USERNAME HERE\",\n",
+ " password=\"PASTE YOUR PASSWORD HERE\",\n",
+ " version=\"5.2\",\n",
+ ")"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -153,7 +176,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Tools\n"
+ "## Tools"
]
},
{
@@ -187,6 +210,14 @@
"watsonx_toolkit.get_tools()"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "> **NOTE** \n",
+ "> The list of available tools may vary depending on whether it is IBM watsonx.ai for IBM Cloud or IBM watsonx.ai software."
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -220,7 +251,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
"outputs": [
{
@@ -235,7 +266,7 @@
}
],
"source": [
- "search_result = google_search.invoke(input=\"IBM\")\n",
+ "search_result = google_search.invoke({\"q\": \"IBM\"})\n",
"search_result"
]
},
@@ -308,7 +339,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -317,7 +348,7 @@
"config = {\"maxResults\": 3}\n",
"google_search.set_tool_config(config)\n",
"\n",
- "search_result = google_search.invoke(input=\"IBM\")\n",
+ "search_result = google_search.invoke({\"q\": \"IBM\"})\n",
"output = json.loads(search_result.get(\"output\"))"
]
},
@@ -578,13 +609,13 @@
"source": [
"## API reference\n",
"\n",
- "For detailed documentation of all `WatsonxToolkit` features and configurations head to the [API reference](https://python.langchain.com/api_reference/ibm/toolkit/langchain_ibm.toolkit.WatsonxToolkit.html)."
+ "For detailed documentation of all `WatsonxToolkit` features and configurations head to the [API reference](https://python.langchain.com/api_reference/ibm/agent_toolkits/langchain_ibm.agent_toolkits.utility.toolkit.WatsonxToolkit.html)."
]
}
],
"metadata": {
"kernelspec": {
- "display_name": "langchain_env",
+ "display_name": "langchain_ibm_repo_env",
"language": "python",
"name": "python3"
},