mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 09:01:09 +03:00
Bugfix/Anthropic messages in agentflow (#3801)
fix anthropic messages in agentflow
This commit is contained in:
@@ -7,7 +7,7 @@ import { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
||||
import { ChatPromptTemplate, MessagesPlaceholder, HumanMessagePromptTemplate, PromptTemplate } from '@langchain/core/prompts'
|
||||
import { formatToOpenAIToolMessages } from 'langchain/agents/format_scratchpad/openai_tools'
|
||||
import { type ToolsAgentStep } from 'langchain/agents/openai/output_parser'
|
||||
import { getBaseClasses, handleEscapeCharacters, removeInvalidImageMarkdown } from '../../../src/utils'
|
||||
import { extractOutputFromArray, getBaseClasses, handleEscapeCharacters, removeInvalidImageMarkdown } from '../../../src/utils'
|
||||
import {
|
||||
FlowiseMemory,
|
||||
ICommonObject,
|
||||
@@ -181,12 +181,7 @@ class ToolAgent_Agents implements INode {
|
||||
}
|
||||
|
||||
let output = res?.output
|
||||
if (Array.isArray(output)) {
|
||||
output = output[0]?.text || ''
|
||||
} else if (typeof output === 'object') {
|
||||
output = output?.text || ''
|
||||
}
|
||||
|
||||
output = extractOutputFromArray(res?.output)
|
||||
output = removeInvalidImageMarkdown(output)
|
||||
|
||||
// Claude 3 Opus tends to spit out <thinking>..</thinking> as well, discard that in final output
|
||||
|
||||
Reference in New Issue
Block a user