Update rag_langgraph.py
Browse files- rag_langgraph.py +4 -4
rag_langgraph.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(topic
|
47 |
tavily_tool = TavilySearchResults(max_results=10)
|
48 |
|
49 |
members = ["Researcher", "Writer"]
|
@@ -99,7 +99,7 @@ def create_graph(topic, word_count):
|
|
99 |
researcher_agent = create_agent(llm, [tavily_tool], system_prompt=f"Prioritizing research papers, research content on topic: {topic}.")
|
100 |
researcher_node = functools.partial(agent_node, agent=researcher_agent, name="Researcher")
|
101 |
|
102 |
-
writer_agent = create_agent(llm, [today_tool], system_prompt=f"Write a
|
103 |
writer_node = functools.partial(agent_node, agent=writer_agent, name="Writer")
|
104 |
|
105 |
workflow = StateGraph(AgentState)
|
@@ -118,8 +118,8 @@ def create_graph(topic, word_count):
|
|
118 |
|
119 |
return workflow.compile()
|
120 |
|
121 |
-
def run_multi_agent(topic
|
122 |
-
graph = create_graph(topic
|
123 |
result = graph.invoke({
|
124 |
"messages": [
|
125 |
HumanMessage(content=topic)
|
|
|
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(topic):
|
47 |
tavily_tool = TavilySearchResults(max_results=10)
|
48 |
|
49 |
members = ["Researcher", "Writer"]
|
|
|
99 |
researcher_agent = create_agent(llm, [tavily_tool], system_prompt=f"Prioritizing research papers, research content on topic: {topic}.")
|
100 |
researcher_node = functools.partial(agent_node, agent=researcher_agent, name="Researcher")
|
101 |
|
102 |
+
writer_agent = create_agent(llm, [today_tool], system_prompt=f"Write a 1000-word article on topic: {topic}, including a reference section with research papers. At the top, add current date and author: Multi-AI-Agent System based on GPT-4o.")
|
103 |
writer_node = functools.partial(agent_node, agent=writer_agent, name="Writer")
|
104 |
|
105 |
workflow = StateGraph(AgentState)
|
|
|
118 |
|
119 |
return workflow.compile()
|
120 |
|
121 |
+
def run_multi_agent(topic):
|
122 |
+
graph = create_graph(topic)
|
123 |
result = graph.invoke({
|
124 |
"messages": [
|
125 |
HumanMessage(content=topic)
|