Spaces:
Sleeping
Sleeping
Update rag_langgraph.py
Browse files- rag_langgraph.py +6 -6
rag_langgraph.py
CHANGED
|
@@ -46,11 +46,11 @@ def today_tool(text: str) -> str:
|
|
| 46 |
def create_graph(topic):
|
| 47 |
tavily_tool = TavilySearchResults(max_results=10)
|
| 48 |
|
| 49 |
-
members = ["Researcher"
|
| 50 |
|
| 51 |
system_prompt = (
|
| 52 |
"You are a Manager tasked with managing a conversation between the"
|
| 53 |
-
" following
|
| 54 |
" respond with the agent to act next. Each agent will perform a"
|
| 55 |
" task and respond with their results and status. When finished,"
|
| 56 |
" respond with FINISH."
|
|
@@ -96,15 +96,15 @@ def create_graph(topic):
|
|
| 96 |
| JsonOutputFunctionsParser()
|
| 97 |
)
|
| 98 |
|
| 99 |
-
researcher_agent = create_agent(llm, [tavily_tool], system_prompt=f"
|
| 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 2000-word article on topic: {topic}. At the beginning, add current date and author: Multi-AI-Agent System based on GPT-4o. At the end, add a reference section with research papers.")
|
| 103 |
-
writer_node = functools.partial(agent_node, agent=writer_agent, name="Writer")
|
| 104 |
|
| 105 |
workflow = StateGraph(AgentState)
|
| 106 |
workflow.add_node("Researcher", researcher_node)
|
| 107 |
-
|
| 108 |
workflow.add_node("Manager", supervisor_chain)
|
| 109 |
|
| 110 |
for member in members:
|
|
|
|
| 46 |
def create_graph(topic):
|
| 47 |
tavily_tool = TavilySearchResults(max_results=10)
|
| 48 |
|
| 49 |
+
members = ["Researcher"]
|
| 50 |
|
| 51 |
system_prompt = (
|
| 52 |
"You are a Manager tasked with managing a conversation between the"
|
| 53 |
+
" following agent(s): {members}. Given the following user request,"
|
| 54 |
" respond with the agent to act next. Each agent will perform a"
|
| 55 |
" task and respond with their results and status. When finished,"
|
| 56 |
" respond with FINISH."
|
|
|
|
| 96 |
| JsonOutputFunctionsParser()
|
| 97 |
)
|
| 98 |
|
| 99 |
+
researcher_agent = create_agent(llm, [tavily_tool, today_tool], system_prompt=f"Write a 2000-word article on topic: {topic}. At the beginning, add current date and author: Multi-AI-Agent System based on GPT-4o. At the end, add a reference section with research papers.")
|
| 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 2000-word article on topic: {topic}. At the beginning, add current date and author: Multi-AI-Agent System based on GPT-4o. At the end, add a reference section with research papers.")
|
| 103 |
+
#writer_node = functools.partial(agent_node, agent=writer_agent, name="Writer")
|
| 104 |
|
| 105 |
workflow = StateGraph(AgentState)
|
| 106 |
workflow.add_node("Researcher", researcher_node)
|
| 107 |
+
w#orkflow.add_node("Writer", writer_node)
|
| 108 |
workflow.add_node("Manager", supervisor_chain)
|
| 109 |
|
| 110 |
for member in members:
|