Fix merge conflicts

This commit is contained in:
Ilango 2024-01-16 11:19:01 +05:30
commit 0790c8ecb4
1 changed files with 10 additions and 1 deletions

View File

@ -606,9 +606,18 @@ class ExceptionTool extends Tool {
export const formatAgentSteps = (steps: AgentStep[]): BaseMessage[] => export const formatAgentSteps = (steps: AgentStep[]): BaseMessage[] =>
steps.flatMap(({ action, observation }) => { steps.flatMap(({ action, observation }) => {
const create_function_message = (observation: string, action: AgentAction) => {
let content: string
if (typeof observation !== 'string') {
content = JSON.stringify(observation)
} else {
content = observation
}
return new FunctionMessage(content, action.tool)
}
if ('messageLog' in action && action.messageLog !== undefined) { if ('messageLog' in action && action.messageLog !== undefined) {
const log = action.messageLog as BaseMessage[] const log = action.messageLog as BaseMessage[]
return log.concat(new FunctionMessage(observation, action.tool)) return log.concat(create_function_message(observation, action))
} else { } else {
return [new AIMessage(action.log)] return [new AIMessage(action.log)]
} }