Luigi D'Addona commited on
Commit
50b0e5a
·
1 Parent(s): 39d1be9

corretto bug: non corretta inizializzazione del modello e assegnazione dei tools

Browse files
Files changed (1) hide show
  1. agent.py +2 -2
agent.py CHANGED
@@ -38,7 +38,7 @@ wikipedia_tool = get_wikipedia_tool()
38
  tools = [search_tool, wikipedia_tool]
39
 
40
  # Bind tools to the model
41
- model = chat.bind_tools(tools)
42
 
43
  tools_by_name = {tool.name: tool for tool in tools}
44
 
@@ -72,7 +72,7 @@ def call_tool(state: AgentState):
72
 
73
  def call_model( state: AgentState, config: RunnableConfig):
74
  # Invoke the model with the system prompt and the messages
75
- response = model.invoke(state["messages"], config)
76
  # We return a list, because this will get added to the existing messages state using the add_messages reducer
77
  return {"messages": [response]}
78
 
 
38
  tools = [search_tool, wikipedia_tool]
39
 
40
  # Bind tools to the model
41
+ chat_with_tools = chat.bind_tools(tools)
42
 
43
  tools_by_name = {tool.name: tool for tool in tools}
44
 
 
72
 
73
  def call_model( state: AgentState, config: RunnableConfig):
74
  # Invoke the model with the system prompt and the messages
75
+ response = chat_with_tools.invoke(state["messages"], config)
76
  # We return a list, because this will get added to the existing messages state using the add_messages reducer
77
  return {"messages": [response]}
78