diff --git a/package.json b/package.json index 33471e385..a436da9ef 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "node": ">=18.15.0 <19.0.0 || ^20" }, "resolutions": { - "@qdrant/openapi-typescript-fetch": "1.2.1" + "@qdrant/openapi-typescript-fetch": "1.2.1", + "@google/generative-ai": "^0.7.0" } } diff --git a/packages/components/models.json b/packages/components/models.json index 8cdba45c0..edb6db82a 100644 --- a/packages/components/models.json +++ b/packages/components/models.json @@ -308,6 +308,10 @@ { "label": "gemini-pro", "name": "gemini-pro" + }, + { + "label": "gemini-pro-vision", + "name": "gemini-pro-vision" } ] }, @@ -323,6 +327,18 @@ { "name": "chatGoogleVertexAI", "models": [ + { + "label": "gemini-1.5-pro", + "name": "gemini-1.5-pro" + }, + { + "label": "gemini-1.0-pro", + "name": "gemini-1.0-pro" + }, + { + "label": "gemini-1.0-pro-vision", + "name": "gemini-1.0-pro-vision" + }, { "label": "chat-bison", "name": "chat-bison" diff --git a/packages/components/nodes/agents/MistralAIToolAgent/MistralAIToolAgent.ts b/packages/components/nodes/agents/MistralAIToolAgent/MistralAIToolAgent.ts index d1590dbb8..94f9200f0 100644 --- a/packages/components/nodes/agents/MistralAIToolAgent/MistralAIToolAgent.ts +++ b/packages/components/nodes/agents/MistralAIToolAgent/MistralAIToolAgent.ts @@ -34,7 +34,7 @@ class MistralAIToolAgent_Agents implements INode { this.type = 'AgentExecutor' this.category = 'Agents' this.icon = 'MistralAI.svg' - this.badge = 'NEW' + this.badge = 'DEPRECATING' this.description = `Agent that uses MistralAI Function Calling to pick the tools and args to call` this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] this.inputs = [ diff --git a/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts b/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts index 62ecec5b0..ffca4d1eb 100644 --- a/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts +++ b/packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts @@ -2,7 +2,7 @@ import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeOptionsValue, IN import OpenAI from 'openai' import { DataSource } from 'typeorm' import { getCredentialData, getCredentialParam, getUserHome } from '../../../src/utils' -import { MessageContentImageFile, MessageContentText } from 'openai/resources/beta/threads/messages/messages' +import { ImageFileContentBlock, TextContentBlock } from 'openai/resources/beta/threads/messages/messages' import * as fsDefault from 'node:fs' import * as path from 'node:path' import fetch from 'node-fetch' @@ -392,7 +392,7 @@ class OpenAIAssistant_Agents implements INode { const fileAnnotations = [] for (let i = 0; i < assistantMessages[0].content.length; i += 1) { if (assistantMessages[0].content[i].type === 'text') { - const content = assistantMessages[0].content[i] as MessageContentText + const content = assistantMessages[0].content[i] as TextContentBlock if (content.text.annotations) { const message_content = content.text @@ -406,8 +406,7 @@ class OpenAIAssistant_Agents implements INode { let filePath = '' // Gather citations based on annotation attributes - const file_citation = (annotation as OpenAI.Beta.Threads.Messages.MessageContentText.Text.FileCitation) - .file_citation + const file_citation = (annotation as OpenAI.Beta.Threads.Messages.FileCitationAnnotation).file_citation if (file_citation) { const cited_file = await openai.files.retrieve(file_citation.file_id) // eslint-disable-next-line no-useless-escape @@ -421,7 +420,7 @@ class OpenAIAssistant_Agents implements INode { }) } } else { - const file_path = (annotation as OpenAI.Beta.Threads.Messages.MessageContentText.Text.FilePath).file_path + const file_path = (annotation as OpenAI.Beta.Threads.Messages.FilePathAnnotation).file_path if (file_path) { const cited_file = await openai.files.retrieve(file_path.file_id) // eslint-disable-next-line no-useless-escape @@ -452,7 +451,7 @@ class OpenAIAssistant_Agents implements INode { const lenticularBracketRegex = /【[^】]*】/g returnVal = returnVal.replace(lenticularBracketRegex, '') } else { - const content = assistantMessages[0].content[i] as MessageContentImageFile + const content = assistantMessages[0].content[i] as ImageFileContentBlock const fileId = content.image_file.file_id const fileObj = await openai.files.retrieve(fileId) const dirPath = path.join(getUserHome(), '.flowise', 'openai-assistant') @@ -533,7 +532,7 @@ const downloadFile = async (fileObj: any, filePath: string, dirPath: string, ope } } -const formatToOpenAIAssistantTool = (tool: any): OpenAI.Beta.AssistantCreateParams.AssistantToolsFunction => { +const formatToOpenAIAssistantTool = (tool: any): OpenAI.Beta.FunctionTool => { return { type: 'function', function: { diff --git a/packages/components/nodes/agents/OpenAIToolAgent/OpenAIToolAgent.ts b/packages/components/nodes/agents/OpenAIToolAgent/OpenAIToolAgent.ts index f74645470..97506fde0 100644 --- a/packages/components/nodes/agents/OpenAIToolAgent/OpenAIToolAgent.ts +++ b/packages/components/nodes/agents/OpenAIToolAgent/OpenAIToolAgent.ts @@ -36,7 +36,7 @@ class OpenAIToolAgent_Agents implements INode { this.icon = 'function.svg' this.description = `Agent that uses OpenAI Function Calling to pick the tools and args to call` this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] - this.badge = 'NEW' + this.badge = 'DEPRECATING' this.inputs = [ { label: 'Tools', diff --git a/packages/components/nodes/agents/MRKLAgentChat/MRKLAgentChat.ts b/packages/components/nodes/agents/ReActAgentChat/ReActAgentChat.ts similarity index 97% rename from packages/components/nodes/agents/MRKLAgentChat/MRKLAgentChat.ts rename to packages/components/nodes/agents/ReActAgentChat/ReActAgentChat.ts index 94811a728..be91b380a 100644 --- a/packages/components/nodes/agents/MRKLAgentChat/MRKLAgentChat.ts +++ b/packages/components/nodes/agents/ReActAgentChat/ReActAgentChat.ts @@ -13,7 +13,7 @@ import { addImagesToMessages, llmSupportsVision } from '../../../src/multiModalU import { checkInputs, Moderation } from '../../moderation/Moderation' import { formatResponse } from '../../outputparsers/OutputParserHelpers' -class MRKLAgentChat_Agents implements INode { +class ReActAgentChat_Agents implements INode { label: string name: string version: number @@ -27,7 +27,7 @@ class MRKLAgentChat_Agents implements INode { constructor(fields?: { sessionId?: string }) { this.label = 'ReAct Agent for Chat Models' - this.name = 'mrklAgentChat' + this.name = 'reactAgentChat' this.version = 4.0 this.type = 'AgentExecutor' this.category = 'Agents' @@ -157,4 +157,4 @@ class MRKLAgentChat_Agents implements INode { } } -module.exports = { nodeClass: MRKLAgentChat_Agents } +module.exports = { nodeClass: ReActAgentChat_Agents } diff --git a/packages/components/nodes/agents/MRKLAgentChat/agent.svg b/packages/components/nodes/agents/ReActAgentChat/agent.svg similarity index 100% rename from packages/components/nodes/agents/MRKLAgentChat/agent.svg rename to packages/components/nodes/agents/ReActAgentChat/agent.svg diff --git a/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts b/packages/components/nodes/agents/ReActAgentLLM/ReActAgentLLM.ts similarity index 96% rename from packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts rename to packages/components/nodes/agents/ReActAgentLLM/ReActAgentLLM.ts index a1fb36e9e..7547c807d 100644 --- a/packages/components/nodes/agents/MRKLAgentLLM/MRKLAgentLLM.ts +++ b/packages/components/nodes/agents/ReActAgentLLM/ReActAgentLLM.ts @@ -11,7 +11,7 @@ import { createReactAgent } from '../../../src/agents' import { checkInputs, Moderation } from '../../moderation/Moderation' import { formatResponse } from '../../outputparsers/OutputParserHelpers' -class MRKLAgentLLM_Agents implements INode { +class ReActAgentLLM_Agents implements INode { label: string name: string version: number @@ -24,7 +24,7 @@ class MRKLAgentLLM_Agents implements INode { constructor() { this.label = 'ReAct Agent for LLMs' - this.name = 'mrklAgentLLM' + this.name = 'reactAgentLLM' this.version = 2.0 this.type = 'AgentExecutor' this.category = 'Agents' @@ -107,4 +107,4 @@ class MRKLAgentLLM_Agents implements INode { } } -module.exports = { nodeClass: MRKLAgentLLM_Agents } +module.exports = { nodeClass: ReActAgentLLM_Agents } diff --git a/packages/components/nodes/agents/MRKLAgentLLM/agent.svg b/packages/components/nodes/agents/ReActAgentLLM/agent.svg similarity index 100% rename from packages/components/nodes/agents/MRKLAgentLLM/agent.svg rename to packages/components/nodes/agents/ReActAgentLLM/agent.svg diff --git a/packages/components/nodes/agents/ToolAgent/ToolAgent.ts b/packages/components/nodes/agents/ToolAgent/ToolAgent.ts new file mode 100644 index 000000000..1c5605a97 --- /dev/null +++ b/packages/components/nodes/agents/ToolAgent/ToolAgent.ts @@ -0,0 +1,260 @@ +import { flatten } from 'lodash' +import { BaseMessage } from '@langchain/core/messages' +import { ChainValues } from '@langchain/core/utils/types' +import { RunnableSequence } from '@langchain/core/runnables' +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 } from '../../../src/utils' +import { FlowiseMemory, ICommonObject, INode, INodeData, INodeParams, IUsedTool, IVisionChatModal } from '../../../src/Interface' +import { ConsoleCallbackHandler, CustomChainHandler, additionalCallbacks } from '../../../src/handler' +import { AgentExecutor, ToolCallingAgentOutputParser } from '../../../src/agents' +import { Moderation, checkInputs, streamResponse } from '../../moderation/Moderation' +import { formatResponse } from '../../outputparsers/OutputParserHelpers' +import { addImagesToMessages, llmSupportsVision } from '../../../src/multiModalUtils' + +class ToolAgent_Agents implements INode { + label: string + name: string + version: number + description: string + type: string + icon: string + category: string + baseClasses: string[] + inputs: INodeParams[] + sessionId?: string + badge?: string + + constructor(fields?: { sessionId?: string }) { + this.label = 'Tool Agent' + this.name = 'toolAgent' + this.version = 1.0 + this.type = 'AgentExecutor' + this.category = 'Agents' + this.icon = 'toolAgent.png' + this.description = `Agent that uses Function Calling to pick the tools and args to call` + this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] + this.badge = 'NEW' + this.inputs = [ + { + label: 'Tools', + name: 'tools', + type: 'Tool', + list: true + }, + { + label: 'Memory', + name: 'memory', + type: 'BaseChatMemory' + }, + { + label: 'Tool Calling Chat Model', + name: 'model', + type: 'BaseChatModel', + description: + 'Only compatible with models that are capable of function calling. ChatOpenAI, ChatMistral, ChatAnthropic, ChatVertexAI' + }, + { + label: 'System Message', + name: 'systemMessage', + type: 'string', + default: `You are a helpful AI assistant.`, + rows: 4, + optional: true, + additionalParams: true + }, + { + label: 'Input Moderation', + description: 'Detect text that could generate harmful output and prevent it from being sent to the language model', + name: 'inputModeration', + type: 'Moderation', + optional: true, + list: true + }, + { + label: 'Max Iterations', + name: 'maxIterations', + type: 'number', + optional: true, + additionalParams: true + } + ] + this.sessionId = fields?.sessionId + } + + async init(nodeData: INodeData, input: string, options: ICommonObject): Promise { + return prepareAgent(nodeData, options, { sessionId: this.sessionId, chatId: options.chatId, input }) + } + + async run(nodeData: INodeData, input: string, options: ICommonObject): Promise { + const memory = nodeData.inputs?.memory as FlowiseMemory + const moderations = nodeData.inputs?.inputModeration as Moderation[] + + const isStreamable = options.socketIO && options.socketIOClientId + + if (moderations && moderations.length > 0) { + try { + // Use the output of the moderation chain as input for the OpenAI Function Agent + input = await checkInputs(moderations, input) + } catch (e) { + await new Promise((resolve) => setTimeout(resolve, 500)) + if (isStreamable) + streamResponse(options.socketIO && options.socketIOClientId, e.message, options.socketIO, options.socketIOClientId) + return formatResponse(e.message) + } + } + + const executor = prepareAgent(nodeData, options, { sessionId: this.sessionId, chatId: options.chatId, input }) + + const loggerHandler = new ConsoleCallbackHandler(options.logger) + const callbacks = await additionalCallbacks(nodeData, options) + + let res: ChainValues = {} + let sourceDocuments: ICommonObject[] = [] + let usedTools: IUsedTool[] = [] + + if (isStreamable) { + const handler = new CustomChainHandler(options.socketIO, options.socketIOClientId) + res = await executor.invoke({ input }, { callbacks: [loggerHandler, handler, ...callbacks] }) + if (res.sourceDocuments) { + options.socketIO.to(options.socketIOClientId).emit('sourceDocuments', flatten(res.sourceDocuments)) + sourceDocuments = res.sourceDocuments + } + if (res.usedTools) { + options.socketIO.to(options.socketIOClientId).emit('usedTools', res.usedTools) + usedTools = res.usedTools + } + } else { + res = await executor.invoke({ input }, { callbacks: [loggerHandler, ...callbacks] }) + if (res.sourceDocuments) { + sourceDocuments = res.sourceDocuments + } + if (res.usedTools) { + usedTools = res.usedTools + } + } + + let output = res?.output as string + + // Claude 3 Opus tends to spit out .. as well, discard that in final output + const regexPattern: RegExp = /[\s\S]*?<\/thinking>/ + const matches: RegExpMatchArray | null = output.match(regexPattern) + if (matches) { + for (const match of matches) { + output = output.replace(match, '') + } + } + + await memory.addChatMessages( + [ + { + text: input, + type: 'userMessage' + }, + { + text: output, + type: 'apiMessage' + } + ], + this.sessionId + ) + + let finalRes = output + + if (sourceDocuments.length || usedTools.length) { + const finalRes: ICommonObject = { text: output } + if (sourceDocuments.length) { + finalRes.sourceDocuments = flatten(sourceDocuments) + } + if (usedTools.length) { + finalRes.usedTools = usedTools + } + return finalRes + } + + return finalRes + } +} + +const prepareAgent = (nodeData: INodeData, options: ICommonObject, flowObj: { sessionId?: string; chatId?: string; input?: string }) => { + const model = nodeData.inputs?.model as BaseChatModel + const maxIterations = nodeData.inputs?.maxIterations as string + const memory = nodeData.inputs?.memory as FlowiseMemory + const systemMessage = nodeData.inputs?.systemMessage as string + let tools = nodeData.inputs?.tools + tools = flatten(tools) + const memoryKey = memory.memoryKey ? memory.memoryKey : 'chat_history' + const inputKey = memory.inputKey ? memory.inputKey : 'input' + + const prompt = ChatPromptTemplate.fromMessages([ + ['system', systemMessage], + new MessagesPlaceholder(memoryKey), + ['human', `{${inputKey}}`], + new MessagesPlaceholder('agent_scratchpad') + ]) + + if (llmSupportsVision(model)) { + const visionChatModel = model as IVisionChatModal + const messageContent = addImagesToMessages(nodeData, options, model.multiModalOption) + + if (messageContent?.length) { + visionChatModel.setVisionModel() + + // Pop the `agent_scratchpad` MessagePlaceHolder + let messagePlaceholder = prompt.promptMessages.pop() as MessagesPlaceholder + if (prompt.promptMessages.at(-1) instanceof HumanMessagePromptTemplate) { + const lastMessage = prompt.promptMessages.pop() as HumanMessagePromptTemplate + const template = (lastMessage.prompt as PromptTemplate).template as string + const msg = HumanMessagePromptTemplate.fromTemplate([ + ...messageContent, + { + text: template + } + ]) + msg.inputVariables = lastMessage.inputVariables + prompt.promptMessages.push(msg) + } + + // Add the `agent_scratchpad` MessagePlaceHolder back + prompt.promptMessages.push(messagePlaceholder) + } else { + visionChatModel.revertToOriginalModel() + } + } + + if (model.bindTools === undefined) { + throw new Error(`This agent requires that the "bindTools()" method be implemented on the input model.`) + } + + const modelWithTools = model.bindTools(tools) + + const runnableAgent = RunnableSequence.from([ + { + [inputKey]: (i: { input: string; steps: ToolsAgentStep[] }) => i.input, + agent_scratchpad: (i: { input: string; steps: ToolsAgentStep[] }) => formatToOpenAIToolMessages(i.steps), + [memoryKey]: async (_: { input: string; steps: ToolsAgentStep[] }) => { + const messages = (await memory.getChatMessages(flowObj?.sessionId, true)) as BaseMessage[] + return messages ?? [] + } + }, + prompt, + modelWithTools, + new ToolCallingAgentOutputParser() + ]) + + const executor = AgentExecutor.fromAgentAndTools({ + agent: runnableAgent, + tools, + sessionId: flowObj?.sessionId, + chatId: flowObj?.chatId, + input: flowObj?.input, + verbose: process.env.DEBUG === 'true' ? true : false, + maxIterations: maxIterations ? parseFloat(maxIterations) : undefined + }) + + return executor +} + +module.exports = { nodeClass: ToolAgent_Agents } diff --git a/packages/components/nodes/agents/ToolAgent/toolAgent.png b/packages/components/nodes/agents/ToolAgent/toolAgent.png new file mode 100644 index 000000000..7bf44339b Binary files /dev/null and b/packages/components/nodes/agents/ToolAgent/toolAgent.png differ diff --git a/packages/components/nodes/agents/XMLAgent/XMLAgent.ts b/packages/components/nodes/agents/XMLAgent/XMLAgent.ts index fe865d259..b92d6fd10 100644 --- a/packages/components/nodes/agents/XMLAgent/XMLAgent.ts +++ b/packages/components/nodes/agents/XMLAgent/XMLAgent.ts @@ -57,7 +57,6 @@ class XMLAgent_Agents implements INode { this.type = 'XMLAgent' this.category = 'Agents' this.icon = 'xmlagent.svg' - this.badge = 'NEW' this.description = `Agent that is designed for LLMs that are good for reasoning/writing XML (e.g: Anthropic Claude)` this.baseClasses = [this.type, ...getBaseClasses(AgentExecutor)] this.inputs = [ diff --git a/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/ChatGoogleGenerativeAI.ts b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/ChatGoogleGenerativeAI.ts index f0dd45e5d..762872293 100644 --- a/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/ChatGoogleGenerativeAI.ts +++ b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/ChatGoogleGenerativeAI.ts @@ -1,10 +1,10 @@ import { HarmBlockThreshold, HarmCategory } from '@google/generative-ai' import type { SafetySetting } from '@google/generative-ai' -import { ChatGoogleGenerativeAI, GoogleGenerativeAIChatInput } from '@langchain/google-genai' import { BaseCache } from '@langchain/core/caches' -import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface' +import { ICommonObject, IMultiModalOption, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface' import { convertMultiOptionsToStringArray, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { getModels, MODEL_TYPE } from '../../../src/modelLoader' +import { ChatGoogleGenerativeAI, GoogleGenerativeAIChatInput } from './FlowiseChatGoogleGenerativeAI' class GoogleGenerativeAI_ChatModels implements INode { label: string @@ -139,6 +139,15 @@ class GoogleGenerativeAI_ChatModels implements INode { ], optional: true, additionalParams: true + }, + { + label: 'Allow Image Uploads', + name: 'allowImageUploads', + type: 'boolean', + description: + 'Automatically uses vision model when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent', + default: false, + optional: true } ] } @@ -162,20 +171,21 @@ class GoogleGenerativeAI_ChatModels implements INode { const harmCategory = nodeData.inputs?.harmCategory as string const harmBlockThreshold = nodeData.inputs?.harmBlockThreshold as string const cache = nodeData.inputs?.cache as BaseCache + const streaming = nodeData.inputs?.streaming as boolean + + const allowImageUploads = nodeData.inputs?.allowImageUploads as boolean const obj: Partial = { apiKey: apiKey, modelName: modelName, - maxOutputTokens: 2048 + streaming: streaming ?? true } if (maxOutputTokens) obj.maxOutputTokens = parseInt(maxOutputTokens, 10) - - const model = new ChatGoogleGenerativeAI(obj) - if (topP) model.topP = parseFloat(topP) - if (topK) model.topK = parseFloat(topK) - if (cache) model.cache = cache - if (temperature) model.temperature = parseFloat(temperature) + if (topP) obj.topP = parseFloat(topP) + if (topK) obj.topK = parseFloat(topK) + if (cache) obj.cache = cache + if (temperature) obj.temperature = parseFloat(temperature) // Safety Settings let harmCategories: string[] = convertMultiOptionsToStringArray(harmCategory) @@ -188,7 +198,16 @@ class GoogleGenerativeAI_ChatModels implements INode { threshold: harmBlockThresholds[index] as HarmBlockThreshold } }) - if (safetySettings.length > 0) model.safetySettings = safetySettings + if (safetySettings.length > 0) obj.safetySettings = safetySettings + + const multiModalOption: IMultiModalOption = { + image: { + allowImageUploads: allowImageUploads ?? false + } + } + + const model = new ChatGoogleGenerativeAI(nodeData.id, obj) + model.setMultiModalOption(multiModalOption) return model } diff --git a/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts new file mode 100644 index 000000000..47425ed27 --- /dev/null +++ b/packages/components/nodes/chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI.ts @@ -0,0 +1,550 @@ +import { BaseMessage, AIMessage, AIMessageChunk, isBaseMessage, ChatMessage, MessageContent } from '@langchain/core/messages' +import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager' +import { BaseChatModel, type BaseChatModelParams } from '@langchain/core/language_models/chat_models' +import { ChatGeneration, ChatGenerationChunk, ChatResult } from '@langchain/core/outputs' +import { ToolCall } from '@langchain/core/messages/tool' +import { NewTokenIndices } from '@langchain/core/callbacks/base' +import { + EnhancedGenerateContentResponse, + Content, + Part, + Tool, + GenerativeModel, + GoogleGenerativeAI as GenerativeAI +} from '@google/generative-ai' +import type { SafetySetting } from '@google/generative-ai' +import { ICommonObject, IMultiModalOption, IVisionChatModal } from '../../../src' +import { StructuredToolInterface } from '@langchain/core/tools' +import { isStructuredTool } from '@langchain/core/utils/function_calling' +import { zodToJsonSchema } from 'zod-to-json-schema' + +interface TokenUsage { + completionTokens?: number + promptTokens?: number + totalTokens?: number +} + +export interface GoogleGenerativeAIChatInput extends BaseChatModelParams { + modelName?: string + model?: string + temperature?: number + maxOutputTokens?: number + topP?: number + topK?: number + stopSequences?: string[] + safetySettings?: SafetySetting[] + apiKey?: string + streaming?: boolean +} + +class LangchainChatGoogleGenerativeAI extends BaseChatModel implements GoogleGenerativeAIChatInput { + modelName = 'gemini-pro' + + temperature?: number + + maxOutputTokens?: number + + topP?: number + + topK?: number + + stopSequences: string[] = [] + + safetySettings?: SafetySetting[] + + apiKey?: string + + streaming = false + + private client: GenerativeModel + + get _isMultimodalModel() { + return this.modelName.includes('vision') || this.modelName.startsWith('gemini-1.5') + } + + constructor(fields?: GoogleGenerativeAIChatInput) { + super(fields ?? {}) + + this.modelName = fields?.model?.replace(/^models\//, '') ?? fields?.modelName?.replace(/^models\//, '') ?? 'gemini-pro' + + this.maxOutputTokens = fields?.maxOutputTokens ?? this.maxOutputTokens + + if (this.maxOutputTokens && this.maxOutputTokens < 0) { + throw new Error('`maxOutputTokens` must be a positive integer') + } + + this.temperature = fields?.temperature ?? this.temperature + if (this.temperature && (this.temperature < 0 || this.temperature > 1)) { + throw new Error('`temperature` must be in the range of [0.0,1.0]') + } + + this.topP = fields?.topP ?? this.topP + if (this.topP && this.topP < 0) { + throw new Error('`topP` must be a positive integer') + } + + if (this.topP && this.topP > 1) { + throw new Error('`topP` must be below 1.') + } + + this.topK = fields?.topK ?? this.topK + if (this.topK && this.topK < 0) { + throw new Error('`topK` must be a positive integer') + } + + this.stopSequences = fields?.stopSequences ?? this.stopSequences + + this.apiKey = fields?.apiKey ?? process.env['GOOGLE_API_KEY'] + if (!this.apiKey) { + throw new Error( + 'Please set an API key for Google GenerativeAI ' + + 'in the environment variable GOOGLE_API_KEY ' + + 'or in the `apiKey` field of the ' + + 'ChatGoogleGenerativeAI constructor' + ) + } + + this.safetySettings = fields?.safetySettings ?? this.safetySettings + if (this.safetySettings && this.safetySettings.length > 0) { + const safetySettingsSet = new Set(this.safetySettings.map((s) => s.category)) + if (safetySettingsSet.size !== this.safetySettings.length) { + throw new Error('The categories in `safetySettings` array must be unique') + } + } + + this.streaming = fields?.streaming ?? this.streaming + + this.getClient() + } + + getClient(tools?: Tool[]) { + this.client = new GenerativeAI(this.apiKey ?? '').getGenerativeModel({ + model: this.modelName, + tools, + safetySettings: this.safetySettings as SafetySetting[], + generationConfig: { + candidateCount: 1, + stopSequences: this.stopSequences, + maxOutputTokens: this.maxOutputTokens, + temperature: this.temperature, + topP: this.topP, + topK: this.topK + } + }) + } + + _combineLLMOutput() { + return [] + } + + _llmType() { + return 'googlegenerativeai' + } + + override bindTools(tools: (StructuredToolInterface | Record)[], kwargs?: Partial) { + //@ts-ignore + return this.bind({ tools: convertToGeminiTools(tools), ...kwargs }) + } + + convertFunctionResponse(prompts: Content[]) { + for (let i = 0; i < prompts.length; i += 1) { + if (prompts[i].role === 'function') { + if (prompts[i - 1].role === 'model') { + const toolName = prompts[i - 1].parts[0].functionCall?.name ?? '' + prompts[i].parts = [ + { + functionResponse: { + name: toolName, + response: { + name: toolName, + content: prompts[i].parts[0].text + } + } + } + ] + } + } + } + } + + async _generateNonStreaming( + prompt: Content[], + options: this['ParsedCallOptions'], + _runManager?: CallbackManagerForLLMRun + ): Promise { + //@ts-ignore + const tools = options.tools ?? [] + + this.convertFunctionResponse(prompt) + + if (tools.length > 0) { + this.getClient(tools) + } else { + this.getClient() + } + const res = await this.caller.callWithOptions({ signal: options?.signal }, async () => { + let output + try { + output = await this.client.generateContent({ + contents: prompt + }) + } catch (e: any) { + if (e.message?.includes('400 Bad Request')) { + e.status = 400 + } + throw e + } + return output + }) + const generationResult = mapGenerateContentResultToChatResult(res.response) + await _runManager?.handleLLMNewToken(generationResult.generations?.length ? generationResult.generations[0].text : '') + return generationResult + } + + async _generate( + messages: BaseMessage[], + options: this['ParsedCallOptions'], + runManager?: CallbackManagerForLLMRun + ): Promise { + const prompt = convertBaseMessagesToContent(messages, this._isMultimodalModel) + + // Handle streaming + if (this.streaming) { + const tokenUsage: TokenUsage = {} + const stream = this._streamResponseChunks(messages, options, runManager) + const finalChunks: Record = {} + for await (const chunk of stream) { + const index = (chunk.generationInfo as NewTokenIndices)?.completion ?? 0 + if (finalChunks[index] === undefined) { + finalChunks[index] = chunk + } else { + finalChunks[index] = finalChunks[index].concat(chunk) + } + } + const generations = Object.entries(finalChunks) + .sort(([aKey], [bKey]) => parseInt(aKey, 10) - parseInt(bKey, 10)) + .map(([_, value]) => value) + + return { generations, llmOutput: { estimatedTokenUsage: tokenUsage } } + } + return this._generateNonStreaming(prompt, options, runManager) + } + + async *_streamResponseChunks( + messages: BaseMessage[], + options: this['ParsedCallOptions'], + runManager?: CallbackManagerForLLMRun + ): AsyncGenerator { + const prompt = convertBaseMessagesToContent(messages, this._isMultimodalModel) + //@ts-ignore + if (options.tools !== undefined && options.tools.length > 0) { + const result = await this._generateNonStreaming(prompt, options, runManager) + const generationMessage = result.generations[0].message as AIMessage + if (generationMessage === undefined) { + throw new Error('Could not parse Groq output.') + } + const toolCallChunks = generationMessage.tool_calls?.map((toolCall, i) => ({ + name: toolCall.name, + args: JSON.stringify(toolCall.args), + id: toolCall.id, + index: i + })) + yield new ChatGenerationChunk({ + message: new AIMessageChunk({ + content: generationMessage.content, + additional_kwargs: generationMessage.additional_kwargs, + tool_call_chunks: toolCallChunks + }), + text: generationMessage.tool_calls?.length ? '' : (generationMessage.content as string) + }) + } else { + const stream = await this.caller.callWithOptions({ signal: options?.signal }, async () => { + this.getClient() + const { stream } = await this.client.generateContentStream({ + contents: prompt + }) + return stream + }) + + for await (const response of stream) { + const chunk = convertResponseContentToChatGenerationChunk(response) + if (!chunk) { + continue + } + + yield chunk + await runManager?.handleLLMNewToken(chunk.text ?? '') + } + } + } +} + +export class ChatGoogleGenerativeAI extends LangchainChatGoogleGenerativeAI implements IVisionChatModal { + configuredModel: string + configuredMaxToken?: number + multiModalOption: IMultiModalOption + id: string + + constructor(id: string, fields?: GoogleGenerativeAIChatInput) { + super(fields) + this.id = id + this.configuredModel = fields?.modelName ?? '' + this.configuredMaxToken = fields?.maxOutputTokens + } + + revertToOriginalModel(): void { + super.modelName = this.configuredModel + super.maxOutputTokens = this.configuredMaxToken + } + + setMultiModalOption(multiModalOption: IMultiModalOption): void { + this.multiModalOption = multiModalOption + } + + setVisionModel(): void { + if (this.modelName !== 'gemini-pro-vision' && this.modelName !== 'gemini-1.5-pro-latest') { + super.modelName = 'gemini-1.5-pro-latest' + super.maxOutputTokens = this.configuredMaxToken ? this.configuredMaxToken : 8192 + } + } +} + +function getMessageAuthor(message: BaseMessage) { + const type = message._getType() + if (ChatMessage.isInstance(message)) { + return message.role + } + return message.name ?? type +} + +function convertAuthorToRole(author: string) { + switch (author) { + /** + * Note: Gemini currently is not supporting system messages + * we will convert them to human messages and merge with following + * */ + case 'ai': + case 'model': // getMessageAuthor returns message.name. code ex.: return message.name ?? type; + return 'model' + case 'system': + case 'human': + return 'user' + case 'function': + case 'tool': + return 'function' + default: + throw new Error(`Unknown / unsupported author: ${author}`) + } +} + +function convertMessageContentToParts(content: MessageContent, isMultimodalModel: boolean): Part[] { + if (typeof content === 'string') { + return [{ text: content }] + } + + return content.map((c) => { + if (c.type === 'text') { + return { + text: c.text + } + } + + if (c.type === 'tool_use') { + return { + functionCall: c.functionCall + } + } + + /*if (c.type === "tool_use" || c.type === "tool_result") { + // TODO: Fix when SDK types are fixed + return { + ...contentPart, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any; + }*/ + + if (c.type === 'image_url') { + if (!isMultimodalModel) { + throw new Error(`This model does not support images`) + } + let source + if (typeof c.image_url === 'string') { + source = c.image_url + } else if (typeof c.image_url === 'object' && 'url' in c.image_url) { + source = c.image_url.url + } else { + throw new Error('Please provide image as base64 encoded data URL') + } + const [dm, data] = source.split(',') + if (!dm.startsWith('data:')) { + throw new Error('Please provide image as base64 encoded data URL') + } + + const [mimeType, encoding] = dm.replace(/^data:/, '').split(';') + if (encoding !== 'base64') { + throw new Error('Please provide image as base64 encoded data URL') + } + + return { + inlineData: { + data, + mimeType + } + } + } + throw new Error(`Unknown content type ${(c as { type: string }).type}`) + }) +} + +function convertBaseMessagesToContent(messages: BaseMessage[], isMultimodalModel: boolean) { + return messages.reduce<{ + content: Content[] + mergeWithPreviousContent: boolean + }>( + (acc, message, index) => { + if (!isBaseMessage(message)) { + throw new Error('Unsupported message input') + } + const author = getMessageAuthor(message) + if (author === 'system' && index !== 0) { + throw new Error('System message should be the first one') + } + const role = convertAuthorToRole(author) + + const prevContent = acc.content[acc.content.length] + if (!acc.mergeWithPreviousContent && prevContent && prevContent.role === role) { + throw new Error('Google Generative AI requires alternate messages between authors') + } + + const parts = convertMessageContentToParts(message.content, isMultimodalModel) + + if (acc.mergeWithPreviousContent) { + const prevContent = acc.content[acc.content.length - 1] + if (!prevContent) { + throw new Error('There was a problem parsing your system message. Please try a prompt without one.') + } + prevContent.parts.push(...parts) + + return { + mergeWithPreviousContent: false, + content: acc.content + } + } + const content: Content = { + role, + parts + } + return { + mergeWithPreviousContent: author === 'system', + content: [...acc.content, content] + } + }, + { content: [], mergeWithPreviousContent: false } + ).content +} + +function mapGenerateContentResultToChatResult(response: EnhancedGenerateContentResponse): ChatResult { + // if rejected or error, return empty generations with reason in filters + if (!response.candidates || response.candidates.length === 0 || !response.candidates[0]) { + return { + generations: [], + llmOutput: { + filters: response?.promptFeedback + } + } + } + + const [candidate] = response.candidates + const { content, ...generationInfo } = candidate + const text = content.parts.map(({ text }) => text).join('') + + if (content.parts.some((part) => part.functionCall)) { + const toolCalls: ToolCall[] = [] + for (const fcPart of content.parts) { + const fc = fcPart.functionCall + if (fc) { + const { name, args } = fc + toolCalls.push({ name, args }) + } + } + + const functionCalls = toolCalls.map((tool) => { + return { functionCall: { name: tool.name, args: tool.args }, type: 'tool_use' } + }) + const generation: ChatGeneration = { + text, + message: new AIMessage({ + content: functionCalls, + name: !content ? undefined : content.role, + additional_kwargs: generationInfo, + tool_calls: toolCalls + }), + generationInfo + } + return { + generations: [generation] + } + } else { + const generation: ChatGeneration = { + text, + message: new AIMessage({ + content: text, + name: !content ? undefined : content.role, + additional_kwargs: generationInfo + }), + generationInfo + } + + return { + generations: [generation] + } + } +} + +function convertResponseContentToChatGenerationChunk(response: EnhancedGenerateContentResponse): ChatGenerationChunk | null { + if (!response.candidates || response.candidates.length === 0) { + return null + } + const [candidate] = response.candidates + const { content, ...generationInfo } = candidate + const text = content?.parts[0]?.text ?? '' + + return new ChatGenerationChunk({ + text, + message: new AIMessageChunk({ + content: text, + name: !content ? undefined : content.role, + // Each chunk can have unique "generationInfo", and merging strategy is unclear, + // so leave blank for now. + additional_kwargs: {} + }), + generationInfo + }) +} + +function zodToGeminiParameters(zodObj: any) { + // Gemini doesn't accept either the $schema or additionalProperties + // attributes, so we need to explicitly remove them. + const jsonSchema: any = zodToJsonSchema(zodObj) + // eslint-disable-next-line unused-imports/no-unused-vars + const { $schema, additionalProperties, ...rest } = jsonSchema + return rest +} + +function convertToGeminiTools(structuredTools: (StructuredToolInterface | Record)[]) { + return [ + { + functionDeclarations: structuredTools.map((structuredTool) => { + if (isStructuredTool(structuredTool)) { + const jsonSchema = zodToGeminiParameters(structuredTool.schema) + return { + name: structuredTool.name, + description: structuredTool.description, + parameters: jsonSchema + } + } + return structuredTool + }) + } + ] +} diff --git a/packages/components/nodes/chatmodels/ChatGoogleVertexAI/ChatGoogleVertexAI.ts b/packages/components/nodes/chatmodels/ChatGoogleVertexAI/ChatGoogleVertexAI.ts index 381785195..58fc15f75 100644 --- a/packages/components/nodes/chatmodels/ChatGoogleVertexAI/ChatGoogleVertexAI.ts +++ b/packages/components/nodes/chatmodels/ChatGoogleVertexAI/ChatGoogleVertexAI.ts @@ -1,6 +1,5 @@ -import { GoogleAuthOptions } from 'google-auth-library' import { BaseCache } from '@langchain/core/caches' -import { ChatGoogleVertexAI, GoogleVertexAIChatInput } from '@langchain/community/chat_models/googlevertexai' +import { ChatVertexAI, ChatVertexAIInput } from '@langchain/google-vertexai' import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface' import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { getModels, MODEL_TYPE } from '../../../src/modelLoader' @@ -20,12 +19,12 @@ class GoogleVertexAI_ChatModels implements INode { constructor() { this.label = 'ChatGoogleVertexAI' this.name = 'chatGoogleVertexAI' - this.version = 3.0 + this.version = 4.0 this.type = 'ChatGoogleVertexAI' this.icon = 'GoogleVertex.svg' this.category = 'Chat Models' this.description = 'Wrapper around VertexAI large language models that use the Chat endpoint' - this.baseClasses = [this.type, ...getBaseClasses(ChatGoogleVertexAI)] + this.baseClasses = [this.type, ...getBaseClasses(ChatVertexAI)] this.credential = { label: 'Connect Credential', name: 'credential', @@ -72,6 +71,15 @@ class GoogleVertexAI_ChatModels implements INode { step: 0.1, optional: true, additionalParams: true + }, + { + label: 'Top Next Highest Probability Tokens', + name: 'topK', + type: 'number', + description: `Decode using top-k sampling: consider the set of top_k most probable tokens. Must be positive`, + step: 1, + optional: true, + additionalParams: true } ] } @@ -89,7 +97,7 @@ class GoogleVertexAI_ChatModels implements INode { const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData) const projectID = getCredentialParam('projectID', credentialData, nodeData) - const authOptions: GoogleAuthOptions = {} + const authOptions: ICommonObject = {} if (Object.keys(credentialData).length !== 0) { if (!googleApplicationCredentialFilePath && !googleApplicationCredential) throw new Error('Please specify your Google Application Credential') @@ -111,8 +119,9 @@ class GoogleVertexAI_ChatModels implements INode { const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string const topP = nodeData.inputs?.topP as string const cache = nodeData.inputs?.cache as BaseCache + const topK = nodeData.inputs?.topK as string - const obj: GoogleVertexAIChatInput = { + const obj: ChatVertexAIInput = { temperature: parseFloat(temperature), model: modelName } @@ -121,8 +130,9 @@ class GoogleVertexAI_ChatModels implements INode { if (maxOutputTokens) obj.maxOutputTokens = parseInt(maxOutputTokens, 10) if (topP) obj.topP = parseFloat(topP) if (cache) obj.cache = cache + if (topK) obj.topK = parseFloat(topK) - const model = new ChatGoogleVertexAI(obj) + const model = new ChatVertexAI(obj) return model } } diff --git a/packages/components/nodes/chatmodels/ChatMistral/ChatMistral.ts b/packages/components/nodes/chatmodels/ChatMistral/ChatMistral.ts index 3c9366f0b..b82272ac3 100644 --- a/packages/components/nodes/chatmodels/ChatMistral/ChatMistral.ts +++ b/packages/components/nodes/chatmodels/ChatMistral/ChatMistral.ts @@ -1,37 +1,9 @@ -import { ChatCompletionResponse, ToolCalls as MistralAIToolCalls } from '@mistralai/mistralai' import { BaseCache } from '@langchain/core/caches' -import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager' -import { NewTokenIndices } from '@langchain/core/callbacks/base' -import { ChatGeneration, ChatGenerationChunk, ChatResult } from '@langchain/core/outputs' -import { - MessageType, - type BaseMessage, - MessageContent, - AIMessage, - HumanMessage, - HumanMessageChunk, - AIMessageChunk, - ToolMessageChunk, - ChatMessageChunk -} from '@langchain/core/messages' -import { ChatMistralAI as LangchainChatMistralAI, ChatMistralAIInput } from '@langchain/mistralai' +import { ChatMistralAI, ChatMistralAIInput } from '@langchain/mistralai' import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface' import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils' import { getModels, MODEL_TYPE } from '../../../src/modelLoader' -interface TokenUsage { - completionTokens?: number - promptTokens?: number - totalTokens?: number -} - -type MistralAIInputMessage = { - role: string - name?: string - content: string | string[] - tool_calls?: MistralAIToolCalls[] | any[] -} - class ChatMistral_ChatModels implements INode { label: string name: string @@ -170,243 +142,4 @@ class ChatMistral_ChatModels implements INode { } } -class ChatMistralAI extends LangchainChatMistralAI { - async _generate( - messages: BaseMessage[], - options?: this['ParsedCallOptions'], - runManager?: CallbackManagerForLLMRun - ): Promise { - const tokenUsage: TokenUsage = {} - const params = this.invocationParams(options) - const mistralMessages = this.convertMessagesToMistralMessages(messages) - const input = { - ...params, - messages: mistralMessages - } - - // Handle streaming - if (this.streaming) { - const stream = this._streamResponseChunks(messages, options, runManager) - const finalChunks: Record = {} - for await (const chunk of stream) { - const index = (chunk.generationInfo as NewTokenIndices)?.completion ?? 0 - if (finalChunks[index] === undefined) { - finalChunks[index] = chunk - } else { - finalChunks[index] = finalChunks[index].concat(chunk) - } - } - const generations = Object.entries(finalChunks) - .sort(([aKey], [bKey]) => parseInt(aKey, 10) - parseInt(bKey, 10)) - .map(([_, value]) => value) - - return { generations, llmOutput: { estimatedTokenUsage: tokenUsage } } - } - - // Not streaming, so we can just call the API once. - const response = await this.completionWithRetry(input, false) - - const { completion_tokens: completionTokens, prompt_tokens: promptTokens, total_tokens: totalTokens } = response?.usage ?? {} - - if (completionTokens) { - tokenUsage.completionTokens = (tokenUsage.completionTokens ?? 0) + completionTokens - } - - if (promptTokens) { - tokenUsage.promptTokens = (tokenUsage.promptTokens ?? 0) + promptTokens - } - - if (totalTokens) { - tokenUsage.totalTokens = (tokenUsage.totalTokens ?? 0) + totalTokens - } - - const generations: ChatGeneration[] = [] - for (const part of response?.choices ?? []) { - if ('delta' in part) { - throw new Error('Delta not supported in non-streaming mode.') - } - if (!('message' in part)) { - throw new Error('No message found in the choice.') - } - const text = part.message?.content ?? '' - const generation: ChatGeneration = { - text, - message: this.mistralAIResponseToChatMessage(part) - } - if (part.finish_reason) { - generation.generationInfo = { finish_reason: part.finish_reason } - } - generations.push(generation) - } - return { - generations, - llmOutput: { tokenUsage } - } - } - - async *_streamResponseChunks( - messages: BaseMessage[], - options?: this['ParsedCallOptions'], - runManager?: CallbackManagerForLLMRun - ): AsyncGenerator { - const mistralMessages = this.convertMessagesToMistralMessages(messages) - const params = this.invocationParams(options) - const input = { - ...params, - messages: mistralMessages - } - - const streamIterable = await this.completionWithRetry(input, true) - for await (const data of streamIterable) { - const choice = data?.choices[0] - if (!choice || !('delta' in choice)) { - continue - } - - const { delta } = choice - if (!delta) { - continue - } - const newTokenIndices = { - prompt: 0, - completion: choice.index ?? 0 - } - const message = this._convertDeltaToMessageChunk(delta) - if (message === null) { - // Do not yield a chunk if the message is empty - continue - } - const generationChunk = new ChatGenerationChunk({ - message, - text: delta.content ?? '', - generationInfo: newTokenIndices - }) - yield generationChunk - - void runManager?.handleLLMNewToken(generationChunk.text ?? '', newTokenIndices, undefined, undefined, undefined, { - chunk: generationChunk - }) - } - if (options?.signal?.aborted) { - throw new Error('AbortError') - } - } - - _convertDeltaToMessageChunk(delta: { - role?: string | undefined - content?: string | undefined - tool_calls?: MistralAIToolCalls[] | undefined - }) { - if (!delta.content && !delta.tool_calls) { - return null - } - // Our merge additional kwargs util function will throw unless there - // is an index key in each tool object (as seen in OpenAI's) so we - // need to insert it here. - const toolCallsWithIndex = delta.tool_calls?.length - ? delta.tool_calls?.map((toolCall, index) => ({ - ...toolCall, - index - })) - : undefined - - let role = 'assistant' - if (delta.role) { - role = delta.role - } else if (toolCallsWithIndex) { - role = 'tool' - } - const content = delta.content ?? '' - let additional_kwargs - if (toolCallsWithIndex) { - additional_kwargs = { - tool_calls: toolCallsWithIndex - } - } else { - additional_kwargs = {} - } - - if (role === 'user') { - return new HumanMessageChunk({ content }) - } else if (role === 'assistant') { - return new AIMessageChunk({ content, additional_kwargs }) - } else if (role === 'tool') { - return new ToolMessageChunk({ - content, - additional_kwargs, - tool_call_id: toolCallsWithIndex?.[0].id ?? '' - }) - } else { - return new ChatMessageChunk({ content, role }) - } - } - - convertMessagesToMistralMessages(messages: Array): Array { - const getRole = (role: MessageType) => { - switch (role) { - case 'human': - return 'user' - case 'ai': - return 'assistant' - case 'tool': - return 'tool' - case 'function': - return 'function' - case 'system': - return 'system' - default: - throw new Error(`Unknown message type: ${role}`) - } - } - - const getContent = (content: MessageContent): string => { - if (typeof content === 'string') { - return content - } - throw new Error(`ChatMistralAI does not support non text message content. Received: ${JSON.stringify(content, null, 2)}`) - } - - const mistralMessages = [] - for (const msg of messages) { - const msgObj: MistralAIInputMessage = { - role: getRole(msg._getType()), - content: getContent(msg.content) - } - if (getRole(msg._getType()) === 'tool') { - msgObj.role = 'assistant' - msgObj.tool_calls = msg.additional_kwargs?.tool_calls ?? [] - } else if (getRole(msg._getType()) === 'function') { - msgObj.role = 'tool' - msgObj.name = msg.name - } - - mistralMessages.push(msgObj) - } - - return mistralMessages - } - - mistralAIResponseToChatMessage(choice: ChatCompletionResponse['choices'][0]): BaseMessage { - const { message } = choice - // MistralAI SDK does not include tool_calls in the non - // streaming return type, so we need to extract it like this - // to satisfy typescript. - let toolCalls: MistralAIToolCalls[] = [] - if ('tool_calls' in message) { - toolCalls = message.tool_calls as MistralAIToolCalls[] - } - switch (message.role) { - case 'assistant': - return new AIMessage({ - content: message.content ?? '', - additional_kwargs: { - tool_calls: toolCalls - } - }) - default: - return new HumanMessage(message.content ?? '') - } - } -} - module.exports = { nodeClass: ChatMistral_ChatModels } diff --git a/packages/components/nodes/chatmodels/ChatOpenAI/FlowiseChatOpenAI.ts b/packages/components/nodes/chatmodels/ChatOpenAI/FlowiseChatOpenAI.ts index 7bb5f5118..61448a084 100644 --- a/packages/components/nodes/chatmodels/ChatOpenAI/FlowiseChatOpenAI.ts +++ b/packages/components/nodes/chatmodels/ChatOpenAI/FlowiseChatOpenAI.ts @@ -33,7 +33,9 @@ export class ChatOpenAI extends LangchainChatOpenAI implements IVisionChatModal } setVisionModel(): void { - super.modelName = 'gpt-4-vision-preview' - super.maxTokens = this.configuredMaxToken ? this.configuredMaxToken : 1024 + if (this.modelName !== 'gpt-4-turbo' && !this.modelName.includes('vision')) { + super.modelName = 'gpt-4-turbo' + super.maxTokens = this.configuredMaxToken ? this.configuredMaxToken : 1024 + } } } diff --git a/packages/components/nodes/tools/AIPlugin/AIPlugin.ts b/packages/components/nodes/tools/AIPlugin/AIPlugin.ts deleted file mode 100644 index f9afe0fed..000000000 --- a/packages/components/nodes/tools/AIPlugin/AIPlugin.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { AIPluginTool } from '@langchain/community/tools/aiplugin' -import { INode, INodeData, INodeParams } from '../../../src/Interface' -import { getBaseClasses } from '../../../src/utils' - -class AIPlugin implements INode { - label: string - name: string - version: number - description: string - type: string - icon: string - category: string - baseClasses: string[] - inputs?: INodeParams[] - badge: string - - constructor() { - this.label = 'AI Plugin' - this.name = 'aiPlugin' - this.version = 1.0 - this.type = 'AIPlugin' - this.icon = 'aiplugin.svg' - this.category = 'Tools' - this.description = 'Execute actions using ChatGPT Plugin Url' - this.baseClasses = [this.type, ...getBaseClasses(AIPluginTool)] - this.badge = 'DEPRECATING' - this.inputs = [ - { - label: 'Plugin Url', - name: 'pluginUrl', - type: 'string', - placeholder: 'https://www.klarna.com/.well-known/ai-plugin.json' - } - ] - } - - async init(nodeData: INodeData): Promise { - const pluginUrl = nodeData.inputs?.pluginUrl as string - const aiplugin = await AIPluginTool.fromPluginUrl(pluginUrl) - - return aiplugin - } -} - -module.exports = { nodeClass: AIPlugin } diff --git a/packages/components/nodes/tools/AIPlugin/aiplugin.svg b/packages/components/nodes/tools/AIPlugin/aiplugin.svg deleted file mode 100644 index a48cb7171..000000000 --- a/packages/components/nodes/tools/AIPlugin/aiplugin.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/packages/components/package.json b/packages/components/package.json index 53a643f9b..8feb30e59 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -31,16 +31,18 @@ "@gomomento/sdk": "^1.51.1", "@gomomento/sdk-core": "^1.51.1", "@google-ai/generativelanguage": "^0.2.1", - "@google/generative-ai": "^0.1.3", + "@google/generative-ai": "^0.7.0", "@huggingface/inference": "^2.6.1", - "@langchain/anthropic": "^0.1.4", - "@langchain/cohere": "^0.0.5", + "@langchain/anthropic": "^0.1.14", + "@langchain/cohere": "^0.0.7", "@langchain/community": "^0.0.39", + "@langchain/core": "^0.1.57", "@langchain/google-genai": "^0.0.10", - "@langchain/groq": "^0.0.2", - "@langchain/mistralai": "^0.0.11", + "@langchain/google-vertexai": "^0.0.5", + "@langchain/groq": "^0.0.8", + "@langchain/mistralai": "^0.0.18", "@langchain/mongodb": "^0.0.1", - "@langchain/openai": "^0.0.14", + "@langchain/openai": "^0.0.28", "@langchain/pinecone": "^0.0.3", "@langchain/weaviate": "^0.0.1", "@mistralai/mistralai": "0.1.3", @@ -64,7 +66,7 @@ "d3-dsv": "2", "dotenv": "^16.0.0", "express": "^4.17.3", - "faiss-node": "^0.2.2", + "faiss-node": "^0.5.1", "fast-json-patch": "^3.1.1", "form-data": "^4.0.0", "google-auth-library": "^9.4.0", @@ -73,7 +75,7 @@ "ioredis": "^5.3.2", "jsdom": "^22.1.0", "jsonpointer": "^5.0.1", - "langchain": "^0.1.26", + "langchain": "^0.1.33", "langfuse": "3.3.4", "langfuse-langchain": "^3.3.4", "langsmith": "0.1.6", @@ -89,7 +91,7 @@ "node-html-markdown": "^1.3.0", "notion-to-md": "^3.1.1", "object-hash": "^3.0.0", - "openai": "^4.16.1", + "openai": "^4.32.1", "pdf-parse": "^1.1.1", "pdfjs-dist": "^3.7.107", "pg": "^8.11.2", @@ -97,7 +99,7 @@ "puppeteer": "^20.7.1", "pyodide": ">=0.21.0-alpha.2", "redis": "^4.6.7", - "replicate": "^0.12.3", + "replicate": "^0.18.0", "socket.io": "^4.6.1", "srt-parser-2": "^1.2.3", "typeorm": "^0.3.6", diff --git a/packages/components/src/agents.ts b/packages/components/src/agents.ts index a11845761..048bf96fd 100644 --- a/packages/components/src/agents.ts +++ b/packages/components/src/agents.ts @@ -1,14 +1,16 @@ import { flatten } from 'lodash' import { ChainValues } from '@langchain/core/utils/types' import { AgentStep, AgentAction } from '@langchain/core/agents' -import { BaseMessage, FunctionMessage, AIMessage } from '@langchain/core/messages' -import { OutputParserException } from '@langchain/core/output_parsers' +import { BaseMessage, FunctionMessage, AIMessage, isBaseMessage } from '@langchain/core/messages' +import { ToolCall } from '@langchain/core/messages/tool' +import { OutputParserException, BaseOutputParser } from '@langchain/core/output_parsers' import { BaseLanguageModel } from '@langchain/core/language_models/base' import { CallbackManager, CallbackManagerForChainRun, Callbacks } from '@langchain/core/callbacks/manager' import { ToolInputParsingException, Tool, StructuredToolInterface } from '@langchain/core/tools' import { Runnable, RunnableSequence, RunnablePassthrough } from '@langchain/core/runnables' import { Serializable } from '@langchain/core/load/serializable' import { renderTemplate } from '@langchain/core/prompts' +import { ChatGeneration } from '@langchain/core/outputs' import { BaseChain, SerializedLLMChain } from 'langchain/chains' import { CreateReactAgentParams, @@ -824,3 +826,75 @@ export class XMLAgentOutputParser extends AgentActionOutputParser { throw new Error('getFormatInstructions not implemented inside XMLAgentOutputParser.') } } + +abstract class AgentMultiActionOutputParser extends BaseOutputParser {} + +type ToolsAgentAction = AgentAction & { + toolCallId: string + messageLog?: BaseMessage[] +} + +export type ToolsAgentStep = AgentStep & { + action: ToolsAgentAction +} + +function parseAIMessageToToolAction(message: AIMessage): ToolsAgentAction[] | AgentFinish { + const stringifiedMessageContent = typeof message.content === 'string' ? message.content : JSON.stringify(message.content) + let toolCalls: ToolCall[] = [] + if (message.tool_calls !== undefined && message.tool_calls.length > 0) { + toolCalls = message.tool_calls + } else { + if (message.additional_kwargs.tool_calls === undefined || message.additional_kwargs.tool_calls.length === 0) { + return { + returnValues: { output: message.content }, + log: stringifiedMessageContent + } + } + // Best effort parsing + for (const toolCall of message.additional_kwargs.tool_calls ?? []) { + const functionName = toolCall.function?.name + try { + const args = JSON.parse(toolCall.function.arguments) + toolCalls.push({ name: functionName, args, id: toolCall.id }) + } catch (e: any) { + throw new OutputParserException( + `Failed to parse tool arguments from chat model response. Text: "${JSON.stringify(toolCalls)}". ${e}` + ) + } + } + } + return toolCalls.map((toolCall, i) => { + const messageLog = i === 0 ? [message] : [] + const log = `Invoking "${toolCall.name}" with ${JSON.stringify(toolCall.args ?? {})}\n${stringifiedMessageContent}` + return { + tool: toolCall.name as string, + toolInput: toolCall.args, + toolCallId: toolCall.id ?? '', + log, + messageLog + } + }) +} + +export class ToolCallingAgentOutputParser extends AgentMultiActionOutputParser { + lc_namespace = ['langchain', 'agents', 'tool_calling'] + + static lc_name() { + return 'ToolCallingAgentOutputParser' + } + + async parse(text: string): Promise { + throw new Error(`ToolCallingAgentOutputParser can only parse messages.\nPassed input: ${text}`) + } + + async parseResult(generations: ChatGeneration[]) { + if ('message' in generations[0] && isBaseMessage(generations[0].message)) { + return parseAIMessageToToolAction(generations[0].message) + } + throw new Error('parseResult on ToolCallingAgentOutputParser only works on ChatGeneration output') + } + + getFormatInstructions(): string { + throw new Error('getFormatInstructions not implemented inside ToolCallingAgentOutputParser.') + } +} diff --git a/packages/components/src/utils.ts b/packages/components/src/utils.ts index d9e170389..4d477ff26 100644 --- a/packages/components/src/utils.ts +++ b/packages/components/src/utils.ts @@ -24,6 +24,7 @@ export const availableDependencies = [ '@gomomento/sdk', '@gomomento/sdk-core', '@google-ai/generativelanguage', + '@google/generative-ai', '@huggingface/inference', '@notionhq/client', '@opensearch-project/opensearch', diff --git a/packages/server/marketplaces/chatflows/ChatGPTPlugin.json b/packages/server/marketplaces/chatflows/ChatGPTPlugin.json deleted file mode 100644 index b7dbdb00b..000000000 --- a/packages/server/marketplaces/chatflows/ChatGPTPlugin.json +++ /dev/null @@ -1,500 +0,0 @@ -{ - "description": "Use ChatGPT Plugins within LangChain abstractions with GET and POST Tools", - "categories": "ChatGPT Plugin,HTTP GET/POST,ChatOpenAI,MRKL Agent,Langchain", - "framework": "Langchain", - "nodes": [ - { - "width": 300, - "height": 278, - "id": "aiPlugin_0", - "position": { - "x": 1086.2925487205378, - "y": 84.92168014974317 - }, - "type": "customNode", - "data": { - "id": "aiPlugin_0", - "label": "AI Plugin", - "name": "aiPlugin", - "version": 1, - "type": "AIPlugin", - "baseClasses": ["AIPlugin", "Tool"], - "category": "Tools", - "description": "Execute actions using ChatGPT Plugin Url", - "inputParams": [ - { - "label": "Plugin Url", - "name": "pluginUrl", - "type": "string", - "placeholder": "https://www.klarna.com/.well-known/ai-plugin.json" - } - ], - "inputAnchors": [], - "inputs": { - "pluginUrl": "https://www.klarna.com/.well-known/ai-plugin.json" - }, - "outputAnchors": [ - { - "id": "aiPlugin_0-output-aiPlugin-AIPlugin|Tool", - "name": "aiPlugin", - "label": "AIPlugin", - "type": "AIPlugin | Tool" - } - ], - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1086.2925487205378, - "y": 84.92168014974317 - }, - "dragging": false - }, - { - "width": 300, - "height": 251, - "id": "requestsGet_0", - "position": { - "x": 761.713884489628, - "y": 170.84830553778124 - }, - "type": "customNode", - "data": { - "id": "requestsGet_0", - "label": "Requests Get", - "name": "requestsGet", - "version": 1, - "type": "RequestsGet", - "baseClasses": ["RequestsGet", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Execute HTTP GET requests", - "inputParams": [ - { - "label": "URL", - "name": "url", - "type": "string", - "description": "Agent will make call to this exact URL. If not specified, agent will try to figure out itself from AIPlugin if provided", - "additionalParams": true, - "optional": true, - "id": "requestsGet_0-input-url-string" - }, - { - "label": "Description", - "name": "description", - "type": "string", - "rows": 4, - "default": "A portal to the internet. Use this when you need to get specific content from a website. \nInput should be a url (i.e. https://www.google.com). The output will be the text response of the GET request.", - "description": "Acts like a prompt to tell agent when it should use this tool", - "additionalParams": true, - "optional": true, - "id": "requestsGet_0-input-description-string" - }, - { - "label": "Headers", - "name": "headers", - "type": "json", - "additionalParams": true, - "optional": true, - "id": "requestsGet_0-input-headers-json" - } - ], - "inputAnchors": [], - "inputs": { - "url": "", - "description": "A portal to the internet. Use this when you need to get specific content from a website. \nInput should be a url (i.e. https://www.google.com). The output will be the text response of the GET request.", - "headers": "" - }, - "outputAnchors": [ - { - "id": "requestsGet_0-output-requestsGet-RequestsGet|Tool|StructuredTool|BaseLangChain", - "name": "requestsGet", - "label": "RequestsGet", - "type": "RequestsGet | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 761.713884489628, - "y": 170.84830553778124 - }, - "dragging": false - }, - { - "width": 300, - "height": 251, - "id": "requestsPost_0", - "position": { - "x": 436.4125209312256, - "y": 306.87715502984184 - }, - "type": "customNode", - "data": { - "id": "requestsPost_0", - "label": "Requests Post", - "name": "requestsPost", - "version": 1, - "type": "RequestsPost", - "baseClasses": ["RequestsPost", "Tool", "StructuredTool", "BaseLangChain"], - "category": "Tools", - "description": "Execute HTTP POST requests", - "inputParams": [ - { - "label": "URL", - "name": "url", - "type": "string", - "description": "Agent will make call to this exact URL. If not specified, agent will try to figure out itself from AIPlugin if provided", - "additionalParams": true, - "optional": true, - "id": "requestsPost_0-input-url-string" - }, - { - "label": "Body", - "name": "body", - "type": "json", - "description": "JSON body for the POST request. If not specified, agent will try to figure out itself from AIPlugin if provided", - "additionalParams": true, - "optional": true, - "id": "requestsPost_0-input-body-json" - }, - { - "label": "Description", - "name": "description", - "type": "string", - "rows": 4, - "default": "Use this when you want to POST to a website.\nInput should be a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, and the value of \"data\" should be a dictionary of \nkey-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string\nThe output will be the text response of the POST request.", - "description": "Acts like a prompt to tell agent when it should use this tool", - "additionalParams": true, - "optional": true, - "id": "requestsPost_0-input-description-string" - }, - { - "label": "Headers", - "name": "headers", - "type": "json", - "additionalParams": true, - "optional": true, - "id": "requestsPost_0-input-headers-json" - } - ], - "inputAnchors": [], - "inputs": { - "url": "", - "body": "", - "description": "Use this when you want to POST to a website.\nInput should be a json string with two keys: \"url\" and \"data\".\nThe value of \"url\" should be a string, and the value of \"data\" should be a dictionary of \nkey-value pairs you want to POST to the url as a JSON body.\nBe careful to always use double quotes for strings in the json string\nThe output will be the text response of the POST request.", - "headers": "" - }, - "outputAnchors": [ - { - "id": "requestsPost_0-output-requestsPost-RequestsPost|Tool|StructuredTool|BaseLangChain", - "name": "requestsPost", - "label": "RequestsPost", - "type": "RequestsPost | Tool | StructuredTool | BaseLangChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 436.4125209312256, - "y": 306.87715502984184 - }, - "dragging": false - }, - { - "width": 300, - "height": 523, - "id": "chatOpenAI_0", - "position": { - "x": 802.0103755177098, - "y": 576.0760341170851 - }, - "type": "customNode", - "data": { - "id": "chatOpenAI_0", - "label": "ChatOpenAI", - "name": "chatOpenAI", - "version": 6.0, - "type": "ChatOpenAI", - "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"], - "category": "Chat Models", - "description": "Wrapper around OpenAI large language models that use the Chat endpoint", - "inputParams": [ - { - "label": "Connect Credential", - "name": "credential", - "type": "credential", - "credentialNames": ["openAIApi"], - "id": "chatOpenAI_0-input-credential-credential" - }, - { - "label": "Model Name", - "name": "modelName", - "type": "asyncOptions", - "loadMethod": "listModels", - "default": "gpt-3.5-turbo", - "id": "chatOpenAI_0-input-modelName-options" - }, - { - "label": "Temperature", - "name": "temperature", - "type": "number", - "default": 0.9, - "optional": true, - "id": "chatOpenAI_0-input-temperature-number" - }, - { - "label": "Max Tokens", - "name": "maxTokens", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-maxTokens-number" - }, - { - "label": "Top Probability", - "name": "topP", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-topP-number" - }, - { - "label": "Frequency Penalty", - "name": "frequencyPenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-frequencyPenalty-number" - }, - { - "label": "Presence Penalty", - "name": "presencePenalty", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-presencePenalty-number" - }, - { - "label": "Timeout", - "name": "timeout", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-timeout-number" - }, - { - "label": "BasePath", - "name": "basepath", - "type": "string", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-basepath-string" - }, - { - "label": "BaseOptions", - "name": "baseOptions", - "type": "json", - "optional": true, - "additionalParams": true, - "id": "chatOpenAI_0-input-baseOptions-json" - }, - { - "label": "Allow Image Uploads", - "name": "allowImageUploads", - "type": "boolean", - "description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent", - "default": false, - "optional": true, - "id": "chatOpenAI_0-input-allowImageUploads-boolean" - }, - { - "label": "Image Resolution", - "description": "This parameter controls the resolution in which the model views the image.", - "name": "imageResolution", - "type": "options", - "options": [ - { - "label": "Low", - "name": "low" - }, - { - "label": "High", - "name": "high" - }, - { - "label": "Auto", - "name": "auto" - } - ], - "default": "low", - "optional": false, - "additionalParams": true, - "id": "chatOpenAI_0-input-imageResolution-options" - } - ], - "inputAnchors": [ - { - "label": "Cache", - "name": "cache", - "type": "BaseCache", - "optional": true, - "id": "chatOpenAI_0-input-cache-BaseCache" - } - ], - "inputs": { - "modelName": "gpt-3.5-turbo", - "temperature": 0.9, - "maxTokens": "", - "topP": "", - "frequencyPenalty": "", - "presencePenalty": "", - "timeout": "", - "basepath": "", - "baseOptions": "", - "allowImageUploads": true, - "imageResolution": "low" - }, - "outputAnchors": [ - { - "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", - "name": "chatOpenAI", - "label": "ChatOpenAI", - "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 802.0103755177098, - "y": 576.0760341170851 - }, - "dragging": false - }, - { - "width": 300, - "height": 280, - "id": "mrklAgentChat_0", - "position": { - "x": 1425.5853300862047, - "y": 441.06218012993924 - }, - "type": "customNode", - "data": { - "id": "mrklAgentChat_0", - "label": "MRKL Agent for Chat Models", - "name": "mrklAgentChat", - "version": 2, - "type": "AgentExecutor", - "baseClasses": ["AgentExecutor", "BaseChain"], - "category": "Agents", - "description": "Agent that uses the ReAct Framework to decide what action to take, optimized to be used with Chat Models", - "inputParams": [], - "inputAnchors": [ - { - "label": "Allowed Tools", - "name": "tools", - "type": "Tool", - "list": true, - "id": "mrklAgentChat_0-input-tools-Tool" - }, - { - "label": "Language Model", - "name": "model", - "type": "BaseLanguageModel", - "id": "mrklAgentChat_0-input-model-BaseLanguageModel" - }, - { - "label": "Input Moderation", - "description": "Detect text that could generate harmful output and prevent it from being sent to the language model", - "name": "inputModeration", - "type": "Moderation", - "optional": true, - "list": true, - "id": "mrklAgentChat_0-input-inputModeration-Moderation" - }, - { - "label": "Max Iterations", - "name": "maxIterations", - "type": "number", - "optional": true, - "additionalParams": true, - "id": "mrklAgentChat_0-input-maxIterations-number" - } - ], - "inputs": { - "inputModeration": "", - "tools": ["{{requestsGet_0.data.instance}}", "{{requestsPost_0.data.instance}}", "{{aiPlugin_0.data.instance}}"], - "model": "{{chatOpenAI_0.data.instance}}" - }, - "outputAnchors": [ - { - "id": "mrklAgentChat_0-output-mrklAgentChat-AgentExecutor|BaseChain", - "name": "mrklAgentChat", - "label": "AgentExecutor", - "type": "AgentExecutor | BaseChain" - } - ], - "outputs": {}, - "selected": false - }, - "selected": false, - "positionAbsolute": { - "x": 1425.5853300862047, - "y": 441.06218012993924 - }, - "dragging": false - } - ], - "edges": [ - { - "source": "aiPlugin_0", - "sourceHandle": "aiPlugin_0-output-aiPlugin-AIPlugin|Tool", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-tools-Tool", - "type": "buttonedge", - "id": "aiPlugin_0-aiPlugin_0-output-aiPlugin-AIPlugin|Tool-mrklAgentChat_0-mrklAgentChat_0-input-tools-Tool", - "data": { - "label": "" - } - }, - { - "source": "requestsGet_0", - "sourceHandle": "requestsGet_0-output-requestsGet-RequestsGet|Tool|StructuredTool|BaseLangChain", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-tools-Tool", - "type": "buttonedge", - "id": "requestsGet_0-requestsGet_0-output-requestsGet-RequestsGet|Tool|StructuredTool|BaseLangChain-mrklAgentChat_0-mrklAgentChat_0-input-tools-Tool", - "data": { - "label": "" - } - }, - { - "source": "requestsPost_0", - "sourceHandle": "requestsPost_0-output-requestsPost-RequestsPost|Tool|StructuredTool|BaseLangChain", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-tools-Tool", - "type": "buttonedge", - "id": "requestsPost_0-requestsPost_0-output-requestsPost-RequestsPost|Tool|StructuredTool|BaseLangChain-mrklAgentChat_0-mrklAgentChat_0-input-tools-Tool", - "data": { - "label": "" - } - }, - { - "source": "chatOpenAI_0", - "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-model-BaseLanguageModel", - "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-mrklAgentChat_0-mrklAgentChat_0-input-model-BaseLanguageModel", - "data": { - "label": "" - } - } - ] -} diff --git a/packages/server/marketplaces/chatflows/ReAct Agent.json b/packages/server/marketplaces/chatflows/ReAct Agent.json index 9a5a9a822..78ac415c8 100644 --- a/packages/server/marketplaces/chatflows/ReAct Agent.json +++ b/packages/server/marketplaces/chatflows/ReAct Agent.json @@ -1,6 +1,6 @@ { "description": "An agent that uses ReAct logic to decide what action to take", - "categories": "Calculator Tool,SerpAPI,ChatOpenAI,MRKL Agent,Langchain", + "categories": "Calculator Tool,SerpAPI,ChatOpenAI,ReAct Agent,Langchain", "framework": "Langchain", "nodes": [ { @@ -43,17 +43,17 @@ "dragging": false }, { - "id": "mrklAgentChat_0", + "id": "reactAgentChat_0", "position": { "x": 905.8535326018256, "y": 388.58312223652564 }, "type": "customNode", "data": { - "id": "mrklAgentChat_0", + "id": "reactAgentChat_0", "label": "ReAct Agent for Chat Models", "version": 4, - "name": "mrklAgentChat", + "name": "reactAgentChat", "type": "AgentExecutor", "baseClasses": ["AgentExecutor", "BaseChain", "Runnable"], "category": "Agents", @@ -65,19 +65,19 @@ "name": "tools", "type": "Tool", "list": true, - "id": "mrklAgentChat_0-input-tools-Tool" + "id": "reactAgentChat_0-input-tools-Tool" }, { "label": "Chat Model", "name": "model", "type": "BaseChatModel", - "id": "mrklAgentChat_0-input-model-BaseChatModel" + "id": "reactAgentChat_0-input-model-BaseChatModel" }, { "label": "Memory", "name": "memory", "type": "BaseChatMemory", - "id": "mrklAgentChat_0-input-memory-BaseChatMemory" + "id": "reactAgentChat_0-input-memory-BaseChatMemory" }, { "label": "Input Moderation", @@ -86,7 +86,7 @@ "type": "Moderation", "optional": true, "list": true, - "id": "mrklAgentChat_0-input-inputModeration-Moderation" + "id": "reactAgentChat_0-input-inputModeration-Moderation" }, { "label": "Max Iterations", @@ -94,7 +94,7 @@ "type": "number", "optional": true, "additionalParams": true, - "id": "mrklAgentChat_0-input-maxIterations-number" + "id": "reactAgentChat_0-input-maxIterations-number" } ], "inputs": { @@ -105,8 +105,8 @@ }, "outputAnchors": [ { - "id": "mrklAgentChat_0-output-mrklAgentChat-AgentExecutor|BaseChain|Runnable", - "name": "mrklAgentChat", + "id": "reactAgentChat_0-output-reactAgentChat-AgentExecutor|BaseChain|Runnable", + "name": "reactAgentChat", "label": "AgentExecutor", "description": "Agent that uses the ReAct logic to decide what action to take, optimized to be used with Chat Models", "type": "AgentExecutor | BaseChain | Runnable" @@ -447,34 +447,34 @@ { "source": "calculator_1", "sourceHandle": "calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-tools-Tool", + "target": "reactAgentChat_0", + "targetHandle": "reactAgentChat_0-input-tools-Tool", "type": "buttonedge", - "id": "calculator_1-calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain-mrklAgentChat_0-mrklAgentChat_0-input-tools-Tool" + "id": "calculator_1-calculator_1-output-calculator-Calculator|Tool|StructuredTool|BaseLangChain-reactAgentChat_0-reactAgentChat_0-input-tools-Tool" }, { "source": "RedisBackedChatMemory_0", "sourceHandle": "RedisBackedChatMemory_0-output-RedisBackedChatMemory-RedisBackedChatMemory|BaseChatMemory|BaseMemory", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-memory-BaseChatMemory", + "target": "reactAgentChat_0", + "targetHandle": "reactAgentChat_0-input-memory-BaseChatMemory", "type": "buttonedge", - "id": "RedisBackedChatMemory_0-RedisBackedChatMemory_0-output-RedisBackedChatMemory-RedisBackedChatMemory|BaseChatMemory|BaseMemory-mrklAgentChat_0-mrklAgentChat_0-input-memory-BaseChatMemory" + "id": "RedisBackedChatMemory_0-RedisBackedChatMemory_0-output-RedisBackedChatMemory-RedisBackedChatMemory|BaseChatMemory|BaseMemory-reactAgentChat_0-reactAgentChat_0-input-memory-BaseChatMemory" }, { "source": "chatOpenAI_0", "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-model-BaseChatModel", + "target": "reactAgentChat_0", + "targetHandle": "reactAgentChat_0-input-model-BaseChatModel", "type": "buttonedge", - "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-mrklAgentChat_0-mrklAgentChat_0-input-model-BaseChatModel" + "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-reactAgentChat_0-reactAgentChat_0-input-model-BaseChatModel" }, { "source": "serper_0", "sourceHandle": "serper_0-output-serper-Serper|Tool|StructuredTool|Runnable", - "target": "mrklAgentChat_0", - "targetHandle": "mrklAgentChat_0-input-tools-Tool", + "target": "reactAgentChat_0", + "targetHandle": "reactAgentChat_0-input-tools-Tool", "type": "buttonedge", - "id": "serper_0-serper_0-output-serper-Serper|Tool|StructuredTool|Runnable-mrklAgentChat_0-mrklAgentChat_0-input-tools-Tool" + "id": "serper_0-serper_0-output-serper-Serper|Tool|StructuredTool|Runnable-reactAgentChat_0-reactAgentChat_0-input-tools-Tool" } ] } diff --git a/packages/server/src/utils/getUploadsConfig.ts b/packages/server/src/utils/getUploadsConfig.ts index bbc5eedd6..13d18eb9d 100644 --- a/packages/server/src/utils/getUploadsConfig.ts +++ b/packages/server/src/utils/getUploadsConfig.ts @@ -18,8 +18,8 @@ export const utilGetUploadsConfig = async (chatflowid: string): Promise => throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Chatflow ${chatflowid} not found`) } - const uploadAllowedNodes = ['llmChain', 'conversationChain', 'mrklAgentChat', 'conversationalAgent'] - const uploadProcessingNodes = ['chatOpenAI', 'chatAnthropic', 'awsChatBedrock', 'azureChatOpenAI'] + const uploadAllowedNodes = ['llmChain', 'conversationChain', 'reactAgentChat', 'conversationalAgent', 'toolAgent'] + const uploadProcessingNodes = ['chatOpenAI', 'chatAnthropic', 'awsChatBedrock', 'azureChatOpenAI', 'chatGoogleGenerativeAI'] const flowObj = JSON.parse(chatflow.flowData) const imgUploadSizeAndTypes: IUploadFileSizeAndTypes[] = [] diff --git a/packages/server/src/utils/index.ts b/packages/server/src/utils/index.ts index 311b3b9bf..324ae4418 100644 --- a/packages/server/src/utils/index.ts +++ b/packages/server/src/utils/index.ts @@ -1022,7 +1022,9 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod 'chatOllama', 'awsChatBedrock', 'chatMistralAI', - 'groqChat' + 'groqChat', + 'chatCohere', + 'chatGoogleGenerativeAI' ], LLMs: ['azureOpenAI', 'openAI', 'ollama'] } @@ -1050,10 +1052,22 @@ export const isFlowValidForStream = (reactFlowNodes: IReactFlowNode[], endingNod 'csvAgent', 'airtableAgent', 'conversationalRetrievalAgent', - 'openAIToolAgent' + 'openAIToolAgent', + 'toolAgent' ] isValidChainOrAgent = whitelistAgents.includes(endingNodeData.name) + + // Anthropic & Groq Function Calling streaming is still not supported - https://docs.anthropic.com/claude/docs/tool-use + const model = endingNodeData.inputs?.model + if (endingNodeData.name.includes('toolAgent')) { + if (typeof model === 'string' && (model.includes('chatAnthropic') || model.includes('groqChat'))) { + return false + } else if (typeof model === 'object' && 'id' in model && model['id'].includes('chatAnthropic')) { + return false + } + } } else if (endingNodeData.category === 'Engine') { + // Engines that are available to stream const whitelistEngine = ['contextChatEngine', 'simpleChatEngine', 'queryEngine', 'subQuestionQueryEngine'] isValidChainOrAgent = whitelistEngine.includes(endingNodeData.name) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d0e4ccdb4..d158fd85c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,7 @@ onlyBuiltDependencies: overrides: '@qdrant/openapi-typescript-fetch': 1.2.1 + '@google/generative-ai': ^0.7.0 importers: .: @@ -99,7 +100,7 @@ importers: version: 8.12.2 '@getzep/zep-cloud': specifier: npm:@getzep/zep-js@next - version: /@getzep/zep-js@2.0.0-rc.4(langchain@0.1.26) + version: /@getzep/zep-js@2.0.0-rc.4(@langchain/core@0.1.57)(langchain@0.1.33) '@getzep/zep-js': specifier: ^0.9.0 version: 0.9.0 @@ -113,35 +114,41 @@ importers: specifier: ^0.2.1 version: 0.2.1 '@google/generative-ai': - specifier: ^0.1.3 - version: 0.1.3 + specifier: ^0.7.0 + version: 0.7.0 '@huggingface/inference': specifier: ^2.6.1 version: 2.6.4 '@langchain/anthropic': - specifier: ^0.1.4 - version: 0.1.5 + specifier: ^0.1.14 + version: 0.1.14 '@langchain/cohere': - specifier: ^0.0.5 - version: 0.0.5 + specifier: ^0.0.7 + version: 0.0.7 '@langchain/community': specifier: ^0.0.39 - version: 0.0.39(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(chromadb@1.8.1)(cohere-ai@6.2.2)(faiss-node@0.2.3)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13)(replicate@0.12.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) + version: 0.0.39(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(chromadb@1.8.1)(cohere-ai@6.2.2)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13)(replicate@0.18.1)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) + '@langchain/core': + specifier: ^0.1.57 + version: 0.1.57 '@langchain/google-genai': specifier: ^0.0.10 version: 0.0.10 + '@langchain/google-vertexai': + specifier: ^0.0.5 + version: 0.0.5(zod@3.22.4) '@langchain/groq': - specifier: ^0.0.2 - version: 0.0.2 + specifier: ^0.0.8 + version: 0.0.8 '@langchain/mistralai': - specifier: ^0.0.11 - version: 0.0.11 + specifier: ^0.0.18 + version: 0.0.18 '@langchain/mongodb': specifier: ^0.0.1 version: 0.0.1 '@langchain/openai': - specifier: ^0.0.14 - version: 0.0.14 + specifier: ^0.0.28 + version: 0.0.28 '@langchain/pinecone': specifier: ^0.0.3 version: 0.0.3 @@ -192,7 +199,7 @@ importers: version: 1.0.0-rc.12 chromadb: specifier: ^1.5.11 - version: 1.8.1(@google/generative-ai@0.1.3)(cohere-ai@6.2.2)(openai@4.28.4) + version: 1.8.1(@google/generative-ai@0.7.0)(cohere-ai@6.2.2)(openai@4.33.1) cohere-ai: specifier: ^6.2.0 version: 6.2.2 @@ -212,8 +219,8 @@ importers: specifier: ^4.17.3 version: 4.18.3 faiss-node: - specifier: ^0.2.2 - version: 0.2.3 + specifier: ^0.5.1 + version: 0.5.1 fast-json-patch: specifier: ^3.1.1 version: 3.1.1 @@ -239,15 +246,15 @@ importers: specifier: ^5.0.1 version: 5.0.1 langchain: - specifier: ^0.1.26 + specifier: ^0.1.33 version: >- - 0.1.26(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.2.3)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.12.3)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) + 0.1.33(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.18.1)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) langfuse: specifier: 3.3.4 version: 3.3.4 langfuse-langchain: specifier: ^3.3.4 - version: 3.3.4(langchain@0.1.26) + version: 3.3.4(langchain@0.1.33) langsmith: specifier: 0.1.6 version: 0.1.6 @@ -256,13 +263,13 @@ importers: version: 4.1.3 llamaindex: specifier: ^0.2.1 - version: 0.2.1(@google/generative-ai@0.1.3)(node-fetch@2.7.0)(typescript@4.9.5) + version: 0.2.1(@google/generative-ai@0.7.0)(node-fetch@2.7.0)(typescript@4.9.5) lodash: specifier: ^4.17.21 version: 4.17.21 lunary: specifier: ^0.6.16 - version: 0.6.16(openai@4.28.4) + version: 0.6.16(openai@4.33.1) mammoth: specifier: ^1.5.1 version: 1.7.0 @@ -288,8 +295,8 @@ importers: specifier: ^3.0.0 version: 3.0.0 openai: - specifier: ^4.16.1 - version: 4.28.4 + specifier: ^4.32.1 + version: 4.33.1 pdf-parse: specifier: ^1.1.1 version: 1.1.1 @@ -312,8 +319,8 @@ importers: specifier: ^4.6.7 version: 4.6.13 replicate: - specifier: ^0.12.3 - version: 0.12.3 + specifier: ^0.18.0 + version: 0.18.1 socket.io: specifier: ^4.6.1 version: 4.7.4 @@ -594,10 +601,10 @@ importers: version: 16.4.5 flowise-embed: specifier: latest - version: 1.2.1 + version: 1.2.2 flowise-embed-react: specifier: latest - version: 1.0.2(flowise-embed@1.2.1)(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1)(typescript@4.9.5) + version: 1.0.2(flowise-embed@1.2.2)(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1)(typescript@4.9.5) flowise-react-json-view: specifier: '*' version: 1.21.7(@types/react@18.2.65)(react-dom@18.2.0)(react@18.2.0) @@ -754,8 +761,8 @@ packages: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - /@anthropic-ai/sdk@0.15.0: - resolution: { integrity: sha512-QMNEFcwGGB64oEIL+U9b+mxSbat5TCdNxvQVV0qCNGQvg/nlnbOmq2/x/0mKhuKD0n5bioL75oCkTbQaAgyYtw== } + /@anthropic-ai/sdk@0.18.0: + resolution: { integrity: sha512-3XsWEn/4nPGRd4AdSguugbSDFy6Z2AWTNOeI3iK+aV22+w23+vY9CEb3Hiy0kvKIQuxSmZz/+5WKC8nPWy8gVg== } dependencies: '@types/node': 18.19.23 '@types/node-fetch': 2.6.11 @@ -770,14 +777,13 @@ packages: - encoding dev: false - /@anthropic-ai/sdk@0.18.0: - resolution: { integrity: sha512-3XsWEn/4nPGRd4AdSguugbSDFy6Z2AWTNOeI3iK+aV22+w23+vY9CEb3Hiy0kvKIQuxSmZz/+5WKC8nPWy8gVg== } + /@anthropic-ai/sdk@0.20.4: + resolution: { integrity: sha512-ULzz+0Smk9SNkAi1tcjJByxbt4taBhnQkRAB75iH0ku5dRwiPxGxN0WOWHoNIq22dGWBXJByrQRhVf80V4xAPA== } dependencies: '@types/node': 18.19.23 '@types/node-fetch': 2.6.11 abort-controller: 3.0.0 agentkeepalive: 4.5.0 - digest-fetch: 1.3.0 form-data-encoder: 1.7.2 formdata-node: 4.4.1 node-fetch: 2.7.0 @@ -4225,7 +4231,7 @@ packages: typescript: 5.4.2 dev: false - /@getzep/zep-js@2.0.0-rc.4(langchain@0.1.26): + /@getzep/zep-js@2.0.0-rc.4(@langchain/core@0.1.57)(langchain@0.1.33): resolution: { integrity: sha512-QzL2UpeTCHDLa1K+EHfrrFdXa0vVrr5+xHNrn+Gn8u9nQfWqs+Tlfti+x2Ek1pg+Aut0RQC6YYOeez7UPDDvcQ== } engines: { node: '>=18.0.0' } peerDependencies: @@ -4237,9 +4243,10 @@ packages: langchain: optional: true dependencies: + '@langchain/core': 0.1.57 '@supercharge/promise-pool': 3.1.1 langchain: >- - 0.1.26(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.2.3)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.12.3)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) + 0.1.33(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.18.1)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) semver: 7.6.0 typescript: 5.4.2 dev: false @@ -4289,8 +4296,8 @@ packages: - supports-color dev: false - /@google/generative-ai@0.1.3: - resolution: { integrity: sha512-Cm4uJX1sKarpm1mje/MiOIinM7zdUUrQp/5/qGPAgznbdd/B9zup5ehT6c1qGqycFcSopTA1J1HpqHS5kJR8hQ== } + /@google/generative-ai@0.7.0: + resolution: { integrity: sha512-+1kNkKbkDJftrvwfULQphkyC2ZQ42exlyR+TFARMuykuu6y8XyevbX0dDarqt1GVpZDm55yg0TBq6I1J65X6OA== } engines: { node: '>=18.0.0' } dev: false @@ -4814,12 +4821,12 @@ packages: - typescript dev: false - /@langchain/anthropic@0.1.5: - resolution: { integrity: sha512-Hp0kwcsxjG3JT+Pt0zGqHf/GGT/t1mE0oHIJDv1A0xMTFhSNdAiYrPQxfMMU/y4RehNCSIOw7/PeMxBTY0ew0Q== } + /@langchain/anthropic@0.1.14: + resolution: { integrity: sha512-7wkBVT0FiuuM6YovDivJmVxLppRul6ID+lQqJPDLrkp0tdEE2yjDvdlrYQJ9thlJ7d4XNV3B95wqXgG3CO8QHQ== } engines: { node: '>=18' } dependencies: - '@anthropic-ai/sdk': 0.15.0 - '@langchain/core': 0.1.44 + '@anthropic-ai/sdk': 0.20.4 + '@langchain/core': 0.1.57 fast-xml-parser: 4.3.5 zod: 3.22.4 zod-to-json-schema: 3.22.4(zod@3.22.4) @@ -4827,17 +4834,17 @@ packages: - encoding dev: false - /@langchain/cohere@0.0.5: - resolution: { integrity: sha512-4q6dHZ6XCk5NIrLBzxedNGwlmj7cROVvAtSnCaDsLKVKX2cgTUxjiSKAtzjX39RqHwCsdt919ZRdL/X15AQK/w== } + /@langchain/cohere@0.0.7: + resolution: { integrity: sha512-ICSrSOT6FzSbR+xnbkP6BxXhuom1ViPRiy8K8KrL6bHbTiR5v1UnpskTWRpyhQS1GA6+3t1gp7XHxB5CZzLyqQ== } engines: { node: '>=18' } dependencies: - '@langchain/core': 0.1.44 - cohere-ai: 7.7.7 + '@langchain/core': 0.1.57 + cohere-ai: 7.9.3 transitivePeerDependencies: - encoding dev: false - /@langchain/community@0.0.39(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(chromadb@1.8.1)(cohere-ai@6.2.2)(faiss-node@0.2.3)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13)(replicate@0.12.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0): + /@langchain/community@0.0.39(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(chromadb@1.8.1)(cohere-ai@6.2.2)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13)(replicate@0.18.1)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0): resolution: { integrity: sha512-M9JzQ2dgnAkTTy90C+0+eiZ/BKvzq3KEuLH0tw+CNdFAMLc/f3c0Zj7esuPUisgISDAhESvGWJ0vDEJkkJR0zw== } engines: { node: '>=18' } peerDependencies: @@ -5109,17 +5116,17 @@ packages: '@gomomento/sdk-core': 1.68.1 '@google-ai/generativelanguage': 0.2.1 '@huggingface/inference': 2.6.4 - '@langchain/core': 0.1.44 - '@langchain/openai': 0.0.19 + '@langchain/core': 0.1.57 + '@langchain/openai': 0.0.28 '@opensearch-project/opensearch': 1.2.0 '@pinecone-database/pinecone': 2.1.0 '@qdrant/js-client-rest': 1.8.1(typescript@4.9.5) '@supabase/supabase-js': 2.39.8 '@upstash/redis': 1.22.1 '@zilliz/milvus2-sdk-node': 2.3.5 - chromadb: 1.8.1(@google/generative-ai@0.1.3)(cohere-ai@6.2.2)(openai@4.28.4) + chromadb: 1.8.1(@google/generative-ai@0.7.0)(cohere-ai@6.2.2)(openai@4.33.1) cohere-ai: 6.2.2 - faiss-node: 0.2.3 + faiss-node: 0.5.1 flat: 5.0.2 google-auth-library: 9.6.3 html-to-text: 9.0.5 @@ -5127,12 +5134,12 @@ packages: jsdom: 22.1.0 langsmith: 0.1.6 lodash: 4.17.21 - lunary: 0.6.16(openai@4.28.4) + lunary: 0.6.16(openai@4.33.1) mongodb: 6.3.0 mysql2: 3.9.2 pg: 8.11.3 redis: 4.6.13 - replicate: 0.12.3 + replicate: 0.18.1 typeorm: 0.3.20(ioredis@5.3.2)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13) uuid: 9.0.1 weaviate-ts-client: 1.6.0(graphql@16.8.1) @@ -5142,8 +5149,333 @@ packages: - encoding dev: false - /@langchain/core@0.1.44: - resolution: { integrity: sha512-6kzRRf8X1TgkAfc8xOZ1qCHalasPDxdcNLnL++ZCGtWLyiKMFP7HcDwG/UewYsbqQd3sTQUPiP9+PHdPWXHd/Q== } + /@langchain/community@0.0.48(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(chromadb@1.8.1)(cohere-ai@6.2.2)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13)(replicate@0.18.1)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0): + resolution: { integrity: sha512-jG7dpJkgKtwbrSLsxW4mXmECopTj5tRt4+B+QcKCqZm7yEghFR44Xj5OkDWtzzsjpL47RJck5AJ8MsQnmi7WDQ== } + engines: { node: '>=18' } + peerDependencies: + '@aws-crypto/sha256-js': ^5.0.0 + '@aws-sdk/client-bedrock-agent-runtime': ^3.485.0 + '@aws-sdk/client-bedrock-runtime': ^3.422.0 + '@aws-sdk/client-dynamodb': ^3.310.0 + '@aws-sdk/client-kendra': ^3.352.0 + '@aws-sdk/client-lambda': ^3.310.0 + '@aws-sdk/client-sagemaker-runtime': ^3.310.0 + '@aws-sdk/client-sfn': ^3.310.0 + '@aws-sdk/credential-provider-node': ^3.388.0 + '@azure/search-documents': ^12.0.0 + '@clickhouse/client': ^0.2.5 + '@cloudflare/ai': '*' + '@datastax/astra-db-ts': ^1.0.0 + '@elastic/elasticsearch': ^8.4.0 + '@getmetal/metal-sdk': '*' + '@getzep/zep-js': ^0.9.0 + '@gomomento/sdk': ^1.51.1 + '@gomomento/sdk-core': ^1.51.1 + '@google-ai/generativelanguage': ^0.2.1 + '@gradientai/nodejs-sdk': ^1.2.0 + '@huggingface/inference': ^2.6.4 + '@mozilla/readability': '*' + '@opensearch-project/opensearch': '*' + '@pinecone-database/pinecone': '*' + '@planetscale/database': ^1.8.0 + '@premai/prem-sdk': ^0.3.25 + '@qdrant/js-client-rest': ^1.2.0 + '@raycast/api': ^1.55.2 + '@rockset/client': ^0.9.1 + '@smithy/eventstream-codec': ^2.0.5 + '@smithy/protocol-http': ^3.0.6 + '@smithy/signature-v4': ^2.0.10 + '@smithy/util-utf8': ^2.0.0 + '@supabase/postgrest-js': ^1.1.1 + '@supabase/supabase-js': ^2.10.0 + '@tensorflow-models/universal-sentence-encoder': '*' + '@tensorflow/tfjs-converter': '*' + '@tensorflow/tfjs-core': '*' + '@upstash/redis': ^1.20.6 + '@upstash/vector': ^1.0.2 + '@vercel/kv': ^0.2.3 + '@vercel/postgres': ^0.5.0 + '@writerai/writer-sdk': ^0.40.2 + '@xata.io/client': ^0.28.0 + '@xenova/transformers': ^2.5.4 + '@zilliz/milvus2-sdk-node': '>=2.2.7' + better-sqlite3: ^9.4.0 + cassandra-driver: ^4.7.2 + cborg: ^4.1.1 + chromadb: '*' + closevector-common: 0.1.3 + closevector-node: 0.1.6 + closevector-web: 0.1.6 + cohere-ai: '*' + convex: ^1.3.1 + couchbase: ^4.3.0 + discord.js: ^14.14.1 + dria: ^0.0.3 + duck-duck-scrape: ^2.2.5 + faiss-node: ^0.5.1 + firebase-admin: ^11.9.0 || ^12.0.0 + google-auth-library: ^8.9.0 + googleapis: ^126.0.1 + hnswlib-node: ^1.4.2 + html-to-text: ^9.0.5 + interface-datastore: ^8.2.11 + ioredis: ^5.3.2 + it-all: ^3.0.4 + jsdom: '*' + jsonwebtoken: ^9.0.2 + llmonitor: ^0.5.9 + lodash: ^4.17.21 + lunary: ^0.6.11 + mongodb: '>=5.2.0' + mysql2: ^3.3.3 + neo4j-driver: '*' + node-llama-cpp: '*' + pg: ^8.11.0 + pg-copy-streams: ^6.0.5 + pickleparser: ^0.2.1 + portkey-ai: ^0.1.11 + redis: '*' + replicate: ^0.18.0 + typeorm: ^0.3.12 + typesense: ^1.5.3 + usearch: ^1.1.1 + vectordb: ^0.1.4 + voy-search: 0.6.2 + weaviate-ts-client: '*' + web-auth-library: ^1.0.3 + ws: ^8.14.2 + peerDependenciesMeta: + '@aws-crypto/sha256-js': + optional: true + '@aws-sdk/client-bedrock-agent-runtime': + optional: true + '@aws-sdk/client-bedrock-runtime': + optional: true + '@aws-sdk/client-dynamodb': + optional: true + '@aws-sdk/client-kendra': + optional: true + '@aws-sdk/client-lambda': + optional: true + '@aws-sdk/client-sagemaker-runtime': + optional: true + '@aws-sdk/client-sfn': + optional: true + '@aws-sdk/credential-provider-node': + optional: true + '@azure/search-documents': + optional: true + '@clickhouse/client': + optional: true + '@cloudflare/ai': + optional: true + '@datastax/astra-db-ts': + optional: true + '@elastic/elasticsearch': + optional: true + '@getmetal/metal-sdk': + optional: true + '@getzep/zep-js': + optional: true + '@gomomento/sdk': + optional: true + '@gomomento/sdk-core': + optional: true + '@google-ai/generativelanguage': + optional: true + '@gradientai/nodejs-sdk': + optional: true + '@huggingface/inference': + optional: true + '@mozilla/readability': + optional: true + '@opensearch-project/opensearch': + optional: true + '@pinecone-database/pinecone': + optional: true + '@planetscale/database': + optional: true + '@premai/prem-sdk': + optional: true + '@qdrant/js-client-rest': + optional: true + '@raycast/api': + optional: true + '@rockset/client': + optional: true + '@smithy/eventstream-codec': + optional: true + '@smithy/protocol-http': + optional: true + '@smithy/signature-v4': + optional: true + '@smithy/util-utf8': + optional: true + '@supabase/postgrest-js': + optional: true + '@supabase/supabase-js': + optional: true + '@tensorflow-models/universal-sentence-encoder': + optional: true + '@tensorflow/tfjs-converter': + optional: true + '@tensorflow/tfjs-core': + optional: true + '@upstash/redis': + optional: true + '@upstash/vector': + optional: true + '@vercel/kv': + optional: true + '@vercel/postgres': + optional: true + '@writerai/writer-sdk': + optional: true + '@xata.io/client': + optional: true + '@xenova/transformers': + optional: true + '@zilliz/milvus2-sdk-node': + optional: true + better-sqlite3: + optional: true + cassandra-driver: + optional: true + cborg: + optional: true + chromadb: + optional: true + closevector-common: + optional: true + closevector-node: + optional: true + closevector-web: + optional: true + cohere-ai: + optional: true + convex: + optional: true + couchbase: + optional: true + discord.js: + optional: true + dria: + optional: true + duck-duck-scrape: + optional: true + faiss-node: + optional: true + firebase-admin: + optional: true + google-auth-library: + optional: true + googleapis: + optional: true + hnswlib-node: + optional: true + html-to-text: + optional: true + interface-datastore: + optional: true + ioredis: + optional: true + it-all: + optional: true + jsdom: + optional: true + jsonwebtoken: + optional: true + llmonitor: + optional: true + lodash: + optional: true + lunary: + optional: true + mongodb: + optional: true + mysql2: + optional: true + neo4j-driver: + optional: true + node-llama-cpp: + optional: true + pg: + optional: true + pg-copy-streams: + optional: true + pickleparser: + optional: true + portkey-ai: + optional: true + redis: + optional: true + replicate: + optional: true + typeorm: + optional: true + typesense: + optional: true + usearch: + optional: true + vectordb: + optional: true + voy-search: + optional: true + weaviate-ts-client: + optional: true + web-auth-library: + optional: true + ws: + optional: true + dependencies: + '@aws-crypto/sha256-js': 5.2.0 + '@aws-sdk/client-bedrock-runtime': 3.422.0 + '@aws-sdk/client-dynamodb': 3.529.1 + '@aws-sdk/credential-provider-node': 3.529.1 + '@datastax/astra-db-ts': 0.1.4 + '@elastic/elasticsearch': 8.12.2 + '@getzep/zep-js': 0.9.0 + '@gomomento/sdk': 1.68.1 + '@gomomento/sdk-core': 1.68.1 + '@google-ai/generativelanguage': 0.2.1 + '@huggingface/inference': 2.6.4 + '@langchain/core': 0.1.57 + '@langchain/openai': 0.0.28 + '@opensearch-project/opensearch': 1.2.0 + '@pinecone-database/pinecone': 2.1.0 + '@qdrant/js-client-rest': 1.8.1(typescript@4.9.5) + '@supabase/supabase-js': 2.39.8 + '@upstash/redis': 1.22.1 + '@zilliz/milvus2-sdk-node': 2.3.5 + chromadb: 1.8.1(@google/generative-ai@0.7.0)(cohere-ai@6.2.2)(openai@4.33.1) + cohere-ai: 6.2.2 + expr-eval: 2.0.2 + faiss-node: 0.5.1 + flat: 5.0.2 + google-auth-library: 9.6.3 + html-to-text: 9.0.5 + ioredis: 5.3.2 + jsdom: 22.1.0 + langsmith: 0.1.6 + lodash: 4.17.21 + lunary: 0.6.16(openai@4.33.1) + mongodb: 6.3.0 + mysql2: 3.9.2 + pg: 8.11.3 + redis: 4.6.13 + replicate: 0.18.1 + typeorm: 0.3.20(ioredis@5.3.2)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13) + uuid: 9.0.1 + weaviate-ts-client: 1.6.0(graphql@16.8.1) + ws: 8.16.0 + zod: 3.22.4 + zod-to-json-schema: 3.22.5(zod@3.22.4) + transitivePeerDependencies: + - encoding + dev: false + + /@langchain/core@0.1.57: + resolution: { integrity: sha512-6wOwidPkkRcANrOKl88+YYpm3jHfpg6W8EqZHQCImSAlxdEhyDSq2eeQKHOPCFCrfNWkClaNn+Wlzzz4Qwf9Tg== } engines: { node: '>=18' } dependencies: ansi-styles: 5.2.0 @@ -5159,31 +5491,70 @@ packages: zod-to-json-schema: 3.22.4(zod@3.22.4) dev: false + /@langchain/google-common@0.0.9(zod@3.22.4): + resolution: { integrity: sha512-jP7vIgsigUSYYVyT5hej4rg8fV8sutxI6Vm2B2xQGNwUXiCQIDPfA9bmlGyXPWomILKB21dRUqNkun/AMYAWvA== } + engines: { node: '>=18' } + dependencies: + '@langchain/core': 0.1.57 + uuid: 9.0.1 + zod-to-json-schema: 3.22.5(zod@3.22.4) + transitivePeerDependencies: + - zod + dev: false + + /@langchain/google-gauth@0.0.5(zod@3.22.4): + resolution: { integrity: sha512-kSMqFnNcoRA5yq4WMbqh4OwRNnV/yJ9+U+tppBeL4rwFyrWSTPDxqnIQ0yJz72khu7hzfoxKag+GUiGGSTNiVQ== } + engines: { node: '>=18' } + dependencies: + '@langchain/core': 0.1.57 + '@langchain/google-common': 0.0.9(zod@3.22.4) + google-auth-library: 8.9.0 + transitivePeerDependencies: + - encoding + - supports-color + - zod + dev: false + /@langchain/google-genai@0.0.10: resolution: { integrity: sha512-neFuCoMew9t8IYM5srh6RVUFQsZxqPtAFVJ0mWtZqHXtb627MECs5FYr+xw1ptPKSbhIAN5H8sgdObqes4bN3A== } engines: { node: '>=18' } dependencies: - '@google/generative-ai': 0.1.3 - '@langchain/core': 0.1.44 + '@google/generative-ai': 0.7.0 + '@langchain/core': 0.1.57 dev: false - /@langchain/groq@0.0.2: - resolution: { integrity: sha512-8YkOcelID0MJHhWnPPO03/jVqkc8yjo1x8z0d3gqS+PywsCwf4gddzfiDCewIWRSAMDgQkUW4hSKp3l2ZGViig== } + /@langchain/google-vertexai@0.0.5(zod@3.22.4): + resolution: { integrity: sha512-prtF/lo0I0KQligTdSH1UJA1jSlqHco6UbQ19RrwkNq9N6cnB5SE25a0qTrvZygf6+VEI9qMBw1y0UMQUGpHMQ== } engines: { node: '>=18' } dependencies: - '@langchain/core': 0.1.44 - '@langchain/openai': 0.0.14 + '@langchain/core': 0.1.57 + '@langchain/google-gauth': 0.0.5(zod@3.22.4) + transitivePeerDependencies: + - encoding + - supports-color + - zod + dev: false + + /@langchain/groq@0.0.8: + resolution: { integrity: sha512-xqbe35K+12fiYtC/uqkaTT4AXxqL5uvhCrHzc+nBoFkTwM6YfTFE1ch95RZ5G2JnK1U9pKAre/trUSzlU1/6Kg== } + engines: { node: '>=18' } + dependencies: + '@langchain/core': 0.1.57 + '@langchain/openai': 0.0.28 groq-sdk: 0.3.2 + zod: 3.22.4 + zod-to-json-schema: 3.22.5(zod@3.22.4) transitivePeerDependencies: - encoding dev: false - /@langchain/mistralai@0.0.11: - resolution: { integrity: sha512-Vtfmi7+K2Y9XTrdz/9p6mqiotcSAsZsUr4eatkyh5a6aCi2pcp9TwWbrPe6QSZG5K7Fy2SnDbMLHZeD2TttJYA== } + /@langchain/mistralai@0.0.18: + resolution: { integrity: sha512-9xjQQEF90A5tYPQCvNjj9vaJMJ+oP7/cvr0UTx0p/uKvbyS+3WyMFbVRmJgHUw5ERm2j8HYfES8ZyUiJTfFJUw== } engines: { node: '>=18' } dependencies: - '@langchain/core': 0.1.44 + '@langchain/core': 0.1.57 '@mistralai/mistralai': 0.1.3 + uuid: 9.0.1 zod: 3.22.4 zod-to-json-schema: 3.22.4(zod@3.22.4) transitivePeerDependencies: @@ -5194,7 +5565,7 @@ packages: resolution: { integrity: sha512-5CWh73s7D9/WraXcZJTqc6VRkITNe71G4uXBO/KwtE1E/7DlYT8EvWzX6Er+HvVp1EsBGlcJGUp9St/lvbfrPg== } engines: { node: '>=18' } dependencies: - '@langchain/core': 0.1.44 + '@langchain/core': 0.1.57 mongodb: 6.3.0 transitivePeerDependencies: - '@aws-sdk/credential-providers' @@ -5206,26 +5577,13 @@ packages: - socks dev: false - /@langchain/openai@0.0.14: - resolution: { integrity: sha512-co6nRylPrLGY/C3JYxhHt6cxLq07P086O7K3QaZH7SFFErIN9wSzJonpvhZR07DEUq6eK6wKgh2ORxA/NcjSRQ== } + /@langchain/openai@0.0.28: + resolution: { integrity: sha512-2s1RA3/eAnz4ahdzsMPBna9hfAqpFNlWdHiPxVGZ5yrhXsbLWWoPcF+22LCk9t0HJKtazi2GCIWc0HVXH9Abig== } engines: { node: '>=18' } dependencies: - '@langchain/core': 0.1.44 + '@langchain/core': 0.1.57 js-tiktoken: 1.0.10 - openai: 4.28.4 - zod: 3.22.4 - zod-to-json-schema: 3.22.4(zod@3.22.4) - transitivePeerDependencies: - - encoding - dev: false - - /@langchain/openai@0.0.19: - resolution: { integrity: sha512-b1CHZCNVc2u4LZbFc1Ls0T7U4LWNGvMeQsrNidLZT5jbjg6VzzDZuVCDPGqCwUc8bzFWvPBO52oT1Wy+aCOX6w== } - engines: { node: '>=18' } - dependencies: - '@langchain/core': 0.1.44 - js-tiktoken: 1.0.10 - openai: 4.28.4 + openai: 4.33.1 zod: 3.22.4 zod-to-json-schema: 3.22.4(zod@3.22.4) transitivePeerDependencies: @@ -5236,7 +5594,7 @@ packages: resolution: { integrity: sha512-uhmGdiF6OLL583kQNMdKl799+3E1nQphrZ4a/Y/yQcXKUPVNZYwNLUimK1ws80RBhfqR7DKvywkvERoOsvCDlA== } engines: { node: '>=18' } dependencies: - '@langchain/core': 0.1.44 + '@langchain/core': 0.1.57 '@pinecone-database/pinecone': 2.1.0 flat: 5.0.2 uuid: 9.0.1 @@ -5246,7 +5604,7 @@ packages: resolution: { integrity: sha512-Lf6zgTf6i/fsPNlkDxPRLA3LEz2Wwgk6LNe54dByt0oZM4W+N4n5n/gDwojsXAKNEF5alXUv2N6yAOcUuXSbxg== } engines: { node: '>=18' } dependencies: - '@langchain/core': 0.1.44 + '@langchain/core': 0.1.57 uuid: 9.0.1 weaviate-ts-client: 2.1.1(graphql@16.8.1) transitivePeerDependencies: @@ -11310,7 +11668,7 @@ packages: resolution: { integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== } engines: { node: '>=10' } - /chromadb@1.7.3(@google/generative-ai@0.1.3)(cohere-ai@7.7.7)(openai@4.28.4): + /chromadb@1.7.3(@google/generative-ai@0.7.0)(cohere-ai@7.7.7)(openai@4.33.1): resolution: { integrity: sha512-3GgvQjpqgk5C89x5EuTDaXKbfrdqYDJ5UVyLQ3ZmwxnpetNc+HhRDGjkvXa5KSvpQ3lmKoyDoqnN4tZepfFkbw== } engines: { node: '>=14.17.0' } peerDependencies: @@ -11325,16 +11683,16 @@ packages: openai: optional: true dependencies: - '@google/generative-ai': 0.1.3 + '@google/generative-ai': 0.7.0 cliui: 8.0.1 cohere-ai: 7.7.7 isomorphic-fetch: 3.0.0 - openai: 4.28.4 + openai: 4.33.1 transitivePeerDependencies: - encoding dev: false - /chromadb@1.8.1(@google/generative-ai@0.1.3)(cohere-ai@6.2.2)(openai@4.28.4): + /chromadb@1.8.1(@google/generative-ai@0.7.0)(cohere-ai@6.2.2)(openai@4.33.1): resolution: { integrity: sha512-NpbYydbg4Uqt/9BXKgkZXn0fqpsh2Z1yjhkhKH+rcHMoq0pwI18BFSU2QU7Fk/ZypwGefW2AvqyE/3ZJIgy4QA== } engines: { node: '>=14.17.0' } peerDependencies: @@ -11349,11 +11707,11 @@ packages: openai: optional: true dependencies: - '@google/generative-ai': 0.1.3 + '@google/generative-ai': 0.7.0 cliui: 8.0.1 cohere-ai: 6.2.2 isomorphic-fetch: 3.0.0 - openai: 4.28.4 + openai: 4.33.1 transitivePeerDependencies: - encoding dev: false @@ -11657,6 +12015,18 @@ packages: - encoding dev: false + /cohere-ai@7.9.3: + resolution: { integrity: sha512-DcZ6B9Fa1yaFFkZ3+HO/aE4R97m08cZs/ww7YpfEcTatAljznmnXtaFKRMP57olLMGKmYA/oHpkUqh/Vt4kvFA== } + dependencies: + form-data: 4.0.0 + js-base64: 3.7.2 + node-fetch: 2.7.0 + qs: 6.11.2 + url-join: 4.0.1 + transitivePeerDependencies: + - encoding + dev: false + /collect-v8-coverage@1.0.2: resolution: { integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== } dev: true @@ -12976,6 +13346,11 @@ packages: - supports-color dev: true + /device-detector-js@3.0.3: + resolution: { integrity: sha512-jM89LJAvP6uOd84at8OlD9dWP8KeYCCHUde0RT0HQo/stdoRH4b54Xl/fntx2nEXCmqiFhmo+/cJetS2VGUHPw== } + engines: { node: '>= 8.11.4' } + dev: false + /devlop@1.1.0: resolution: { integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA== } dependencies: @@ -14604,8 +14979,8 @@ packages: engines: { '0': node >=0.6.0 } dev: true - /faiss-node@0.2.3: - resolution: { integrity: sha512-HfGhKFjyXPIyAlatcBNjv66q5ZQ43xfIpv8Uc17mIbEye7gbrmzVqAy+OxdlRy0usuLni+Dk1vSXf/z2yyr1Dg== } + /faiss-node@0.5.1: + resolution: { integrity: sha512-zD8wobJn8C6OLWo68Unho+Ih8l6nSRB2w3Amj01a+xc4bsEvd2mBDLklAn7VocA9XO3WDvQL/bLpi5flkCn/XQ== } engines: { node: '>= 14.0.0' } requiresBuild: true dependencies: @@ -15047,14 +15422,14 @@ packages: resolution: { integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== } dev: true - /flowise-embed-react@1.0.2(flowise-embed@1.2.1)(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1)(typescript@4.9.5): + /flowise-embed-react@1.0.2(flowise-embed@1.2.2)(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1)(typescript@4.9.5): resolution: { integrity: sha512-M6rDofJWTWI9rtZN7G3oTlqAcQaHoF/IUIoW1YitHsjKly24awq5sky+0Wfkcg4VfoXz3SiLHMZ/XOF4PDuvqA== } peerDependencies: flowise-embed: '*' react: 18.x dependencies: '@ladle/react': 2.5.1(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1)(typescript@4.9.5) - flowise-embed: 1.2.1 + flowise-embed: 1.2.2 react: 18.2.0 transitivePeerDependencies: - '@types/node' @@ -15069,11 +15444,12 @@ packages: - typescript dev: false - /flowise-embed@1.2.1: - resolution: { integrity: sha512-sn8An0dseo398RXx/yzQ3lC//+FpY5o/094yaWZs3NmYy6am+duCZJ18lhcYF5A4oCucrIoZCcCz5mxViYtznw== } + /flowise-embed@1.2.2: + resolution: { integrity: sha512-9LBOnkdUyeFbm7ntsE9h09+g/pLinMxOk3AXGMmRYG5IO/YA8wsdd0/iZPvXbBSey7QnV53twRaM6cJD8XqLcQ== } dependencies: '@babel/core': 7.24.0 '@ts-stack/markdown': 1.5.0 + device-detector-js: 3.0.3 lodash: 4.17.21 prettier: 3.2.5 socket.io-client: 4.7.4 @@ -18838,8 +19214,8 @@ packages: resolution: { integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A== } dev: false - /langchain@0.1.26(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.2.3)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.12.3)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0): - resolution: { integrity: sha512-2hCXDev/KkBKNHCrxqq7XQxAp/kpjMtwlIuKBzaSW8gM+BOrh8q6B9PM3ItbvG4s29JCW7xlJtIEO3LaWChwkQ== } + /langchain@0.1.33(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.18.1)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0): + resolution: { integrity: sha512-IrRd839x8eAmDutHNDMHGzIjufyWt/ckJrnRB2WifIJmtLWNRNQo5jZd7toeBU0UOVOQxoPtQGYf8lR0ar7vIQ== } engines: { node: '>=18' } peerDependencies: '@aws-sdk/client-s3': ^3.310.0 @@ -18863,7 +19239,7 @@ packages: cheerio: ^1.0.0-rc.12 chromadb: '*' convex: ^1.3.1 - couchbase: ^4.2.10 + couchbase: ^4.3.0 d3-dsv: ^2.0.0 epub2: ^3.0.1 faiss-node: '*' @@ -19003,9 +19379,9 @@ packages: '@gomomento/sdk': 1.68.1 '@gomomento/sdk-core': 1.68.1 '@google-ai/generativelanguage': 0.2.1 - '@langchain/community': 0.0.39(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(chromadb@1.8.1)(cohere-ai@6.2.2)(faiss-node@0.2.3)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13)(replicate@0.12.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) - '@langchain/core': 0.1.44 - '@langchain/openai': 0.0.19 + '@langchain/community': 0.0.48(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(chromadb@1.8.1)(cohere-ai@6.2.2)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mongodb@6.3.0)(mysql2@3.9.2)(pg@8.11.3)(redis@4.6.13)(replicate@0.18.1)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) + '@langchain/core': 0.1.57 + '@langchain/openai': 0.0.28 '@notionhq/client': 2.2.14 '@pinecone-database/pinecone': 2.1.0 '@supabase/supabase-js': 2.39.8 @@ -19014,10 +19390,9 @@ packages: axios: 1.6.2 binary-extensions: 2.2.0 cheerio: 1.0.0-rc.12 - chromadb: 1.8.1(@google/generative-ai@0.1.3)(cohere-ai@6.2.2)(openai@4.28.4) + chromadb: 1.8.1(@google/generative-ai@0.7.0)(cohere-ai@6.2.2)(openai@4.33.1) d3-dsv: 2.0.0 - expr-eval: 2.0.2 - faiss-node: 0.2.3 + faiss-node: 0.5.1 google-auth-library: 9.6.3 html-to-text: 9.0.5 ioredis: 5.3.2 @@ -19065,6 +19440,7 @@ packages: - '@mozilla/readability' - '@opensearch-project/opensearch' - '@planetscale/database' + - '@premai/prem-sdk' - '@qdrant/js-client-rest' - '@raycast/api' - '@rockset/client' @@ -19084,16 +19460,20 @@ packages: - '@zilliz/milvus2-sdk-node' - better-sqlite3 - cassandra-driver + - cborg - closevector-common - closevector-node - closevector-web - cohere-ai - discord.js - dria + - duck-duck-scrape - encoding - firebase-admin - googleapis - hnswlib-node + - interface-datastore + - it-all - jsonwebtoken - llmonitor - lodash @@ -19122,14 +19502,14 @@ packages: mustache: 4.2.0 dev: false - /langfuse-langchain@3.3.4(langchain@0.1.26): + /langfuse-langchain@3.3.4(langchain@0.1.33): resolution: { integrity: sha512-J936Rj+uKLC8DdaZ8d3D1SbRsyOKh/vnmhhsctHAl2PVnJI2sRKHqK2hyoP4NGb8H8dsah9kU3t5Ng86RaJlKg== } engines: { node: '>=18' } peerDependencies: langchain: '>=0.0.157 <0.2.0' dependencies: langchain: >- - 0.1.26(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.2.3)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.12.3)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) + 0.1.33(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-bedrock-runtime@3.422.0)(@aws-sdk/client-dynamodb@3.529.1)(@aws-sdk/client-s3@3.529.1)(@aws-sdk/credential-provider-node@3.529.1)(@datastax/astra-db-ts@0.1.4)(@elastic/elasticsearch@8.12.2)(@getzep/zep-js@0.9.0)(@gomomento/sdk-core@1.68.1)(@gomomento/sdk@1.68.1)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@notionhq/client@2.2.14)(@opensearch-project/opensearch@1.2.0)(@pinecone-database/pinecone@2.1.0)(@qdrant/js-client-rest@1.8.1)(@supabase/supabase-js@2.39.8)(@upstash/redis@1.22.1)(@zilliz/milvus2-sdk-node@2.3.5)(apify-client@2.9.3)(assemblyai@4.3.2)(axios@1.6.2)(cheerio@1.0.0-rc.12)(chromadb@1.8.1)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(faiss-node@0.5.1)(google-auth-library@9.6.3)(html-to-text@9.0.5)(ioredis@5.3.2)(jsdom@22.1.0)(lodash@4.17.21)(lunary@0.6.16)(mammoth@1.7.0)(mongodb@6.3.0)(mysql2@3.9.2)(notion-to-md@3.1.1)(pdf-parse@1.1.1)(pg@8.11.3)(playwright@1.42.1)(puppeteer@20.9.0)(pyodide@0.25.0)(redis@4.6.13)(replicate@0.18.1)(srt-parser-2@1.2.3)(typeorm@0.3.20)(weaviate-ts-client@1.6.0)(ws@8.16.0) langfuse: 3.3.4 langfuse-core: 3.3.4 dev: false @@ -19366,7 +19746,7 @@ packages: wrap-ansi: 8.1.0 dev: true - /llamaindex@0.2.1(@google/generative-ai@0.1.3)(node-fetch@2.7.0)(typescript@4.9.5): + /llamaindex@0.2.1(@google/generative-ai@0.7.0)(node-fetch@2.7.0)(typescript@4.9.5): resolution: { integrity: sha512-p1dg3o4zveFCTjYwWJmsww8Mvnh2feHlNEo0x85XwbDZoZ35zCWxc1Rep55duyAirguqLpIwT1UTacVBxSm+8A== } engines: { node: '>=18.0.0' } dependencies: @@ -19387,7 +19767,7 @@ packages: '@xenova/transformers': 2.16.0 '@zilliz/milvus2-sdk-node': 2.3.5 assemblyai: 4.3.2 - chromadb: 1.7.3(@google/generative-ai@0.1.3)(cohere-ai@7.7.7)(openai@4.28.4) + chromadb: 1.7.3(@google/generative-ai@0.7.0)(cohere-ai@7.7.7)(openai@4.33.1) cohere-ai: 7.7.7 js-tiktoken: 1.0.10 lodash: 4.17.21 @@ -19396,7 +19776,7 @@ packages: md-utils-ts: 2.0.0 mongodb: 6.3.0 notion-md-crawler: 0.0.2 - openai: 4.28.4 + openai: 4.33.1 papaparse: 5.4.1 pathe: 1.1.2 pdf2json: 3.0.5 @@ -19914,7 +20294,7 @@ packages: engines: { node: 14 || >=16.14 } dev: false - /lunary@0.6.16(openai@4.28.4): + /lunary@0.6.16(openai@4.33.1): resolution: { integrity: sha512-LVuABIuZxtxN55zLdRQjXG01S0wQ8U2Psd0/7z+wxK3L2tx6jFk3XIGsRXjXEgcwMAI7KQDrkoGIwtsHmhRcDQ== } peerDependencies: openai: ^4.0.0 @@ -19925,7 +20305,7 @@ packages: react: optional: true dependencies: - openai: 4.28.4 + openai: 4.33.1 unctx: 2.3.1 update: 0.7.4 transitivePeerDependencies: @@ -22173,6 +22553,22 @@ packages: - encoding dev: false + /openai@4.33.1: + resolution: { integrity: sha512-0DH572aSxGTT1JPOXgJQ9mjiuSPg/7scPot8hLc5I1mfQxPxLXTZWJpWerKaIWOuPkR2nrB0SamGDEehH8RuWA== } + hasBin: true + dependencies: + '@types/node': 18.19.23 + '@types/node-fetch': 2.6.11 + abort-controller: 3.0.0 + agentkeepalive: 4.5.0 + form-data-encoder: 1.7.2 + formdata-node: 4.4.1 + node-fetch: 2.7.0 + web-streams-polyfill: 3.3.3 + transitivePeerDependencies: + - encoding + dev: false + /openapi-types@12.1.3: resolution: { integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw== } dev: false @@ -25474,9 +25870,9 @@ packages: remove-trailing-separator: 1.1.0 dev: true - /replicate@0.12.3: - resolution: { integrity: sha512-HVWKPoVhWVTONlWk+lUXmq9Vy2J8MxBJMtDBQq3dA5uq71ZzKTh0xvJfvzW4+VLBjhBeL7tkdua6hZJmKfzAPQ== } - engines: { git: '>=2.11.0', node: '>=16.6.0', npm: '>=7.19.0', yarn: '>=1.7.0' } + /replicate@0.18.1: + resolution: { integrity: sha512-JFK5qWL7AAajsIjtkW/nTaoX+yKp8zkaANe+pQpBh9RjH5vIy6/tn/sVNlRF1z5bCJLupshJBHFgnHRdWjbKXg== } + engines: { git: '>=2.11.0', node: '>=18.0.0', npm: '>=7.19.0', yarn: '>=1.7.0' } dev: false /replicate@0.25.2: @@ -30462,6 +30858,14 @@ packages: zod: 3.22.4 dev: false + /zod-to-json-schema@3.22.5(zod@3.22.4): + resolution: { integrity: sha512-+akaPo6a0zpVCCseDed504KBJUQpEW5QZw7RMneNmKw+fGaML1Z9tUNLnHHAC8x6dzVRO1eB2oEMyZRnuBZg7Q== } + peerDependencies: + zod: ^3.22.4 + dependencies: + zod: 3.22.4 + dev: false + /zod@3.22.4: resolution: { integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== } dev: false