diff --git a/src/agents/bee/runners/default/runner.ts b/src/agents/bee/runners/default/runner.ts index b780c92a..64fb9bd1 100644 --- a/src/agents/bee/runners/default/runner.ts +++ b/src/agents/bee/runners/default/runner.ts @@ -363,7 +363,7 @@ export class DefaultRunner extends BaseRunner { const parserRegex = isEmpty(tools) ? new RegExp(`Thought: .+\\nFinal Answer: [\\s\\S]+`) : new RegExp( - `Thought: (?!.*Function Name:).+\\n(?:Final Answer: [\\s\\S]+|Function Name: (?:${tools.map((tool) => tool.name).join("|")})\\nFunction Input: \\{.*\\}\\nFunction Output:)`, + `Thought: .+\\n(?:Final Answer: [\\s\\S]+|Function Name: (${tools.map((tool) => tool.name).join("|")})\\nFunction Input: \\{.*\\}\\nFunction Output:)`, ); const parser = new LinePrefixParser( diff --git a/src/agents/bee/runners/granite/runner.ts b/src/agents/bee/runners/granite/runner.ts index 9829ceea..52df06ff 100644 --- a/src/agents/bee/runners/granite/runner.ts +++ b/src/agents/bee/runners/granite/runner.ts @@ -90,7 +90,7 @@ export class GraniteRunner extends DefaultRunner { parserRegex: isEmpty(tools) ? new RegExp(`Thought: .+\\nFinal Answer: [\\s\\S]+`) : new RegExp( - `Thought: (?!.*Tool Name:).+\\n(?:Final Answer: [\\s\\S]+|Tool Name: (?:${tools.map((tool) => tool.name).join("|")})\\nTool Input: \\{.*\\})`, + `Thought: .+\\n(?:Final Answer: [\\s\\S]+|Tool Name: (${tools.map((tool) => tool.name).join("|")})\\nTool Input: \\{.*\\})`, ), parser: parser.fork((nodes, options) => ({ options,