bstraehle commited on
Commit
6f51a0c
·
verified ·
1 Parent(s): 608bacc

Update multi_agent.py

Browse files
Files changed (1) hide show
  1. multi_agent.py +4 -6
multi_agent.py CHANGED
@@ -43,7 +43,7 @@ def today_tool(text: str) -> str:
43
  Any date mathematics should occur outside this function."""
44
  return (str(date.today()) + "\n\nIf you have completed all tasks, respond with FINAL ANSWER.")
45
 
46
- def create_graph(llm_manager, llm_agent, topic):
47
  tavily_tool = TavilySearchResults(max_results=10)
48
 
49
  members = ["Researcher"]
@@ -87,7 +87,7 @@ def create_graph(llm_manager, llm_agent, topic):
87
  ]
88
  ).partial(options=str(options), members=", ".join(members))
89
 
90
- llm = ChatOpenAI(model=llm_manager)
91
 
92
  supervisor_chain = (
93
  prompt
@@ -95,8 +95,6 @@ def create_graph(llm_manager, llm_agent, topic):
95
  | JsonOutputFunctionsParser()
96
  )
97
 
98
- llm = ChatOpenAI(model=llm_agent)
99
-
100
  researcher_agent = create_agent(llm, [tavily_tool, today_tool], system_prompt=
101
  "1. Research content on topic: " + topic + ". "
102
  "2. Based on your research, write an in-depth article on the topic. "
@@ -121,8 +119,8 @@ def create_graph(llm_manager, llm_agent, topic):
121
 
122
  return workflow.compile()
123
 
124
- def run_multi_agent(llm_manager, llm_agent, topic):
125
- graph = create_graph(llm_manager, llm_agent, topic)
126
 
127
  result = graph.invoke({
128
  "messages": [
 
43
  Any date mathematics should occur outside this function."""
44
  return (str(date.today()) + "\n\nIf you have completed all tasks, respond with FINAL ANSWER.")
45
 
46
+ def create_graph(llm, topic):
47
  tavily_tool = TavilySearchResults(max_results=10)
48
 
49
  members = ["Researcher"]
 
87
  ]
88
  ).partial(options=str(options), members=", ".join(members))
89
 
90
+ llm = ChatOpenAI(model=llm)
91
 
92
  supervisor_chain = (
93
  prompt
 
95
  | JsonOutputFunctionsParser()
96
  )
97
 
 
 
98
  researcher_agent = create_agent(llm, [tavily_tool, today_tool], system_prompt=
99
  "1. Research content on topic: " + topic + ". "
100
  "2. Based on your research, write an in-depth article on the topic. "
 
119
 
120
  return workflow.compile()
121
 
122
+ def run_multi_agent(llm, topic):
123
+ graph = create_graph(llm, topic)
124
 
125
  result = graph.invoke({
126
  "messages": [