bstraehle commited on
Commit
f5f2419
1 Parent(s): d18be22

Update rag_langgraph.py

Browse files
Files changed (1) hide show
  1. rag_langgraph.py +5 -6
rag_langgraph.py CHANGED
@@ -42,7 +42,7 @@ def agent_node(state, agent, name):
42
  def create_graph(topic, word_count):
43
  tavily_tool = TavilySearchResults(max_results=10)
44
 
45
- members = ["Researcher", "Blogger"]
46
 
47
  system_prompt = (
48
  "You are a manager tasked with managing a conversation between the"
@@ -92,15 +92,11 @@ def create_graph(topic, word_count):
92
  | JsonOutputFunctionsParser()
93
  )
94
 
95
- research_agent = create_agent(llm, [tavily_tool], f"Research content on topic {topic}, prioritizing research papers.")
96
  research_node = functools.partial(agent_node, agent=research_agent, name="Researcher")
97
 
98
- blogger_agent = create_agent(llm, [], system_prompt=f"Write a {word_count}-word blog post on topic {topic}. Add a references section with research papers.")
99
- blogger_node = functools.partial(agent_node, agent=blogger_agent, name="Blogger")
100
-
101
  workflow = StateGraph(AgentState)
102
  workflow.add_node("Researcher", research_node)
103
- workflow.add_node("Blogger", blogger_node)
104
  workflow.add_node("Manager", supervisor_chain)
105
 
106
  for member in members:
@@ -121,4 +117,7 @@ def run_multi_agent(topic, word_count):
121
  HumanMessage(content=topic)
122
  ]
123
  })
 
 
 
124
  return result['messages'][1].content
 
42
  def create_graph(topic, word_count):
43
  tavily_tool = TavilySearchResults(max_results=10)
44
 
45
+ members = ["Researcher"]
46
 
47
  system_prompt = (
48
  "You are a manager tasked with managing a conversation between the"
 
92
  | JsonOutputFunctionsParser()
93
  )
94
 
95
+ research_agent = create_agent(llm, [tavily_tool], system_prompt=f"Based on research papers, write a {word_count}-word article on topic {topic}. Add a references section with research papers.")
96
  research_node = functools.partial(agent_node, agent=research_agent, name="Researcher")
97
 
 
 
 
98
  workflow = StateGraph(AgentState)
99
  workflow.add_node("Researcher", research_node)
 
100
  workflow.add_node("Manager", supervisor_chain)
101
 
102
  for member in members:
 
117
  HumanMessage(content=topic)
118
  ]
119
  })
120
+ print("##########")
121
+ print(result['messages'][1].content)
122
+ print("##########")
123
  return result['messages'][1].content