mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
chore: Update LangChain dependencies (no-changelog) (#16523)
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import type { BaseOutputParser } from '@langchain/core/output_parsers';
|
||||
import type { DynamicStructuredTool, Tool } from 'langchain/tools';
|
||||
import { NodeOperationError, type IExecuteFunctions, type INode } from 'n8n-workflow';
|
||||
import type { z } from 'zod';
|
||||
|
||||
type ZodObjectAny = z.ZodObject<any, any, any, any>;
|
||||
import type { ZodObjectAny } from '../../../../types/types';
|
||||
|
||||
export async function extractParsedOutput(
|
||||
ctx: IExecuteFunctions,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { NodeOperationError } from 'n8n-workflow';
|
||||
import type { INode } from 'n8n-workflow';
|
||||
import { z } from 'zod';
|
||||
|
||||
import type { ZodObjectAny } from '../../../../types/types';
|
||||
import { checkForStructuredTools } from '../agents/utils';
|
||||
|
||||
describe('checkForStructuredTools', () => {
|
||||
@@ -41,7 +42,7 @@ describe('checkForStructuredTools', () => {
|
||||
func: async () => 'result',
|
||||
});
|
||||
|
||||
const tools: Array<Tool | DynamicStructuredTool> = [dynamicTool];
|
||||
const tools: Array<Tool | DynamicStructuredTool<ZodObjectAny>> = [dynamicTool];
|
||||
|
||||
await expect(checkForStructuredTools(tools, mockNode, 'Conversation Agent')).rejects.toThrow(
|
||||
NodeOperationError,
|
||||
|
||||
@@ -189,7 +189,11 @@ describe('imageUtils', () => {
|
||||
|
||||
it('should handle image data differently for GoogleGenerativeAI models', async () => {
|
||||
// Mock a Google model - using our mocked class
|
||||
mockContext.getInputConnectionData.mockResolvedValue(new ChatGoogleGenerativeAI());
|
||||
mockContext.getInputConnectionData.mockResolvedValue(
|
||||
new ChatGoogleGenerativeAI({
|
||||
model: 'gemini-1.0-pro',
|
||||
}),
|
||||
);
|
||||
|
||||
const message: MessageTemplate = {
|
||||
type: 'HumanMessagePromptTemplate',
|
||||
|
||||
@@ -126,7 +126,7 @@ export class EmbeddingsGoogleGemini implements INodeType {
|
||||
const credentials = await this.getCredentials('googlePalmApi');
|
||||
const embeddings = new GoogleGenerativeAIEmbeddings({
|
||||
apiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
model: modelName,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@@ -146,7 +146,7 @@ export class EmbeddingsMistralCloud implements INodeType {
|
||||
|
||||
const embeddings = new MistralAIEmbeddings({
|
||||
apiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
model: modelName,
|
||||
...options,
|
||||
});
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ export class LmChatAnthropic implements INodeType {
|
||||
|
||||
const model = new ChatAnthropic({
|
||||
anthropicApiKey: credentials.apiKey,
|
||||
modelName,
|
||||
model: modelName,
|
||||
anthropicApiUrl: baseURL,
|
||||
maxTokens: options.maxTokensToSample,
|
||||
temperature: options.temperature,
|
||||
|
||||
@@ -367,7 +367,7 @@ export class LmChatOpenAi implements INodeType {
|
||||
|
||||
const model = new ChatOpenAI({
|
||||
openAIApiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
model: modelName,
|
||||
...options,
|
||||
timeout: options.timeout ?? 60000,
|
||||
maxRetries: options.maxRetries ?? 2,
|
||||
|
||||
@@ -259,7 +259,7 @@ export class LmOpenAi implements INodeType {
|
||||
|
||||
const model = new OpenAI({
|
||||
openAIApiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
model: modelName,
|
||||
...options,
|
||||
configuration,
|
||||
timeout: options.timeout ?? 60000,
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
import { getHttpProxyAgent } from '@utils/httpProxyAgent';
|
||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||
|
||||
import type { OpenAICompatibleCredential } from '../../../types/types';
|
||||
import { openAiFailedAttemptHandler } from '../../vendors/OpenAi/helpers/error-handling';
|
||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||
@@ -234,7 +235,7 @@ export class LmChatDeepSeek implements INodeType {
|
||||
|
||||
const model = new ChatOpenAI({
|
||||
openAIApiKey: credentials.apiKey,
|
||||
modelName,
|
||||
model: modelName,
|
||||
...options,
|
||||
timeout: options.timeout ?? 60000,
|
||||
maxRetries: options.maxRetries ?? 2,
|
||||
|
||||
@@ -149,7 +149,7 @@ export class LmChatGoogleGemini implements INodeType {
|
||||
const model = new ChatGoogleGenerativeAI({
|
||||
apiKey: credentials.apiKey as string,
|
||||
baseUrl: credentials.host as string,
|
||||
modelName,
|
||||
model: modelName,
|
||||
topK: options.topK,
|
||||
topP: options.topP,
|
||||
temperature: options.temperature,
|
||||
|
||||
@@ -143,7 +143,7 @@ export class LmChatGroq implements INodeType {
|
||||
|
||||
const model = new ChatGroq({
|
||||
apiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
model: modelName,
|
||||
maxTokens: options.maxTokensToSample,
|
||||
temperature: options.temperature,
|
||||
callbacks: [new N8nLlmTracing(this)],
|
||||
|
||||
@@ -190,7 +190,7 @@ export class LmChatMistralCloud implements INodeType {
|
||||
|
||||
const model = new ChatMistralAI({
|
||||
apiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
model: modelName,
|
||||
...options,
|
||||
callbacks: [new N8nLlmTracing(this)],
|
||||
onFailedAttempt: makeN8nLlmFailedAttemptHandler(this),
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
import { getHttpProxyAgent } from '@utils/httpProxyAgent';
|
||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||
|
||||
import type { OpenAICompatibleCredential } from '../../../types/types';
|
||||
import { openAiFailedAttemptHandler } from '../../vendors/OpenAi/helpers/error-handling';
|
||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||
@@ -233,7 +234,7 @@ export class LmChatOpenRouter implements INodeType {
|
||||
|
||||
const model = new ChatOpenAI({
|
||||
openAIApiKey: credentials.apiKey,
|
||||
modelName,
|
||||
model: modelName,
|
||||
...options,
|
||||
timeout: options.timeout ?? 60000,
|
||||
maxRetries: options.maxRetries ?? 2,
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
import { getHttpProxyAgent } from '@utils/httpProxyAgent';
|
||||
import { getConnectionHintNoticeField } from '@utils/sharedFields';
|
||||
|
||||
import type { OpenAICompatibleCredential } from '../../../types/types';
|
||||
import { openAiFailedAttemptHandler } from '../../vendors/OpenAi/helpers/error-handling';
|
||||
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
|
||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||
@@ -234,7 +235,7 @@ export class LmChatXAiGrok implements INodeType {
|
||||
|
||||
const model = new ChatOpenAI({
|
||||
openAIApiKey: credentials.apiKey,
|
||||
modelName,
|
||||
model: modelName,
|
||||
...options,
|
||||
timeout: options.timeout ?? 60000,
|
||||
maxRetries: options.maxRetries ?? 2,
|
||||
|
||||
Reference in New Issue
Block a user