mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Feature/Add teams, gmail, outlook tools (#4577)
* add teams, gmail, outlook tools * update docs link * update credentials for oauth2 * add jira tool * add google drive, google calendar, google sheets tools, powerpoint, excel, word doc loader * update jira logo * Refactor Gmail and Outlook tools to remove maxOutputLength parameter and enhance request handling. Update response formatting to include parameters in the output. Adjust Google Drive tools to simplify success messages by removing unnecessary parameter details.
This commit is contained in:
@@ -22,7 +22,13 @@ import {
|
||||
IStateWithMessages,
|
||||
ConversationHistorySelection
|
||||
} from '../../../src/Interface'
|
||||
import { ToolCallingAgentOutputParser, AgentExecutor, SOURCE_DOCUMENTS_PREFIX, ARTIFACTS_PREFIX } from '../../../src/agents'
|
||||
import {
|
||||
ToolCallingAgentOutputParser,
|
||||
AgentExecutor,
|
||||
SOURCE_DOCUMENTS_PREFIX,
|
||||
ARTIFACTS_PREFIX,
|
||||
TOOL_ARGS_PREFIX
|
||||
} from '../../../src/agents'
|
||||
import {
|
||||
extractOutputFromArray,
|
||||
getInputVariables,
|
||||
@@ -1041,6 +1047,17 @@ class ToolNode<T extends BaseMessage[] | MessagesState> extends RunnableCallable
|
||||
}
|
||||
}
|
||||
|
||||
let toolInput
|
||||
if (typeof output === 'string' && output.includes(TOOL_ARGS_PREFIX)) {
|
||||
const outputArray = output.split(TOOL_ARGS_PREFIX)
|
||||
output = outputArray[0]
|
||||
try {
|
||||
toolInput = JSON.parse(outputArray[1])
|
||||
} catch (e) {
|
||||
console.error('Error parsing tool input from tool')
|
||||
}
|
||||
}
|
||||
|
||||
return new ToolMessage({
|
||||
name: tool.name,
|
||||
content: typeof output === 'string' ? output : JSON.stringify(output),
|
||||
@@ -1048,11 +1065,11 @@ class ToolNode<T extends BaseMessage[] | MessagesState> extends RunnableCallable
|
||||
additional_kwargs: {
|
||||
sourceDocuments,
|
||||
artifacts,
|
||||
args: call.args,
|
||||
args: toolInput ?? call.args,
|
||||
usedTools: [
|
||||
{
|
||||
tool: tool.name ?? '',
|
||||
toolInput: call.args,
|
||||
toolInput: toolInput ?? call.args,
|
||||
toolOutput: output
|
||||
}
|
||||
]
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import { AIMessage, AIMessageChunk, BaseMessage, ToolMessage } from '@langchain/core/messages'
|
||||
import { StructuredTool } from '@langchain/core/tools'
|
||||
import { RunnableConfig } from '@langchain/core/runnables'
|
||||
import { ARTIFACTS_PREFIX, SOURCE_DOCUMENTS_PREFIX } from '../../../src/agents'
|
||||
import { ARTIFACTS_PREFIX, SOURCE_DOCUMENTS_PREFIX, TOOL_ARGS_PREFIX } from '../../../src/agents'
|
||||
import { Document } from '@langchain/core/documents'
|
||||
import { DataSource } from 'typeorm'
|
||||
import { MessagesState, RunnableCallable, customGet, getVM } from '../commonUtils'
|
||||
@@ -448,6 +448,17 @@ class ToolNode<T extends IStateWithMessages | BaseMessage[] | MessagesState> ext
|
||||
}
|
||||
}
|
||||
|
||||
let toolInput
|
||||
if (typeof output === 'string' && output.includes(TOOL_ARGS_PREFIX)) {
|
||||
const outputArray = output.split(TOOL_ARGS_PREFIX)
|
||||
output = outputArray[0]
|
||||
try {
|
||||
toolInput = JSON.parse(outputArray[1])
|
||||
} catch (e) {
|
||||
console.error('Error parsing tool input from tool')
|
||||
}
|
||||
}
|
||||
|
||||
return new ToolMessage({
|
||||
name: tool.name,
|
||||
content: typeof output === 'string' ? output : JSON.stringify(output),
|
||||
@@ -455,11 +466,11 @@ class ToolNode<T extends IStateWithMessages | BaseMessage[] | MessagesState> ext
|
||||
additional_kwargs: {
|
||||
sourceDocuments,
|
||||
artifacts,
|
||||
args: call.args,
|
||||
args: toolInput ?? call.args,
|
||||
usedTools: [
|
||||
{
|
||||
tool: tool.name ?? '',
|
||||
toolInput: call.args,
|
||||
toolInput: toolInput ?? call.args,
|
||||
toolOutput: output
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user