Skip to content

Commit 25dde8f

Browse files
HenryHengZJpatrickalvesexperian
authored andcommitted
Bugfix/Tool Agent output message (FlowiseAI#2990)
* add fix for tool agent output message * pin langchain core dependency
1 parent c748bba commit 25dde8f

File tree

5 files changed

+7509
-5724
lines changed

5 files changed

+7509
-5724
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"@qdrant/openapi-typescript-fetch": "1.2.6",
6767
"@google/generative-ai": "^0.15.0",
6868
"openai": "4.51.0",
69-
"@langchain/aws": "0.0.6"
69+
"@langchain/core": "0.2.18"
7070
},
7171
"eslintIgnore": [
7272
"**/dist",

packages/components/nodes/agents/ToolAgent/ToolAgent.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ class ToolAgent_Agents implements INode {
135135
}
136136
}
137137

138-
let output = res?.output as string
138+
let output = res?.output
139+
if (Array.isArray(output)) {
140+
output = output[0]?.text || ''
141+
} else if (typeof output === 'object') {
142+
output = output?.text || ''
143+
}
139144

140145
// Claude 3 Opus tends to spit out <thinking>..</thinking> as well, discard that in final output
141146
const regexPattern: RegExp = /<thinking>[\s\S]*?<\/thinking>/

packages/components/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"@google-ai/generativelanguage": "^2.5.0",
3535
"@google/generative-ai": "^0.15.0",
3636
"@huggingface/inference": "^2.6.1",
37-
"@langchain/aws": "^0.0.6",
3837
"@langchain/anthropic": "^0.2.1",
38+
"@langchain/aws": "^0.0.9",
3939
"@langchain/cohere": "^0.0.7",
4040
"@langchain/community": "^0.2.17",
4141
"@langchain/core": "0.2.18",

packages/server/src/utils/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1235,10 +1235,10 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
12351235
]
12361236
isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name)
12371237

1238-
// Anthropic & Groq Function Calling streaming is still not supported - https://docs.anthropic.com/claude/docs/tool-use
1238+
// Anthropic streaming has some bug where the log is being sent, temporarily disabled
12391239
const model = endingNodeData.inputs?.model
12401240
if (endingNodeData.name.includes('toolAgent')) {
1241-
if (typeof model === 'string' && (model.includes('chatAnthropic') || model.includes('groqChat'))) {
1241+
if (typeof model === 'string' && model.includes('chatAnthropic')) {
12421242
return false
12431243
} else if (typeof model === 'object' && 'id' in model && model['id'].includes('chatAnthropic')) {
12441244
return false

0 commit comments

Comments
 (0)