mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-31 20:29:46 +02:00
docs: more concise readme (#3815)
This commit is contained in:
@@ -25,7 +25,7 @@ pip install -U langgraph
|
||||
To learn more about how to use LangGraph, check out [the docs](https://langchain-ai.github.io/langgraph/). We show a simple example below of how to create a ReAct agent.
|
||||
|
||||
```python
|
||||
from langchain_anthropic import ChatAnthropic
|
||||
# This code depends on pip install langchain[anthropic]
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
|
||||
def search(query: str):
|
||||
@@ -34,9 +34,7 @@ def search(query: str):
|
||||
return "It's 60 degrees and foggy."
|
||||
return "It's 90 degrees and sunny."
|
||||
|
||||
model = ChatAnthropic(model=“claude-3-7-sonnet-latest”)
|
||||
tools = [search]
|
||||
agent = create_react_agent(model, tools)
|
||||
agent = create_react_agent("anthropic:claude-3-7-sonnet-latest", tools=[search])
|
||||
agent.invoke(
|
||||
{"messages": [{"role": "user", "content": "what is the weather in sf"}]}
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ pip install -U langgraph
|
||||
To learn more about how to use LangGraph, check out [the docs](https://langchain-ai.github.io/langgraph/). We show a simple example below of how to create a ReAct agent.
|
||||
|
||||
```python
|
||||
from langchain_anthropic import ChatAnthropic
|
||||
# This code depends on pip install langchain[anthropic]
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
|
||||
def search(query: str):
|
||||
@@ -34,9 +34,7 @@ def search(query: str):
|
||||
return "It's 60 degrees and foggy."
|
||||
return "It's 90 degrees and sunny."
|
||||
|
||||
model = ChatAnthropic(model=“claude-3-7-sonnet-latest”)
|
||||
tools = [search]
|
||||
agent = create_react_agent(model, tools)
|
||||
agent = create_react_agent("anthropic:claude-3-7-sonnet-latest", tools=[search])
|
||||
agent.invoke(
|
||||
{"messages": [{"role": "user", "content": "what is the weather in sf"}]}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user