Update multi_agent.py
Browse files- multi_agent.py +6 -19
multi_agent.py
CHANGED
@@ -46,7 +46,7 @@ def today_tool(text: str) -> str:
|
|
46 |
def create_graph(model, max_tokens, temperature, topic):
|
47 |
tavily_tool = TavilySearchResults(max_results=10)
|
48 |
|
49 |
-
members = ["Content Planner", "
|
50 |
options = ["FINISH"] + members
|
51 |
|
52 |
system_prompt = (
|
@@ -95,7 +95,7 @@ def create_graph(model, max_tokens, temperature, topic):
|
|
95 |
| JsonOutputFunctionsParser()
|
96 |
)
|
97 |
|
98 |
-
content_planner_agent = create_agent(llm, [tavily_tool
|
99 |
"You are a Content Planner working on planning a blog article "
|
100 |
"about the topic: " + topic + "."
|
101 |
"You collect information that helps the "
|
@@ -105,8 +105,8 @@ def create_graph(model, max_tokens, temperature, topic):
|
|
105 |
"the Content Writer to write an article on this topic.")
|
106 |
content_planner_node = functools.partial(agent_node, agent=content_planner_agent, name="Content Planner")
|
107 |
|
108 |
-
|
109 |
-
"You are
|
110 |
"a new opinion piece about the topic: " + topic + ". "
|
111 |
"You base your writing on the work of "
|
112 |
"the Content Planner, who provides an outline "
|
@@ -120,26 +120,13 @@ def create_graph(model, max_tokens, temperature, topic):
|
|
120 |
"You acknowledge in your opinion piece "
|
121 |
"when your statements are opinions "
|
122 |
"as opposed to objective statements.")
|
123 |
-
|
124 |
-
|
125 |
-
article_editor_agent = create_agent(llm, [tavily_tool], system_prompt=
|
126 |
-
"You are an Article Editor who receives a blog post "
|
127 |
-
"from the Content Writer. "
|
128 |
-
"Your goal is to review the blog post "
|
129 |
-
"to ensure that it follows journalistic best practices,"
|
130 |
-
"provides balanced viewpoints "
|
131 |
-
"when providing opinions or assertions, "
|
132 |
-
"and also avoids major controversial topics "
|
133 |
-
"or opinions when possible.")
|
134 |
-
article_editor_node = functools.partial(agent_node, agent=article_editor_agent, name="Article Editor")
|
135 |
-
###
|
136 |
|
137 |
workflow = StateGraph(AgentState)
|
138 |
|
139 |
workflow.add_node("Manager", supervisor_chain)
|
140 |
workflow.add_node("Content Planner", content_planner_node)
|
141 |
-
workflow.add_node("
|
142 |
-
workflow.add_node("Article Editor", article_editor_node)
|
143 |
|
144 |
for member in members:
|
145 |
workflow.add_edge(member, "Manager")
|
|
|
46 |
def create_graph(model, max_tokens, temperature, topic):
|
47 |
tavily_tool = TavilySearchResults(max_results=10)
|
48 |
|
49 |
+
members = ["Content Planner", "Content Writer"]
|
50 |
options = ["FINISH"] + members
|
51 |
|
52 |
system_prompt = (
|
|
|
95 |
| JsonOutputFunctionsParser()
|
96 |
)
|
97 |
|
98 |
+
content_planner_agent = create_agent(llm, [tavily_tool], system_prompt=
|
99 |
"You are a Content Planner working on planning a blog article "
|
100 |
"about the topic: " + topic + "."
|
101 |
"You collect information that helps the "
|
|
|
105 |
"the Content Writer to write an article on this topic.")
|
106 |
content_planner_node = functools.partial(agent_node, agent=content_planner_agent, name="Content Planner")
|
107 |
|
108 |
+
content_writer_agent = create_agent(llm, [today_tool], system_prompt=
|
109 |
+
"You are a Content Writer working on writing "
|
110 |
"a new opinion piece about the topic: " + topic + ". "
|
111 |
"You base your writing on the work of "
|
112 |
"the Content Planner, who provides an outline "
|
|
|
120 |
"You acknowledge in your opinion piece "
|
121 |
"when your statements are opinions "
|
122 |
"as opposed to objective statements.")
|
123 |
+
content_writer_node = functools.partial(agent_node, agent=content_writer_agent, name="Content Writer")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
workflow = StateGraph(AgentState)
|
126 |
|
127 |
workflow.add_node("Manager", supervisor_chain)
|
128 |
workflow.add_node("Content Planner", content_planner_node)
|
129 |
+
workflow.add_node("Content Writer", content_writer_node)
|
|
|
130 |
|
131 |
for member in members:
|
132 |
workflow.add_edge(member, "Manager")
|