Skip to content

Commit

Permalink
Introduce agent.observer package.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrammel committed Apr 19, 2023
1 parent 7a06d92 commit 9f047f9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/javascript-developer/src/runDeveloperAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function runDeveloperAgent({
}),
],
}),
observer: $.agent.showRunInConsole({
observer: $.agent.observer.showRunInConsole({
name: "JavaScript Developer Agent",
}),
});
Expand Down
4 changes: 1 addition & 3 deletions examples/wikipedia/src/runWikipediaAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ export async function runWikipediaAgent({
}),
}),
controller: $.agent.controller.maxSteps(20),
observer: $.agent.showRunInConsole({
name: "Wikipedia Agent",
}),
observer: $.agent.observer.showRunInConsole({ name: "Wikipedia Agent" }),
});
}
2 changes: 1 addition & 1 deletion packages/agent/src/agent/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Step } from "../step/Step";
import { StepResult } from "../step/StepResult";
import { createNextId } from "../util/createNextId";
import { GenerateCall } from "./GenerateCall";
import { RunObserver } from "./RunObserver";
import { RunObserver } from "./observer/RunObserver";

export class Run {
private readonly observer?: RunObserver;
Expand Down
5 changes: 3 additions & 2 deletions packages/agent/src/agent/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from "./GenerateCall";
export * from "./Run";
export * from "./RunObserver";
export * from "./RunContext";
export * as controller from "./controller/index";
export * as observer from "./observer/index";
export * from "./runAgent";
export * from "./showRunInConsole";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StepResult } from "../step";
import { Loop } from "../step/Loop";
import { Step } from "../step/Step";
import { Run } from "./Run";
import { StepResult } from "../../step";
import { Loop } from "../../step/Loop";
import { Step } from "../../step/Step";
import { Run } from "../Run";

export type RunObserver = {
onRunStarted?: ({}: { run: Run }) => void;
Expand Down
2 changes: 2 additions & 0 deletions packages/agent/src/agent/observer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./RunObserver";
export * from "./showRunInConsole";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import chalk from "chalk";
import { Step, StepResult } from "../step";
import { ToolStep } from "../tool/ToolStep";
import { Run } from "./Run";
import { Step, StepResult } from "../../step";
import { ToolStep } from "../../tool/ToolStep";
import { Run } from "../Run";
import { RunObserver } from "./RunObserver";

const log = console.log;
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/agent/runAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StepFactory } from "../step/StepFactory";
import { maxSteps } from "./controller/maxSteps";
import { Run } from "./Run";
import { RunController } from "./controller/RunController";
import { RunObserver } from "./RunObserver";
import { RunObserver } from "./observer/RunObserver";

export const runAgent = async ({
agent,
Expand Down

0 comments on commit 9f047f9

Please sign in to comment.