mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
feat(Google Vertex Chat Model Node): Add support for Google Vertex AI Chat models (#9970)
Co-authored-by: oleg <oleg@n8n.io>
This commit is contained in:
@@ -44,6 +44,12 @@ export function isChatInstance(model: unknown): model is BaseChatModel {
|
||||
return namespace.includes('chat_models');
|
||||
}
|
||||
|
||||
export function isToolsInstance(model: unknown): model is Tool {
|
||||
const namespace = (model as Tool)?.lc_namespace ?? [];
|
||||
|
||||
return namespace.includes('tools');
|
||||
}
|
||||
|
||||
export async function getOptionalOutputParsers(
|
||||
ctx: IExecuteFunctions,
|
||||
): Promise<Array<BaseOutputParser<unknown>>> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NodeOperationError, NodeConnectionType } from 'n8n-workflow';
|
||||
import type { ConnectionTypes, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { Tool } from '@langchain/core/tools';
|
||||
import type { Tool } from '@langchain/core/tools';
|
||||
import type { BaseMessage } from '@langchain/core/messages';
|
||||
import type { InputValues, MemoryVariables, OutputValues } from '@langchain/core/memory';
|
||||
import { BaseChatMessageHistory } from '@langchain/core/chat_history';
|
||||
@@ -18,7 +18,7 @@ import { isObject } from 'lodash';
|
||||
import type { BaseDocumentLoader } from 'langchain/dist/document_loaders/base';
|
||||
import { N8nJsonLoader } from './N8nJsonLoader';
|
||||
import { N8nBinaryLoader } from './N8nBinaryLoader';
|
||||
import { logAiEvent } from './helpers';
|
||||
import { logAiEvent, isToolsInstance } from './helpers';
|
||||
|
||||
const errorsMap: { [key: string]: { message: string; description: string } } = {
|
||||
'You exceeded your current quota, please check your plan and billing details.': {
|
||||
@@ -401,7 +401,7 @@ export function logWrapper(
|
||||
}
|
||||
|
||||
// ========== Tool ==========
|
||||
if (originalInstance instanceof Tool) {
|
||||
if (isToolsInstance(originalInstance)) {
|
||||
if (prop === '_call' && '_call' in target) {
|
||||
return async (query: string): Promise<string> => {
|
||||
connectionType = NodeConnectionType.AiTool;
|
||||
|
||||
Reference in New Issue
Block a user