mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-15 07:36:08 +00:00
docs: add web search to anthropic docs (#31169)
This commit is contained in:
parent
efc52e18e9
commit
9aac8923a3
File diff suppressed because it is too large
Load Diff
@ -866,29 +866,46 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
See LangChain `docs <https://python.langchain.com/docs/integrations/chat/anthropic/>`_
|
See LangChain `docs <https://python.langchain.com/docs/integrations/chat/anthropic/>`_
|
||||||
for more detail.
|
for more detail.
|
||||||
|
|
||||||
.. code-block:: python
|
Web search:
|
||||||
|
|
||||||
from langchain_anthropic import ChatAnthropic
|
.. code-block:: python
|
||||||
|
|
||||||
llm = ChatAnthropic(model="claude-3-7-sonnet-20250219")
|
from langchain_anthropic import ChatAnthropic
|
||||||
|
|
||||||
tool = {"type": "text_editor_20250124", "name": "str_replace_editor"}
|
llm = ChatAnthropic(model="claude-3-5-sonnet-latest")
|
||||||
llm_with_tools = llm.bind_tools([tool])
|
|
||||||
|
|
||||||
response = llm_with_tools.invoke(
|
tool = {"type": "web_search_20250305", "name": "web_search", "max_uses": 3}
|
||||||
"There's a syntax error in my primes.py file. Can you help me fix it?"
|
llm_with_tools = llm.bind_tools([tool])
|
||||||
)
|
|
||||||
print(response.text())
|
|
||||||
response.tool_calls
|
|
||||||
|
|
||||||
.. code-block:: none
|
response = llm_with_tools.invoke(
|
||||||
|
"How do I update a web app to TypeScript 5.5?"
|
||||||
|
)
|
||||||
|
|
||||||
I'd be happy to help you fix the syntax error in your primes.py file. First, let's look at the current content of the file to identify the error.
|
Text editor:
|
||||||
|
|
||||||
[{'name': 'str_replace_editor',
|
.. code-block:: python
|
||||||
'args': {'command': 'view', 'path': '/repo/primes.py'},
|
|
||||||
'id': 'toolu_01VdNgt1YV7kGfj9LFLm6HyQ',
|
from langchain_anthropic import ChatAnthropic
|
||||||
'type': 'tool_call'}]
|
|
||||||
|
llm = ChatAnthropic(model="claude-3-7-sonnet-20250219")
|
||||||
|
|
||||||
|
tool = {"type": "text_editor_20250124", "name": "str_replace_editor"}
|
||||||
|
llm_with_tools = llm.bind_tools([tool])
|
||||||
|
|
||||||
|
response = llm_with_tools.invoke(
|
||||||
|
"There's a syntax error in my primes.py file. Can you help me fix it?"
|
||||||
|
)
|
||||||
|
print(response.text())
|
||||||
|
response.tool_calls
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
I'd be happy to help you fix the syntax error in your primes.py file. First, let's look at the current content of the file to identify the error.
|
||||||
|
|
||||||
|
[{'name': 'str_replace_editor',
|
||||||
|
'args': {'command': 'view', 'path': '/repo/primes.py'},
|
||||||
|
'id': 'toolu_01VdNgt1YV7kGfj9LFLm6HyQ',
|
||||||
|
'type': 'tool_call'}]
|
||||||
|
|
||||||
Response metadata
|
Response metadata
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
Loading…
Reference in New Issue
Block a user