Spaces:
Sleeping
Sleeping
Update rag_langgraph.py
Browse files- rag_langgraph.py +3 -3
rag_langgraph.py
CHANGED
|
@@ -46,7 +46,7 @@ def today_tool(text: str) -> str:
|
|
| 46 |
"""Returns today's date. Use this for any questions related to knowing today's date.
|
| 47 |
The input should always be an empty string, and this function will always return today's date.
|
| 48 |
Any date mathematics should occur outside this function."""
|
| 49 |
-
return str(date.today())
|
| 50 |
|
| 51 |
def create_graph(topic, word_count):
|
| 52 |
tavily_tool = TavilySearchResults(max_results=10)
|
|
@@ -101,10 +101,10 @@ def create_graph(topic, word_count):
|
|
| 101 |
| JsonOutputFunctionsParser()
|
| 102 |
)
|
| 103 |
|
| 104 |
-
researcher_agent = create_agent(llm, [tavily_tool], system_prompt=f"Prioritizing research papers, research content on topic:
|
| 105 |
researcher_node = functools.partial(agent_node, agent=researcher_agent, name="Researcher")
|
| 106 |
|
| 107 |
-
writer_agent = create_agent(llm, [today_tool], system_prompt=f"Write a {word_count}-word article on topic:
|
| 108 |
writer_node = functools.partial(agent_node, agent=writer_agent, name="Writer")
|
| 109 |
|
| 110 |
workflow = StateGraph(AgentState)
|
|
|
|
| 46 |
"""Returns today's date. Use this for any questions related to knowing today's date.
|
| 47 |
The input should always be an empty string, and this function will always return today's date.
|
| 48 |
Any date mathematics should occur outside this function."""
|
| 49 |
+
return (str(date.today()) + "\n\nIf you have completed all tasks, respond with FINAL ANSWER.")
|
| 50 |
|
| 51 |
def create_graph(topic, word_count):
|
| 52 |
tavily_tool = TavilySearchResults(max_results=10)
|
|
|
|
| 101 |
| JsonOutputFunctionsParser()
|
| 102 |
)
|
| 103 |
|
| 104 |
+
researcher_agent = create_agent(llm, [tavily_tool], system_prompt=f"Prioritizing research papers, research content on topic: {topic}.")
|
| 105 |
researcher_node = functools.partial(agent_node, agent=researcher_agent, name="Researcher")
|
| 106 |
|
| 107 |
+
writer_agent = create_agent(llm, [today_tool], system_prompt=f"Write a {word_count}-word article on topic: {topic}. At the top, add current date and author: Multi-AI-Agent System based on GPT-4o. At the bottom, add a references section with research papers.")
|
| 108 |
writer_node = functools.partial(agent_node, agent=writer_agent, name="Writer")
|
| 109 |
|
| 110 |
workflow = StateGraph(AgentState)
|