Skip to content

Commit 02c6ed9

Browse files
committed
rename to publisher
1 parent 34d34f3 commit 02c6ed9

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

templates/types/multiagent/fastapi/app/examples/choreography.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
from app.agents.multi import AgentCallingAgent
44
from app.agents.single import FunctionCallingAgent
5-
from app.examples.artifact_generator import create_artifact_generator
5+
from app.examples.publisher import create_publisher
66
from app.examples.researcher import create_researcher
77
from llama_index.core.chat_engine.types import ChatMessage
88

99

1010
def create_choreography(chat_history: Optional[List[ChatMessage]] = None):
1111
researcher = create_researcher(chat_history)
12-
artifact_generator = create_artifact_generator(chat_history)
12+
publisher = create_publisher(chat_history)
1313
reviewer = FunctionCallingAgent(
1414
name="reviewer",
1515
role="expert in reviewing blog posts",
@@ -19,12 +19,12 @@ def create_choreography(chat_history: Optional[List[ChatMessage]] = None):
1919
)
2020
return AgentCallingAgent(
2121
name="writer",
22-
agents=[researcher, reviewer, artifact_generator],
22+
agents=[researcher, reviewer, publisher],
2323
role="expert in writing blog posts",
2424
system_prompt="""You are an expert in writing blog posts. You are given a task to write a blog post. Before starting to write the post, consult the researcher agent to get the information you need. Don't make up any information yourself.
2525
After creating a draft for the post, send it to the reviewer agent to receive some feedback and make sure to incorporate the feedback from the reviewer.
2626
You can consult the reviewer and researcher maximal two times. Your output should just contain the blog post.
27-
Finally, always request the artifact generator to create an artifact (pdf, html) that user can download and use for publishing the blog post.""",
27+
Finally, always request the publisher to create an artifact (pdf, html) and publish the blog post.""",
2828
# TODO: add chat_history support to AgentCallingAgent
2929
# chat_history=chat_history,
3030
verbose=True,

templates/types/multiagent/fastapi/app/examples/orchestrator.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from app.agents.multi import AgentOrchestrator
44
from app.agents.single import FunctionCallingAgent
5-
from app.examples.artifact_generator import create_artifact_generator
5+
from app.examples.publisher import create_publisher
66
from app.examples.researcher import create_researcher
77
from llama_index.core.chat_engine.types import ChatMessage
88

@@ -22,8 +22,8 @@ def create_orchestrator(chat_history: Optional[List[ChatMessage]] = None):
2222
Especially check for logical inconsistencies and proofread the post for grammar and spelling errors.""",
2323
chat_history=chat_history,
2424
)
25-
artifact_generator = create_artifact_generator(chat_history)
25+
publisher = create_publisher(chat_history)
2626
return AgentOrchestrator(
27-
agents=[writer, reviewer, researcher, artifact_generator],
27+
agents=[writer, reviewer, researcher, publisher],
2828
refine_plan=False,
2929
)

templates/types/multiagent/fastapi/app/examples/artifact_generator.py renamed to templates/types/multiagent/fastapi/app/examples/publisher.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from llama_index.core.tools import FunctionTool
77

88

9-
def create_artifact_generator(chat_history: List[ChatMessage]):
9+
def create_publisher(chat_history: List[ChatMessage]):
1010
artifact_tool = FunctionTool.from_defaults(ArtifactGenerator.generate_artifact)
1111

1212
return FunctionCallingAgent(
13-
name="ArtifactGenerator",
13+
name="publisher",
1414
tools=[artifact_tool],
1515
role="expert in generating artifacts (pdf, html)",
1616
system_prompt="You are generator that help generate artifacts (pdf, html) from a given content. Please always respond the content again along with the generated artifact.",

templates/types/multiagent/fastapi/app/examples/workflow.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import AsyncGenerator, List, Optional
22

33
from app.agents.single import AgentRunEvent, AgentRunResult, FunctionCallingAgent
4-
from app.examples.artifact_generator import create_artifact_generator
4+
from app.examples.publisher import create_publisher
55
from app.examples.researcher import create_researcher
66
from llama_index.core.chat_engine.types import ChatMessage
77
from llama_index.core.workflow import (
@@ -18,7 +18,7 @@ def create_workflow(chat_history: Optional[List[ChatMessage]] = None):
1818
researcher = create_researcher(
1919
chat_history=chat_history,
2020
)
21-
artifact_generator = create_artifact_generator(
21+
publisher = create_publisher(
2222
chat_history=chat_history,
2323
)
2424
writer = FunctionCallingAgent(
@@ -38,7 +38,7 @@ def create_workflow(chat_history: Optional[List[ChatMessage]] = None):
3838
researcher=researcher,
3939
writer=writer,
4040
reviewer=reviewer,
41-
artifact_generator=artifact_generator,
41+
publisher=publisher,
4242
)
4343
return workflow
4444

@@ -55,7 +55,7 @@ class ReviewEvent(Event):
5555
input: str
5656

5757

58-
class GenerateArtifactEvent(Event):
58+
class PublishEvent(Event):
5959
input: str
6060

6161

@@ -106,7 +106,7 @@ async def write(
106106
@step()
107107
async def review(
108108
self, ctx: Context, ev: ReviewEvent, reviewer: FunctionCallingAgent
109-
) -> WriteEvent | GenerateArtifactEvent:
109+
) -> WriteEvent | PublishEvent:
110110
result: AgentRunResult = await self.run_agent(ctx, reviewer, ev.input)
111111
review = result.response.message.content
112112
old_content = ctx.data["result"].response.message.content
@@ -119,8 +119,8 @@ async def review(
119119
)
120120
if post_is_good:
121121
user_input = ctx.data["user_input"]
122-
return GenerateArtifactEvent(
123-
input=f"Please generate an artifact for this content: ```{old_content}```. The user input is: ```{user_input}```",
122+
return PublishEvent(
123+
input=f"Please publish this content: ```{old_content}```. The user request was: ```{user_input}```",
124124
)
125125
else:
126126
return WriteEvent(
@@ -137,13 +137,13 @@ async def review(
137137
)
138138

139139
@step()
140-
async def generate_artifact(
140+
async def publish(
141141
self,
142142
ctx: Context,
143-
ev: GenerateArtifactEvent,
144-
artifact_generator: FunctionCallingAgent,
143+
ev: PublishEvent,
144+
publisher: FunctionCallingAgent,
145145
) -> StopEvent:
146-
result: AgentRunResult = await self.run_agent(ctx, artifact_generator, ev.input)
146+
result: AgentRunResult = await self.run_agent(ctx, publisher, ev.input)
147147
return StopEvent(result=result)
148148

149149
async def run_agent(

templates/types/streaming/nextjs/app/components/ui/chat/chat-message/chat-agent-events.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const AgentIcons: Record<string, LucideIcon> = {
1717
researcher: icons.ScanSearch,
1818
writer: icons.PenLine,
1919
reviewer: icons.MessageCircle,
20+
publisher: icons.BookCheck,
2021
};
2122

2223
type MergedEvent = {

0 commit comments

Comments
 (0)