docs: Update langchain-anthropic version for tutorial with web search tool (#31240)

**Description:** This is a document change regarding integration with
package `langchain-anthropic` for newly released websearch tool ([Claude
doc](https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool)).

Issue 1: The sample in [Web Search
section](https://python.langchain.com/docs/integrations/chat/anthropic/#web-search)
did not run. You would get an error as below:
```
File "my_file.py", line 170, in call
    model_with_tools = model.bind_tools([websearch_tool])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/langchain_anthropic/chat_models.py", line 1363, in bind_tools
    tool if _is_builtin_tool(tool) else convert_to_anthropic_tool(tool)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/langchain_anthropic/chat_models.py", line 1645, in convert_to_anthropic_tool
    input_schema=oai_formatted["parameters"],
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'parameters'
```
This is because websearch tool is only recently supported in
langchain-anthropic==0.3.13`, in [0.3.13
release](https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-anthropic%3D%3D0%22&expanded=true)
mentioning:
> anthropic[patch]: support web search
(https://github.com/langchain-ai/langchain/pull/31157)



Issue 2: The current doc has outdated package requirements for Websearch
tool: "This guide requires langchain-anthropic>=0.3.10".

Changes:
- Updated the required `langchain-anthropic` package version (0.3.10 ->
0.3.13).
- Added notes to user when using websearch sample.

I believe this will help avoid future confusion from readers.

**Issue:** N/A
**Dependencies:** N/A
**Twitter handle:** N/A
This commit is contained in:
Minh Nguyen
2025-05-15 01:19:32 +07:00
committed by GitHub
parent 7263011b24
commit 8af0dc5fd6

View File

@@ -107,7 +107,7 @@
"id": "fe4993ad-4a9b-4021-8ebd-f0fbbc739f49",
"metadata": {},
"source": [
":::info This guide requires ``langchain-anthropic>=0.3.10``\n",
":::info This guide requires ``langchain-anthropic>=0.3.13``\n",
"\n",
":::"
]
@@ -926,6 +926,16 @@
"Claude can use a [web search tool](https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool) to run searches and ground its responses with citations."
]
},
{
"cell_type": "markdown",
"id": "6a0e8fd5",
"metadata": {},
"source": [
":::info Web search tool is supported since ``langchain-anthropic>=0.3.13``\n",
"\n",
":::"
]
},
{
"cell_type": "code",
"execution_count": 1,