Skip to content

Commit

Permalink
feat(agents): base updates
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Dvorak <[email protected]>
  • Loading branch information
Tomas2D committed Dec 9, 2024
1 parent 16d4bfd commit 8b740d4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
15 changes: 13 additions & 2 deletions src/agents/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import { AgentMeta } from "@/agents/types.js";
import { Serializable } from "@/internals/serializable.js";
import { GetRunContext, RunContext } from "@/context.js";
import { Emitter } from "@/emitter/emitter.js";
import { BaseMemory } from "@/memory/base.js";
import { createTelemetryMiddleware } from "@/instrumentation/create-telemetry-middleware.js";
import { INSTRUMENTATION_ENABLED } from "@/instrumentation/config.js";
import { doNothing } from "remeda";
import { BaseMemory } from "@/memory/base.js";

export class AgentError extends FrameworkError {}

Expand Down Expand Up @@ -79,9 +79,20 @@ export abstract class BaseAgent<
}

public abstract get memory(): BaseMemory;
public abstract get meta(): AgentMeta;

public get meta(): AgentMeta {
return {
name: this.constructor.name ?? "BaseAgent",
description: "",
tools: [],
};
}

createSnapshot() {
return { isRunning: false };
}

loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {
Object.assign(this, snapshot);
}
}
4 changes: 0 additions & 4 deletions src/agents/bee/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,4 @@ export class BeeAgent extends BaseAgent<BeeRunInput, BeeRunOutput, BeeRunOptions
runner: this.runner,
};
}

loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {
Object.assign(this, snapshot);
}
}
4 changes: 0 additions & 4 deletions src/agents/experimental/streamlit/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,4 @@ export class StreamlitAgent extends BaseAgent<StreamlitRunInput, StreamlitRunOut
input: this.input,
};
}

loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {
Object.assign(this, snapshot);
}
}
2 changes: 2 additions & 0 deletions src/llms/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ export abstract class ChatLLM<
> extends BaseLLM<BaseMessage[], TOutput, TGenerateOptions> {
public abstract readonly emitter: Emitter<ChatLLMGenerateEvents<TOutput>>;
}

export type AnyChatLLM = ChatLLM<ChatLLMOutput>;

0 comments on commit 8b740d4

Please sign in to comment.