diff --git a/src/agents/bee/agent.ts b/src/agents/bee/agent.ts index e635d664..cfcc2003 100644 --- a/src/agents/bee/agent.ts +++ b/src/agents/bee/agent.ts @@ -33,10 +33,10 @@ import { BeeRunOutput, } from "@/agents/bee/types.js"; import { GetRunContext } from "@/context.js"; -import { BeeAgentRunner } from "@/agents/bee/runner.js"; import { BeeAgentError } from "@/agents/bee/errors.js"; import { BeeIterationToolResult } from "@/agents/bee/parser.js"; import { assign } from "@/internals/helpers/object.js"; +import { BeeAgentRunner } from "@/agents/bee/runner.js"; export interface BeeInput { llm: ChatLLM; @@ -52,6 +52,8 @@ export class BeeAgent extends BaseAgent["parser"]; +type Parser = ReturnType["createParser"]>["parser"]; export type BeeIterationResult = LinePrefixParser.inferOutput; export type BeeIterationResultPartial = LinePrefixParser.inferPartialOutput; export type BeeIterationToolResult = NonUndefined; diff --git a/src/agents/bee/runner.ts b/src/agents/bee/runner.ts index 60b0f58a..c55b28e9 100644 --- a/src/agents/bee/runner.ts +++ b/src/agents/bee/runner.ts @@ -161,10 +161,10 @@ export class BeeAgentRunner { ); } - return new BeeAgentRunner(input, options, memory); + return new this(input, options, memory); } - static createParser(tools: AnyTool[]) { + protected createParser(tools: AnyTool[]) { const parserRegex = /Thought:.+\n(?:Final Answer:[\S\s]+|Function Name:.+\nFunction Input: \{.*\}\nFunction Caption:.+\nFunction Output:)?/; @@ -251,7 +251,7 @@ export class BeeAgentRunner { executor: async () => { await emitter.emit("start", { meta }); - const { parser, parserRegex } = BeeAgentRunner.createParser(this.input.tools); + const { parser, parserRegex } = this.createParser(this.input.tools); const llmOutput = await this.input.llm .generate(this.memory.messages.slice(), { signal,