Skip to content

Bugfix/Tool Agent output message #2990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@qdrant/openapi-typescript-fetch": "1.2.6",
"@google/generative-ai": "^0.15.0",
"openai": "4.51.0",
"@langchain/aws": "0.0.6"
"@langchain/core": "0.2.18"
},
"eslintIgnore": [
"**/dist",
Expand Down
7 changes: 6 additions & 1 deletion packages/components/nodes/agents/ToolAgent/ToolAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ class ToolAgent_Agents implements INode {
}
}

let output = res?.output as string
let output = res?.output
if (Array.isArray(output)) {
output = output[0]?.text || ''
} else if (typeof output === 'object') {
output = output?.text || ''
}

// Claude 3 Opus tends to spit out <thinking>..</thinking> as well, discard that in final output
const regexPattern: RegExp = /<thinking>[\s\S]*?<\/thinking>/
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"@google-ai/generativelanguage": "^2.5.0",
"@google/generative-ai": "^0.15.0",
"@huggingface/inference": "^2.6.1",
"@langchain/aws": "^0.0.6",
"@langchain/anthropic": "^0.2.1",
"@langchain/aws": "^0.0.9",
"@langchain/cohere": "^0.0.7",
"@langchain/community": "^0.2.17",
"@langchain/core": "0.2.18",
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1235,10 +1235,10 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
]
isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name)

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