Spaces:
Sleeping
Sleeping
Update rag_langgraph.py
Browse files- rag_langgraph.py +2 -5
rag_langgraph.py
CHANGED
|
@@ -26,10 +26,7 @@ class AgentState(TypedDict):
|
|
| 26 |
def create_agent(llm: ChatOpenAI, tools: list, system_prompt: str):
|
| 27 |
prompt = ChatPromptTemplate.from_messages(
|
| 28 |
[
|
| 29 |
-
(
|
| 30 |
-
"system",
|
| 31 |
-
system_prompt
|
| 32 |
-
),
|
| 33 |
MessagesPlaceholder(variable_name="messages"),
|
| 34 |
MessagesPlaceholder(variable_name="agent_scratchpad"),
|
| 35 |
]
|
|
@@ -98,7 +95,7 @@ def create_graph(topic, word_count):
|
|
| 98 |
research_agent = create_agent(llm, [tavily_tool], f"Research content on topic {topic}, prioritizing research papers.")
|
| 99 |
research_node = functools.partial(agent_node, agent=research_agent, name="Researcher")
|
| 100 |
|
| 101 |
-
blogger_agent = create_agent(llm, f"Write a {word_count}-word blog post on topic {topic}. Add a references section with research papers.")
|
| 102 |
blogger_node = functools.partial(agent_node, agent=blogger_agent, name="Blogger")
|
| 103 |
|
| 104 |
workflow = StateGraph(AgentState)
|
|
|
|
| 26 |
def create_agent(llm: ChatOpenAI, tools: list, system_prompt: str):
|
| 27 |
prompt = ChatPromptTemplate.from_messages(
|
| 28 |
[
|
| 29 |
+
("system", system_prompt),
|
|
|
|
|
|
|
|
|
|
| 30 |
MessagesPlaceholder(variable_name="messages"),
|
| 31 |
MessagesPlaceholder(variable_name="agent_scratchpad"),
|
| 32 |
]
|
|
|
|
| 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)
|