Skip to content

Commit

Permalink
set type as required in AgentRunEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
leehuwuj committed Nov 13, 2024
1 parent ba1462a commit 68b53cc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Decision (respond with either 'not_publish' or 'publish'):`;
new AgentRunEvent({
agent: "writer",
text: `Too many attempts (${MAX_ATTEMPTS}) to write the blog post. Proceeding with the current version.`,
type: "text",
}),
);
}
Expand Down Expand Up @@ -184,6 +185,7 @@ Decision (respond with either 'not_publish' or 'publish'):`;
text: `The post is ${postIsGood ? "" : "not "}good enough for publishing. Sending back to the writer${
postIsGood ? " for publication." : "."
}`,
type: "text",
}),
);
if (postIsGood) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export class FinancialReportWorkflow extends Workflow<
new AgentRunEvent({
agent: "Analyst",
text: `Starting analysis`,
type: "text",
}),
);
// Request by workflow LLM, input is a list of tool calls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ export class FunctionCallingAgent extends Workflow<
ctx: HandlerContext<FunctionCallingAgentContextData>,
) => {
if (!this.writeEvents) return;
ctx.sendEvent(new AgentRunEvent({ agent: this.name, text: msg }));
ctx.sendEvent(
new AgentRunEvent({ agent: this.name, text: msg, type: "text" }),
);
};
}
14 changes: 1 addition & 13 deletions templates/components/multiagent/typescript/workflow/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,4 @@ export class AgentRunEvent extends WorkflowEvent<{
text: string;
type: AgentRunEventType;
data?: AgentRunEventData;
}> {
constructor(options: {
agent: string;
text: string;
type?: AgentRunEventType;
data?: AgentRunEventData;
}) {
super({
...options,
type: options.type || "text",
});
}
}
}> {}

0 comments on commit 68b53cc

Please sign in to comment.