File size: 786 Bytes
4180985
 
 
125ffe9
 
 
 
4180985
 
 
 
 
 
 
125ffe9
 
 
 
 
ff20ed1
125ffe9
4180985
4698077
 
 
 
4180985
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from typing import Annotated
from typing_extensions import TypedDict
from langgraph.graph.message import add_messages
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic
from tools.design_retriever import design_retriever_tool


class State(TypedDict):
    # Messages have the type "list". The `add_messages` function
    # in the annotation defines how this state key should be updated
    # (in this case, it appends messages to the list, rather than overwriting them)
    messages: Annotated[list, add_messages]

model = ChatAnthropic(model="claude-3-5-sonnet-20240620", temperature=0)

tools = [
    design_retriever_tool
]

model_with_tools = model.bind_tools(tools)

graph = create_react_agent(
    model_with_tools,
    tools=tools
)