Skip to content

Commit

Permalink
chore: Upgrade LangChain packages to latest versions (no-changelog) (#…
Browse files Browse the repository at this point in the history
…11771)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <[email protected]>
  • Loading branch information
burivuhster and netroy authored Dec 2, 2024
1 parent 80a2093 commit 28487ed
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 228 deletions.
2 changes: 1 addition & 1 deletion packages/@n8n/json-schema-to-zod/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export type * from './types';
export { jsonSchemaToZod } from './json-schema-to-zod.js';
export { jsonSchemaToZod } from './json-schema-to-zod';
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { ZodObjectAny } from '@langchain/core/dist/types/zod';
import type { z } from 'zod';
import type { BaseOutputParser } from '@langchain/core/output_parsers';
import type { DynamicStructuredTool, Tool } from 'langchain/tools';
import { NodeOperationError, type IExecuteFunctions, type INode } from 'n8n-workflow';

type ZodObjectAny = z.ZodObject<any, any, any, any>;

export async function extractParsedOutput(
ctx: IExecuteFunctions,
outputParser: BaseOutputParser<unknown>,
Expand Down
30 changes: 15 additions & 15 deletions packages/@n8n/nodes-langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,47 +135,47 @@
"@getzep/zep-js": "0.9.0",
"@google-ai/generativelanguage": "2.6.0",
"@google-cloud/resource-manager": "5.3.0",
"@google/generative-ai": "0.19.0",
"@google/generative-ai": "0.21.0",
"@huggingface/inference": "2.8.0",
"@langchain/anthropic": "0.3.7",
"@langchain/aws": "0.1.1",
"@langchain/anthropic": "0.3.8",
"@langchain/aws": "0.1.2",
"@langchain/cohere": "0.3.1",
"@langchain/community": "0.3.11",
"@langchain/community": "0.3.15",
"@langchain/core": "catalog:",
"@langchain/google-genai": "0.1.2",
"@langchain/google-vertexai": "0.1.0",
"@langchain/google-genai": "0.1.4",
"@langchain/google-vertexai": "0.1.3",
"@langchain/groq": "0.1.2",
"@langchain/mistralai": "0.1.1",
"@langchain/ollama": "0.1.1",
"@langchain/openai": "0.3.11",
"@langchain/pinecone": "0.1.1",
"@langchain/qdrant": "0.1.0",
"@langchain/mistralai": "0.2.0",
"@langchain/ollama": "0.1.2",
"@langchain/openai": "0.3.14",
"@langchain/pinecone": "0.1.3",
"@langchain/qdrant": "0.1.1",
"@langchain/redis": "0.1.0",
"@langchain/textsplitters": "0.1.0",
"@mozilla/readability": "0.5.0",
"@n8n/json-schema-to-zod": "workspace:*",
"@n8n/typeorm": "0.3.20-12",
"@n8n/vm2": "3.9.25",
"@pinecone-database/pinecone": "3.0.3",
"@pinecone-database/pinecone": "4.0.0",
"@qdrant/js-client-rest": "1.11.0",
"@supabase/supabase-js": "2.45.4",
"@xata.io/client": "0.28.4",
"basic-auth": "catalog:",
"cheerio": "1.0.0",
"cohere-ai": "7.13.2",
"cohere-ai": "7.14.0",
"d3-dsv": "2.0.0",
"epub2": "3.0.2",
"form-data": "catalog:",
"generate-schema": "2.6.0",
"html-to-text": "9.0.5",
"jsdom": "23.0.1",
"langchain": "0.3.5",
"langchain": "0.3.6",
"lodash": "catalog:",
"mammoth": "1.7.2",
"mime-types": "2.1.35",
"n8n-nodes-base": "workspace:*",
"n8n-workflow": "workspace:*",
"openai": "4.69.0",
"openai": "4.73.1",
"pdf-parse": "1.1.1",
"pg": "8.12.0",
"redis": "4.6.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export class N8nStructuredOutputParser extends StructuredOutputParser<
[{ json: { action: 'parse', text } }],
]);
try {
const parsed = await super.parse(text);
const jsonString = text.includes('```') ? text.split(/```(?:json)?/)[1] : text;
const json = JSON.parse(jsonString.trim());
const parsed = await this.schema.parseAsync(json);

const result = (get(parsed, [STRUCTURED_OUTPUT_KEY, STRUCTURED_OUTPUT_OBJECT_KEY]) ??
get(parsed, [STRUCTURED_OUTPUT_KEY, STRUCTURED_OUTPUT_ARRAY_KEY]) ??
Expand Down
Loading

0 comments on commit 28487ed

Please sign in to comment.