Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,18 @@ from typing_extensions import TypedDict
|
|
| 4 |
|
| 5 |
from langgraph.graph import StateGraph, START, END
|
| 6 |
from langgraph.graph.message import add_messages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
class State(TypedDict):
|
|
|
|
| 4 |
|
| 5 |
from langgraph.graph import StateGraph, START, END
|
| 6 |
from langgraph.graph.message import add_messages
|
| 7 |
+
from langchain_anthropic import ChatAnthropic
|
| 8 |
+
|
| 9 |
+
llm = ChatAnthropic(model="claude-3-5-sonnet-20240620")
|
| 10 |
+
|
| 11 |
+
def chatbot(state: State):
|
| 12 |
+
return {"messages": [llm.invoke(state["messages"])]}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# The first argument is the unique node name
|
| 16 |
+
# The second argument is the function or object that will be called whenever
|
| 17 |
+
# the node is used.
|
| 18 |
+
graph_builder.add_node("chatbot", chatbot)
|
| 19 |
|
| 20 |
|
| 21 |
class State(TypedDict):
|