Skip to content

Commit 32f7695

Browse files
authored
docs: Little update in sample notebook with WatsonxToolkit (#30614)
**Description:** - Updated sample notebook with valid tools.
1 parent 9d3262c commit 32f7695

File tree

1 file changed

+25
-31
lines changed

1 file changed

+25
-31
lines changed

docs/docs/integrations/tools/ibm_watsonx.ipynb

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,21 @@
166166
},
167167
{
168168
"cell_type": "code",
169-
"execution_count": 3,
169+
"execution_count": null,
170170
"metadata": {},
171171
"outputs": [
172172
{
173-
"data": {
174-
"text/plain": [
175-
"[WatsonxTool(name='GoogleSearch', description='Search for online trends, news, current events, real-time information, or research topics.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Search for online trends, news, current events, real-time information, or research topics.', tool_config_schema={'title': 'config schema for GoogleSearch tool', 'type': 'object', 'properties': {'maxResults': {'title': 'Max number of results to return', 'type': 'integer', 'minimum': 1, 'maximum': 20}}}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
176-
" WatsonxTool(name='WebCrawler', description='Useful for when you need to summarize a webpage. Do not use for Web search.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Useful for when you need to summarize a webpage. Do not use for Web search.', tool_input_schema={'type': 'object', 'properties': {'url': {'title': 'url', 'description': 'URL for the webpage to be scraped', 'type': 'string', 'pattern': '^(https?:\\\\/\\\\/)?([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([\\\\/\\\\w \\\\.-]*)*\\\\/?$'}}, 'required': ['url']}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
177-
" WatsonxTool(name='PythonInterpreter', description='Run Python code generated by the agent model.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Run Python code and return the console output. Use for isolated calculations, computations or data manipulation. In Python, the following modules are available: Use numpy, pandas, scipy and sympy for working with data. Use matplotlib to plot charts. Other Python libraries are also available -- however, prefer using the ones above. Prefer using qualified imports -- `import library; library.thing()` instead of `import thing from library`. Do not attempt to install libraries manually -- it will not work. Do not use this tool multiple times in a row, always write the full code you want to run in a single invocation. If you get an error running Python code, try to generate a better one that will pass. If the tool returns result that starts with IMAGE(, follow instructions for rendering images.', watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
178-
" WatsonxTool(name='SDXLTurbo', description='Generate an image from text using Stability.ai', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Generate an image from text. Not for image refining. Use very precise language about the desired image, including setting, lighting, style, filters and lenses used. Do not ask the tool to refine an image.', watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
179-
" WatsonxTool(name='Weather', description='Find the weather for a city.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Find the weather for a city.', tool_input_schema={'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']}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
180-
" WatsonxTool(name='RAGQuery', description='Search the documents in a vector index.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Search information in documents to provide context to a user query. Useful when asked to ground the answer in specific knowledge about {indexName}', tool_config_schema={'title': 'config schema for RAGQuery tool', 'type': 'object', 'properties': {'vectorIndexId': {'title': 'Vector index identifier', 'type': 'string'}, 'projectId': {'title': 'Project identifier', 'type': 'string'}, 'spaceId': {'title': 'Space identifier', 'type': 'string'}}, 'required': ['vectorIndexId'], 'oneOf': [{'required': ['projectId']}, {'required': ['spaceId']}]}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>)]"
181-
]
182-
},
183-
"execution_count": 3,
184-
"metadata": {},
185-
"output_type": "execute_result"
173+
"name": "stdout",
174+
"output_type": "stream",
175+
"text": [
176+
"\n",
177+
"[WatsonxTool(name='GoogleSearch', description='Search for online trends, news, current events, real-time information, or research topics.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Search for online trends, news, current events, real-time information, or research topics.', tool_config_schema={'title': 'config schema for GoogleSearch tool', 'type': 'object', 'properties': {'maxResults': {'title': 'Max number of results to return', 'type': 'integer', 'minimum': 1, 'maximum': 20}}}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
178+
" WatsonxTool(name='WebCrawler', description='Useful for when you need to summarize a webpage. Do not use for Web search.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Useful for when you need to summarize a webpage. Do not use for Web search.', tool_input_schema={'type': 'object', 'properties': {'url': {'title': 'url', 'description': 'URL for the webpage to be scraped', 'type': 'string', 'pattern': '^(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?$'}}, 'required': ['url']}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
179+
" WatsonxTool(name='SDXLTurbo', description='Generate an image from text using Stability.ai', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Generate an image from text. Not for image refining. Use very precise language about the desired image, including setting, lighting, style, filters and lenses used. Do not ask the tool to refine an image.', watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
180+
" WatsonxTool(name='Weather', description='Find the weather for a city.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Find the weather for a city.', tool_input_schema={'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']}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>),\n",
181+
" WatsonxTool(name='RAGQuery', description='Search the documents in a vector index.', args_schema=<class 'langchain_ibm.toolkit.ToolArgsSchema'>, agent_description='Search information in documents to provide context to a user query. Useful when asked to ground the answer in specific knowledge about {indexName}', tool_config_schema={'title': 'config schema for RAGQuery tool', 'type': 'object', 'properties': {'vectorIndexId': {'title': 'Vector index identifier', 'type': 'string'}, 'projectId': {'title': 'Project identifier', 'type': 'string'}, 'spaceId': {'title': 'Space identifier', 'type': 'string'}}, 'required': ['vectorIndexId'], 'oneOf': [{'required': ['projectId']}, {'required': ['spaceId']}]}, watsonx_client=<ibm_watsonx_ai.client.APIClient object at 0x127e0f490>)]\n",
182+
"\n"
183+
]
186184
}
187185
],
188186
"source": [
@@ -228,7 +226,7 @@
228226
{
229227
"data": {
230228
"text/plain": [
231-
"{'output': '[{\"title\":\"IBM - United States\",\"description\":\"Technology & Consulting. From next-generation AI to cutting edge hybrid cloud solutions to the deep expertise of IBM Consulting, IBM has what it takes to help\\xa0...\",\"url\":\"https://www.ibm.com/us-en\"},{\"title\":\"IBM - Wikipedia\",\"description\":\"International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American multinational technology company headquartered in\\xa0...\",\"url\":\"https://en.wikipedia.org/wiki/IBM\"},{\"title\":\"IBM Envizi ESG Suite\",\"description\":\"Envizi systemizes the capture, transformation and consolidation of disparate sustainability data into a single source of truth and delivers actionable insights.\",\"url\":\"https://www.ibm.com/products/envizi\"},{\"title\":\"IBM Research\",\"description\":\"Tools + Code · BeeAI Framework. Open-source framework for building, deploying, and serving powerful agentic workflows at scale. · Docling. An open-source tool\\xa0...\",\"url\":\"https://research.ibm.com/\"},{\"title\":\"IBM SkillsBuild: Free Skills-Based Learning From Technology Experts\",\"description\":\"IBM SkillsBuildPower your future in tech with job skills, courses, and credentials—for free. Power your future in tech with job skills, courses, and credentials\\xa0...\",\"url\":\"https://skillsbuild.org/\"},{\"title\":\"IBM | LinkedIn\",\"description\":\"Locations · Primary. International Business Machines Corp. · 590 Madison Ave · 90 Grayston Dr · Plaza Independencia 721 · 388 Phahon Yothin Road · Jalan Prof.\",\"url\":\"https://www.linkedin.com/company/ibm\"},{\"title\":\"International Business Machines Corporation (IBM) Stock Price ...\",\"description\":\"Mar 18, 2025 ... International Business Machines Corporation (IBM) · 1.19% · -2.77% · 11.49% · 12.00% · 29.04% · 138.39% · 3,238.84%. Key Events. Mountain.\",\"url\":\"https://finance.yahoo.com/quote/IBM/\"},{\"title\":\"Zurich - IBM Research\",\"description\":\"The location in Zurich is one of IBM\\'s 12 global research labs. IBM has maintained a research laboratory in Switzerland since 1956.\",\"url\":\"https://research.ibm.com/labs/zurich\"},{\"title\":\"IBM Newsroom\",\"description\":\"News and press releases from around the IBM world. Media contacts. Sources by topic and by region. IBM Media center. Explore IBM\\'s latest and most popular\\xa0...\",\"url\":\"https://newsroom.ibm.com/\"},{\"title\":\"IBM (@ibm) • Instagram photos and videos\",\"description\":\"Science, Technology & Engineering. We partner with developers, data scientists, CTOs and other creators to make the world work better.\",\"url\":\"https://www.instagram.com/ibm/?hl=en\"}]'}"
229+
"{'output': '[{\"title\":\"IBM - United States\",\"description\":\"Technology & Consulting. From next-generation AI to cutting edge hybrid cloud solutions to the deep expertise of IBM Consulting, IBM has what it takes to help\\xa0...\",\"url\":\"https://www.ibm.com/us-en\"},{\"title\":\"IBM - Wikipedia\",\"description\":\"International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American multinational technology company headquartered in\\xa0...\",\"url\":\"https://en.wikipedia.org/wiki/IBM\"},{\"title\":\"IBM Envizi ESG Suite\",\"description\":\"Envizi systemizes the capture, transformation and consolidation of disparate sustainability data into a single source of truth and delivers actionable insights.\",\"url\":\"https://www.ibm.com/products/envizi\"},{\"title\":\"IBM Research\",\"description\":\"Tools + Code · BeeAI Framework. Open-source framework for building, deploying, and serving powerful agentic workflows at scale. · Docling. An open-source tool\\xa0...\",\"url\":\"https://research.ibm.com/\"},{\"title\":\"IBM SkillsBuild: Free Skills-Based Learning From Technology Experts\",\"description\":\"IBM SkillsBuildPower your future in tech with job skills, courses, and credentials—for free. Power your future in tech with job skills, courses, and credentials\\xa0...\",\"url\":\"https://skillsbuild.org/\"},{\"title\":\"IBM | LinkedIn\",\"description\":\"Locations · Primary. International Business Machines Corp. · 590 Madison Ave · 90 Grayston Dr · Plaza Independencia 721 · 388 Phahon Yothin Road · Jalan Prof.\",\"url\":\"https://www.linkedin.com/company/ibm\"},{\"title\":\"International Business Machines Corporation (IBM)\",\"description\":\"PROFITABILITY_AND_INCOME_STATEMENT · 9.60% · (TTM). 3.06% · (TTM). 24.06% · (TTM). 62.75B · (TTM). 6.02B · (TTM). 6.41. BALANCE_SHEET_AND_CASH_FLOW. (MRQ).\",\"url\":\"https://finance.yahoo.com/quote/IBM/\"},{\"title\":\"Zurich - IBM Research\",\"description\":\"The location in Zurich is one of IBM\\'s 12 global research labs. IBM has maintained a research laboratory in Switzerland since 1956.\",\"url\":\"https://research.ibm.com/labs/zurich\"},{\"title\":\"IBM (@ibm) • Instagram photos and videos\",\"description\":\"Science, Technology & Engineering. We partner with developers, data scientists, CTOs and other creators to make the world work better.\",\"url\":\"https://www.instagram.com/ibm/?hl=en\"},{\"title\":\"IBM Newsroom\",\"description\":\"News and press releases from around the IBM world. Media contacts. Sources by topic and by region. IBM Media center. Explore IBM\\'s latest and most popular\\xa0...\",\"url\":\"https://newsroom.ibm.com/\"}]'}"
232230
]
233231
},
234232
"execution_count": 5,
@@ -416,7 +414,7 @@
416414
{
417415
"data": {
418416
"text/plain": [
419-
"{'output': 'Current weather in New York:\\nTemperature: 12.1°C\\nRain: 0mm\\nRelative humidity: 36%\\nWind: 8.1km/h\\n'}"
417+
"{'output': 'Current weather in New York:\\nTemperature: 0°C\\nRain: 0mm\\nRelative humidity: 63%\\nWind: 7.6km/h\\n'}"
420418
]
421419
},
422420
"execution_count": 12,
@@ -450,10 +448,10 @@
450448
"output_type": "stream",
451449
"text": [
452450
"Current weather in New York:\n",
453-
"Temperature: 12.1°C\n",
451+
"Temperature: 0°C\n",
454452
"Rain: 0mm\n",
455-
"Relative humidity: 36%\n",
456-
"Wind: 8.1km/h\n",
453+
"Relative humidity: 63%\n",
454+
"Wind: 7.6km/h\n",
457455
"\n"
458456
]
459457
}
@@ -480,7 +478,7 @@
480478
{
481479
"data": {
482480
"text/plain": [
483-
"ToolMessage(content='{\"output\": \"Current weather in Los Angeles:\\\\nTemperature: 13.3°C\\\\nRain: 0mm\\\\nRelative humidity: 89%\\\\nWind: 3.3km/h\\\\n\"}', name='Weather', tool_call_id='1')"
481+
"ToolMessage(content='{\"output\": \"Current weather in Los Angeles:\\\\nTemperature: 8.6°C\\\\nRain: 0mm\\\\nRelative humidity: 61%\\\\nWind: 8.4km/h\\\\n\"}', name='Weather', tool_call_id='1')"
484482
]
485483
},
486484
"execution_count": 14,
@@ -510,7 +508,7 @@
510508
},
511509
{
512510
"cell_type": "code",
513-
"execution_count": 15,
511+
"execution_count": null,
514512
"metadata": {},
515513
"outputs": [],
516514
"source": [
@@ -537,7 +535,7 @@
537535
},
538536
{
539537
"cell_type": "code",
540-
"execution_count": null,
538+
"execution_count": 17,
541539
"metadata": {},
542540
"outputs": [
543541
{
@@ -549,21 +547,17 @@
549547
"What is the weather in Boston?\n",
550548
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
551549
"Tool Calls:\n",
552-
" Weather (chatcmpl-tool-fe07ca2f5b5a4fd584eaedc889bea5b7)\n",
553-
" Call ID: chatcmpl-tool-fe07ca2f5b5a4fd584eaedc889bea5b7\n",
550+
" Weather (chatcmpl-tool-6a6c21402c824e43bdd2e8ba390af4a8)\n",
551+
" Call ID: chatcmpl-tool-6a6c21402c824e43bdd2e8ba390af4a8\n",
554552
" Args:\n",
555553
" location: Boston\n",
556554
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
557555
"Name: Weather\n",
558556
"\n",
559-
"{\"output\": \"Current weather in Boston:\\nTemperature: 9.1°C\\nRain: 0mm\\nRelative humidity: 41%\\nWind: 24.5km/h\\n\"}\n",
557+
"{\"output\": \"Current weather in Boston:\\nTemperature: -1°C\\nRain: 0mm\\nRelative humidity: 53%\\nWind: 8.3km/h\\n\"}\n",
560558
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
561559
"\n",
562-
"The current weather in Boston is:\n",
563-
"Temperature: 9.1°C\n",
564-
"Rain: 0mm\n",
565-
"Relative humidity: 41%\n",
566-
"Wind: 24.5km/h\n"
560+
"The current weather in Boston is -1°C with 0mm of rain, a relative humidity of 53%, and a wind speed of 8.3km/h.\n"
567561
]
568562
}
569563
],
@@ -590,7 +584,7 @@
590584
],
591585
"metadata": {
592586
"kernelspec": {
593-
"display_name": "langchain-ibm",
587+
"display_name": "langchain_env",
594588
"language": "python",
595589
"name": "python3"
596590
},

0 commit comments

Comments
 (0)