Bugfix/Tool Agent output message (#2990)

* add fix for tool agent output message

* pin langchain core dependency
This commit is contained in:
Henry Heng 2024-08-10 13:56:08 +01:00 committed by GitHub
parent 376e644cec
commit d4b41689da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7536 additions and 5751 deletions

View File

@ -66,7 +66,7 @@
"@qdrant/openapi-typescript-fetch": "1.2.6", "@qdrant/openapi-typescript-fetch": "1.2.6",
"@google/generative-ai": "^0.15.0", "@google/generative-ai": "^0.15.0",
"openai": "4.51.0", "openai": "4.51.0",
"@langchain/aws": "0.0.6" "@langchain/core": "0.2.18"
}, },
"eslintIgnore": [ "eslintIgnore": [
"**/dist", "**/dist",

View File

@ -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 // Claude 3 Opus tends to spit out <thinking>..</thinking> as well, discard that in final output
const regexPattern: RegExp = /<thinking>[\s\S]*?<\/thinking>/ const regexPattern: RegExp = /<thinking>[\s\S]*?<\/thinking>/

View File

@ -34,8 +34,8 @@
"@google-ai/generativelanguage": "^2.5.0", "@google-ai/generativelanguage": "^2.5.0",
"@google/generative-ai": "^0.15.0", "@google/generative-ai": "^0.15.0",
"@huggingface/inference": "^2.6.1", "@huggingface/inference": "^2.6.1",
"@langchain/aws": "^0.0.6",
"@langchain/anthropic": "^0.2.1", "@langchain/anthropic": "^0.2.1",
"@langchain/aws": "^0.0.9",
"@langchain/cohere": "^0.0.7", "@langchain/cohere": "^0.0.7",
"@langchain/community": "^0.2.17", "@langchain/community": "^0.2.17",
"@langchain/core": "0.2.18", "@langchain/core": "0.2.18",

View File

@ -1235,10 +1235,10 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod
] ]
isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name) 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 const model = endingNodeData.inputs?.model
if (endingNodeData.name.includes('toolAgent')) { if (endingNodeData.name.includes('toolAgent')) {
if (typeof model === 'string' && (model.includes('chatAnthropic') || model.includes('groqChat'))) { if (typeof model === 'string' && model.includes('chatAnthropic')) {
return false return false
} else if (typeof model === 'object' && 'id' in model && model['id'].includes('chatAnthropic')) { } else if (typeof model === 'object' && 'id' in model && model['id'].includes('chatAnthropic')) {
return false return false

File diff suppressed because one or more lines are too long