-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Update langchain (main) #229504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update langchain (main) #229504
Changes from 35 commits
24cea34
cbe4c89
57a982e
7603bba
e5f9701
f738bd9
af56329
cf01d0f
15b4145
bfa6da3
4356165
4a643ae
614fba9
1ecb5be
a2a2d9e
a113dd8
82d4f48
a5b4416
e37581a
b87cab0
8695be9
b24c361
1d2fa51
518fdd2
bfc4fb9
d9e4f40
8c151c2
6d0f594
c514530
d863c3a
26c4c7d
62295b9
75285ef
f03323e
f962227
7a43891
510f887
44133fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,25 +79,26 @@ | |
| "resolutions": { | ||
| "**/@babel/parser": "7.24.7", | ||
| "**/@hello-pangea/dnd": "18.0.1", | ||
| "**/@langchain/core": "^0.3.57", | ||
| "**/@langchain/google-common": "^0.1.8", | ||
| "**/@langchain/core": "^0.3.78", | ||
| "**/@langchain/google-common": "^0.2.18", | ||
| "**/@types/node": "22.15.3", | ||
| "**/@typescript-eslint/utils": "8.16.0", | ||
| "**/chokidar": "^3.5.3", | ||
| "**/d3-scale/**/d3-color": "npm:@elastic/[email protected]", | ||
| "**/globule/minimatch": "^3.1.2", | ||
| "**/hoist-non-react-statics": "^3.3.2", | ||
| "**/isomorphic-fetch/node-fetch": "^2.6.7", | ||
| "**/langchain": "^0.3.15", | ||
| "**/langchain": "^0.3.35", | ||
| "**/remark-parse/trim": "1.0.1", | ||
| "**/sharp": "0.32.6", | ||
| "**/typescript": "5.4.5", | ||
| "**/util": "^0.12.5", | ||
| "**/yauzl": "^3.2.0", | ||
| "@aws-sdk/client-bedrock-agent-runtime": "^3.744.0", | ||
| "@aws-sdk/client-bedrock-runtime": "^3.744.0", | ||
| "@aws-sdk/client-kendra": "3.744.0", | ||
| "@aws-sdk/credential-provider-node": "3.744.0", | ||
| "**/zod": "^3.25.76", | ||
| "@aws-sdk/client-bedrock-agent-runtime": "^3.879.0", | ||
| "@aws-sdk/client-bedrock-runtime": "^3.879.0", | ||
| "@aws-sdk/client-kendra": "3.879.0", | ||
| "@aws-sdk/credential-provider-node": "3.879.0", | ||
| "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0", | ||
| "@types/react": "~18.2.0", | ||
| "@types/react-dom": "~18.2.0", | ||
|
|
@@ -111,7 +112,7 @@ | |
| "@apidevtools/json-schema-ref-parser": "^14.1.1", | ||
| "@appland/sql-parser": "^1.5.1", | ||
| "@arizeai/openinference-semantic-conventions": "^1.1.0", | ||
| "@aws-sdk/client-bedrock-runtime": "^3.744.0", | ||
| "@aws-sdk/client-bedrock-runtime": "^3.879.0", | ||
| "@babel/runtime": "^7.24.7", | ||
| "@dagrejs/dagre": "^1.1.5", | ||
| "@dnd-kit/core": "^6.3.1", | ||
|
|
@@ -152,7 +153,7 @@ | |
| "@formatjs/intl": "^2.10.2", | ||
| "@formatjs/intl-utils": "^3.8.4", | ||
| "@formatjs/ts-transformer": "^3.13.14", | ||
| "@google/generative-ai": "^0.21.0", | ||
| "@google/generative-ai": "^0.24.1", | ||
| "@grpc/grpc-js": "^1.13.4", | ||
| "@hapi/accept": "^6.0.3", | ||
| "@hapi/boom": "^10.0.1", | ||
|
|
@@ -1138,15 +1139,15 @@ | |
| "@kbn/xstate-utils": "link:src/platform/packages/shared/kbn-xstate-utils", | ||
| "@kbn/zod": "link:src/platform/packages/shared/kbn-zod", | ||
| "@kbn/zod-helpers": "link:src/platform/packages/shared/kbn-zod-helpers", | ||
| "@langchain/aws": "^0.1.3", | ||
| "@langchain/community": "^0.3.29", | ||
| "@langchain/core": "^0.3.57", | ||
| "@langchain/google-common": "^0.1.8", | ||
| "@langchain/google-genai": "^0.1.8", | ||
| "@langchain/google-vertexai": "^0.1.8", | ||
| "@langchain/langgraph": "^0.2.45", | ||
| "@langchain/langgraph-checkpoint": "~0.0.17", | ||
| "@langchain/openai": "^0.4.4", | ||
| "@langchain/aws": "^0.1.15", | ||
| "@langchain/community": "^0.3.57", | ||
| "@langchain/core": "^0.3.78", | ||
| "@langchain/google-common": "^0.2.18", | ||
| "@langchain/google-genai": "^0.2.18", | ||
| "@langchain/google-vertexai": "^0.2.18", | ||
| "@langchain/langgraph": "^0.4.9", | ||
| "@langchain/langgraph-checkpoint": "~0.1.1", | ||
| "@langchain/openai": "^0.6.14", | ||
| "@launchdarkly/node-server-sdk": "^9.10.2", | ||
| "@launchdarkly/openfeature-node-server": "^1.1.0", | ||
| "@loaders.gl/core": "^3.4.7", | ||
|
|
@@ -1178,9 +1179,9 @@ | |
| "@opentelemetry/semantic-conventions": "^1.37.0", | ||
| "@reduxjs/toolkit": "1.9.7", | ||
| "@slack/webhook": "^7.0.6", | ||
| "@smithy/eventstream-codec": "^4.0.1", | ||
| "@smithy/eventstream-serde-node": "^4.0.1", | ||
| "@smithy/middleware-stack": "^4.0.1", | ||
| "@smithy/eventstream-codec": "^4.0.5", | ||
| "@smithy/eventstream-serde-node": "^4.0.5", | ||
| "@smithy/middleware-stack": "^4.0.5", | ||
| "@smithy/node-http-handler": "^4.0.1", | ||
| "@smithy/types": "^4.1.0", | ||
| "@smithy/util-utf8": "^4.0.0", | ||
|
|
@@ -1292,8 +1293,8 @@ | |
| "jsonwebtoken": "^9.0.2", | ||
| "jsts": "^1.6.2", | ||
| "kea": "^2.6.0", | ||
| "langchain": "^0.3.15", | ||
| "langsmith": "^0.3.7", | ||
| "langchain": "^0.3.35", | ||
| "langsmith": "^0.3.72", | ||
| "launchdarkly-js-client-sdk": "^3.9.0", | ||
| "liquidjs": "^10.21.1", | ||
| "load-json-file": "^6.2.0", | ||
|
|
@@ -1424,8 +1425,8 @@ | |
| "yaml": "^2.5.1", | ||
| "yauzl": "^3.2.0", | ||
| "yazl": "^3.3.1", | ||
| "zod": "^3.22.3", | ||
| "zod-to-json-schema": "^3.23.0" | ||
| "zod": "^3.25.76", | ||
| "zod-to-json-schema": "^3.24.6" | ||
| }, | ||
| "devDependencies": { | ||
| "@apidevtools/swagger-parser": "^12.0.0", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,20 @@ module.exports = (request, options) => { | |
| }); | ||
| } | ||
|
|
||
| if (request === 'zod' || request === 'zod/v3') { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after |
||
| return resolve.sync('zod/v3/index.cjs', { | ||
| basedir: options.basedir, | ||
| extensions: options.extensions, | ||
| }); | ||
| } | ||
|
|
||
| if (request.startsWith('zod/v4/')) { | ||
| return resolve.sync(`${request}/index.cjs`, { | ||
| basedir: options.basedir, | ||
| extensions: options.extensions, | ||
| }); | ||
| } | ||
|
|
||
| if (request === `elastic-apm-node`) { | ||
| return APM_AGENT_MOCK; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -581,22 +581,48 @@ describe('InferenceChatModel', () => { | |
| const response = createStreamResponse([ | ||
| { | ||
| tool_calls: [ | ||
| { toolCallId: 'my-tool-call-id', index: 0, function: { name: '', arguments: '' } }, | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes required due to langchain-ai/langchainjs#8433 |
||
| toolCallId: 'my-tool-call-id', | ||
| index: 0, | ||
| function: { name: 'myfunction', arguments: '' }, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| tool_calls: [{ toolCallId: '', index: 0, function: { name: 'myfun', arguments: '' } }], | ||
| tool_calls: [ | ||
| { | ||
| toolCallId: 'my-tool-call-id', | ||
| index: 0, | ||
| function: { name: 'myfunction', arguments: '' }, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| tool_calls: [ | ||
| { toolCallId: '', index: 0, function: { name: 'ction', arguments: ' { "' } }, | ||
| { | ||
| toolCallId: 'my-tool-call-id', | ||
| index: 0, | ||
| function: { name: 'myfunction', arguments: ' { "' }, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| tool_calls: [{ toolCallId: '', index: 0, function: { name: '', arguments: 'arg1": ' } }], | ||
| tool_calls: [ | ||
| { | ||
| toolCallId: 'my-tool-call-id', | ||
| index: 0, | ||
| function: { name: 'myfunction', arguments: 'arg1": ' }, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| tool_calls: [{ toolCallId: '', index: 0, function: { name: '', arguments: '42 }' } }], | ||
| tool_calls: [ | ||
| { | ||
| toolCallId: 'my-tool-call-id', | ||
| index: 0, | ||
| function: { name: 'myfunction', arguments: '42 }' }, | ||
| }, | ||
| ], | ||
| }, | ||
| ]); | ||
| chatComplete.mockReturnValue(response); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| * 2.0. | ||
| */ | ||
|
|
||
| import type { z } from '@kbn/zod'; | ||
| import type { ZodSchema } from '@kbn/zod'; | ||
| import { zodToJsonSchema } from 'zod-to-json-schema'; | ||
| import { | ||
| BaseChatModel, | ||
|
|
@@ -14,14 +14,15 @@ import { | |
| type BindToolsInput, | ||
| type LangSmithParams, | ||
| } from '@langchain/core/language_models/chat_models'; | ||
| import type { InteropZodType } from '@langchain/core/utils/types'; | ||
| import type { | ||
| BaseLanguageModelInput, | ||
| StructuredOutputMethodOptions, | ||
| ToolDefinition, | ||
| } from '@langchain/core/language_models/base'; | ||
| import type { BaseMessage, AIMessageChunk } from '@langchain/core/messages'; | ||
| import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager'; | ||
| import { isZodSchema } from '@langchain/core/utils/types'; | ||
| import { isInteropZodSchema } from '@langchain/core/utils/types'; | ||
| import type { ChatResult, ChatGeneration } from '@langchain/core/outputs'; | ||
| import { ChatGenerationChunk } from '@langchain/core/outputs'; | ||
| import { OutputParserException } from '@langchain/core/output_parsers'; | ||
|
|
@@ -304,34 +305,37 @@ export class InferenceChatModel extends BaseChatModel<InferenceChatModelCallOpti | |
| } | ||
|
|
||
| withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>( | ||
| outputSchema: z.ZodType<RunOutput> | Record<string, any>, | ||
| outputSchema: InteropZodType<RunOutput> | Record<string, any>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated types to align with |
||
| config?: StructuredOutputMethodOptions<false> | ||
| ): Runnable<BaseLanguageModelInput, RunOutput>; | ||
| withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>( | ||
| outputSchema: z.ZodType<RunOutput> | Record<string, any>, | ||
| outputSchema: InteropZodType<RunOutput> | Record<string, any>, | ||
| config?: StructuredOutputMethodOptions<true> | ||
| ): Runnable<BaseLanguageModelInput, { raw: BaseMessage; parsed: RunOutput }>; | ||
| withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>( | ||
| outputSchema: z.ZodType<RunOutput> | Record<string, any>, | ||
| outputSchema: InteropZodType<RunOutput> | Record<string, any>, | ||
| config?: StructuredOutputMethodOptions<boolean> | ||
| ): | ||
| | Runnable<BaseLanguageModelInput, RunOutput> | ||
| | Runnable<BaseLanguageModelInput, { raw: BaseMessage; parsed: RunOutput }> { | ||
| const schema: z.ZodType<RunOutput> | Record<string, any> = outputSchema; | ||
| const schema: InteropZodType<RunOutput> | Record<string, any> = outputSchema; | ||
| const name = config?.name; | ||
| const description = schema.description ?? 'A function available to call.'; | ||
| const description = | ||
| 'description' in schema && typeof schema.description === 'string' | ||
| ? schema.description | ||
| : 'A function available to call.'; | ||
| const includeRaw = config?.includeRaw; | ||
|
|
||
| let functionName = name ?? 'extract'; | ||
| let tools: ToolDefinition[]; | ||
| if (isZodSchema(schema)) { | ||
| if (isInteropZodSchema(schema)) { | ||
| tools = [ | ||
| { | ||
| type: 'function', | ||
| function: { | ||
| name: functionName, | ||
| description, | ||
| parameters: zodToJsonSchema(schema), | ||
| parameters: zodToJsonSchema(schema as unknown as ZodSchema), | ||
| }, | ||
| }, | ||
| ]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,11 +5,8 @@ | |
| * 2.0. | ||
| */ | ||
|
|
||
| import { ActionsClientBedrockChatModel } from './language_models/bedrock_chat'; | ||
| import { ActionsClientChatOpenAI } from './language_models/chat_openai'; | ||
| import { ActionsClientLlm } from './language_models/llm'; | ||
| import { ActionsClientSimpleChatModel } from './language_models/simple_chat_model'; | ||
| import { ActionsClientGeminiChatModel } from './language_models/gemini_chat'; | ||
| import { ActionsClientChatVertexAI } from './language_models/chat_vertex'; | ||
| import { ActionsClientChatBedrockConverse } from './language_models/chat_bedrock_converse'; | ||
| import { parseBedrockStream } from './utils/bedrock'; | ||
|
|
@@ -20,11 +17,8 @@ export { | |
| parseBedrockStream, | ||
| parseGeminiResponse, | ||
| getDefaultArguments, | ||
| ActionsClientBedrockChatModel, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these models are not used anymore |
||
| ActionsClientChatOpenAI, | ||
| ActionsClientChatVertexAI, | ||
| ActionsClientGeminiChatModel, | ||
| ActionsClientLlm, | ||
| ActionsClientSimpleChatModel, | ||
| ActionsClientChatBedrockConverse, | ||
| }; | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elena-shostak would you mind to verify it? When I was testing it the branch on buildkite was
elastic:renovate/main-langchaininstead ofrenovate/main-langchain, so the check was run on this PRThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked, you are right, thanks for fixing!
As for the dependency health check, I've also raised a PR to properly skip renovate PRs #235066