Skip to content

Commit

Permalink
feat: simplification
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Dvorak <[email protected]>
  • Loading branch information
Tomas2D committed Jan 8, 2025
1 parent 7bd09f1 commit 02b2d51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
10 changes: 3 additions & 7 deletions examples/flows/multiAgents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ workflow.addAgent({
instructions: "You are a weather assistant. Respond only if you can provide a useful answer.",
tools: [new OpenMeteoTool()],
llm: BAMChatLLM.fromPreset("meta-llama/llama-3-1-70b-instruct"),
execution: { maxIterations: 3 },
});
workflow.addAgent({
name: "Researcher",
Expand All @@ -40,7 +41,6 @@ workflow.addAgent({
name: "Solver",
instructions:
"Your task is to provide the most useful final answer based on the assistants' responses which all are relevant. Ignore those where assistant do not know.",
tools: [],
llm: BAMChatLLM.fromPreset("meta-llama/llama-3-1-70b-instruct"),
});

Expand All @@ -56,12 +56,8 @@ for await (const { prompt } of reader) {
);

const { result } = await workflow.run(memory.messages).observe((emitter) => {
//emitter.on("success", (data) => {
// reader.write(`-> ${data.step}`, data.response?.update?.finalAnswer ?? "-");
//});
emitter.match("*.*", (_, event) => {
console.info(event.path);
// TODO
emitter.on("success", (data) => {
reader.write(`-> ${data.step}`, data.response?.update?.finalAnswer ?? "-");
});
});
await memory.addMany(result.newMessages);
Expand Down
5 changes: 1 addition & 4 deletions src/experimental/workflows/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ export class AgentWorkflow {
newMessages: state.newMessages.concat(
BaseMessage.of({
...result,
text: [
`Assistant Name: ${agent.meta.name}`,
`Assistant Response: ${result.text}`,
].join("\n"),
text: [`Assistant Name: ${name}`, `Assistant Response: ${result.text}`].join("\n"),
}),
),
},
Expand Down

0 comments on commit 02b2d51

Please sign in to comment.