langchain 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # langchain
2
2
 
3
+ ## 1.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`0bade90`](https://github.com/langchain-ai/langchainjs/commit/0bade90ed47c7988ed86f1e695a28273c7b3df50), [`6c40d00`](https://github.com/langchain-ai/langchainjs/commit/6c40d00e926f377d249c2919549381522eac8ed1)]:
8
+ - @langchain/core@1.1.4
9
+
3
10
  ## 1.1.4
4
11
 
5
12
  ### Patch Changes
@@ -10,6 +10,8 @@ import { Command, CompiledStateGraph, GetStateOptions, LangGraphRunnableConfig,
10
10
  import { CheckpointListOptions } from "@langchain/langgraph-checkpoint";
11
11
 
12
12
  //#region src/agents/ReactAgent.d.ts
13
+
14
+ // Helper type to get the state definition with middleware states
13
15
  type MergedAgentState<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware[]> = InferSchemaInput<StateSchema> & (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, "jumpTo"> : Omit<BuiltInState, "jumpTo"> & {
14
16
  structuredResponse: StructuredResponseFormat;
15
17
  }) & InferMiddlewareStates<TMiddleware>;
@@ -10,6 +10,8 @@ import { CheckpointListOptions } from "@langchain/langgraph-checkpoint";
10
10
  import { StreamEvent } from "@langchain/core/tracers/log_stream";
11
11
 
12
12
  //#region src/agents/ReactAgent.d.ts
13
+
14
+ // Helper type to get the state definition with middleware states
13
15
  type MergedAgentState<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined, StructuredResponseFormat extends Record<string, any> | ResponseFormatUndefined, TMiddleware extends readonly AgentMiddleware[]> = InferSchemaInput<StateSchema> & (StructuredResponseFormat extends ResponseFormatUndefined ? Omit<BuiltInState, "jumpTo"> : Omit<BuiltInState, "jumpTo"> & {
14
16
  structuredResponse: StructuredResponseFormat;
15
17
  }) & InferMiddlewareStates<TMiddleware>;
@@ -130,45 +130,56 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
130
130
  * }
131
131
  * ```
132
132
  */
133
+ // Overload 1: With responseFormat as single InteropZodType
133
134
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {
134
135
  responseFormat: InteropZodType<T>;
135
136
  middleware?: TMiddleware;
136
137
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
138
+ // Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
137
139
  declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {
138
140
  responseFormat: T;
139
141
  middleware?: TMiddleware;
140
142
  }): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;
143
+ // Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
141
144
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {
142
145
  responseFormat: JsonSchemaFormat;
143
146
  middleware?: TMiddleware;
144
147
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
148
+ // Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
145
149
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {
146
150
  responseFormat: JsonSchemaFormat[];
147
151
  middleware?: TMiddleware;
148
152
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
153
+ // Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
149
154
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
150
155
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
151
156
  middleware?: TMiddleware;
152
157
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
158
+ // Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
153
159
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {
154
160
  responseFormat: TypedToolStrategy<T>;
155
161
  middleware?: TMiddleware;
156
162
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
163
+ // Overload 6: With responseFormat as single ToolStrategy instance
157
164
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {
158
165
  responseFormat: ToolStrategy<T>;
159
166
  middleware?: TMiddleware;
160
167
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
168
+ // Overload 7: With responseFormat as ProviderStrategy
161
169
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {
162
170
  responseFormat: ProviderStrategy<T>;
163
171
  middleware?: TMiddleware;
164
172
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
173
+ // Overload 8: Without responseFormat property at all - with proper middleware state typing
165
174
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
166
175
  middleware?: TMiddleware;
167
176
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
177
+ // Overload 9: With responseFormat explicitly undefined
168
178
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
169
179
  responseFormat?: undefined;
170
180
  middleware?: TMiddleware;
171
181
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
182
+ // Overload 10: For other ResponseFormat values (failsafe)
172
183
  declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {
173
184
  responseFormat: ResponseFormat;
174
185
  middleware?: TMiddleware;
@@ -130,45 +130,56 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
130
130
  * }
131
131
  * ```
132
132
  */
133
+ // Overload 1: With responseFormat as single InteropZodType
133
134
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {
134
135
  responseFormat: InteropZodType<T>;
135
136
  middleware?: TMiddleware;
136
137
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
138
+ // Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
137
139
  declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {
138
140
  responseFormat: T;
139
141
  middleware?: TMiddleware;
140
142
  }): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;
143
+ // Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
141
144
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {
142
145
  responseFormat: JsonSchemaFormat;
143
146
  middleware?: TMiddleware;
144
147
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
148
+ // Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
145
149
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {
146
150
  responseFormat: JsonSchemaFormat[];
147
151
  middleware?: TMiddleware;
148
152
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
153
+ // Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
149
154
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
150
155
  responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
151
156
  middleware?: TMiddleware;
152
157
  }): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
158
+ // Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
153
159
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {
154
160
  responseFormat: TypedToolStrategy<T>;
155
161
  middleware?: TMiddleware;
156
162
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
163
+ // Overload 6: With responseFormat as single ToolStrategy instance
157
164
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {
158
165
  responseFormat: ToolStrategy<T>;
159
166
  middleware?: TMiddleware;
160
167
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
168
+ // Overload 7: With responseFormat as ProviderStrategy
161
169
  declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {
162
170
  responseFormat: ProviderStrategy<T>;
163
171
  middleware?: TMiddleware;
164
172
  }): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
173
+ // Overload 8: Without responseFormat property at all - with proper middleware state typing
165
174
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
166
175
  middleware?: TMiddleware;
167
176
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
177
+ // Overload 9: With responseFormat explicitly undefined
168
178
  declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
169
179
  responseFormat?: undefined;
170
180
  middleware?: TMiddleware;
171
181
  }): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
182
+ // Overload 10: For other ResponseFormat values (failsafe)
172
183
  declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {
173
184
  responseFormat: ResponseFormat;
174
185
  middleware?: TMiddleware;
@@ -40,6 +40,7 @@ declare class ToolStrategy<_T = unknown> {
40
40
  }
41
41
  declare class ProviderStrategy<T = unknown> {
42
42
  readonly schema: Record<string, unknown>;
43
+ // @ts-expect-error - _schemaType is used only for type inference
43
44
  private _schemaType?;
44
45
  private constructor();
45
46
  static fromSchema<T>(schema: InteropZodType<T>): ProviderStrategy<T>;
@@ -99,6 +100,7 @@ type JsonSchemaFormat = {
99
100
  additionalProperties?: boolean;
100
101
  [key: string]: unknown;
101
102
  } & {
103
+ // Brand to ensure this is not a ToolStrategy or ProviderStrategy
102
104
  __brand?: never;
103
105
  };
104
106
  //#endregion
@@ -40,6 +40,7 @@ declare class ToolStrategy<_T = unknown> {
40
40
  }
41
41
  declare class ProviderStrategy<T = unknown> {
42
42
  readonly schema: Record<string, unknown>;
43
+ // @ts-expect-error - _schemaType is used only for type inference
43
44
  private _schemaType?;
44
45
  private constructor();
45
46
  static fromSchema<T>(schema: InteropZodType<T>): ProviderStrategy<T>;
@@ -99,6 +100,7 @@ type JsonSchemaFormat = {
99
100
  additionalProperties?: boolean;
100
101
  [key: string]: unknown;
101
102
  } & {
103
+ // Brand to ensure this is not a ToolStrategy or ProviderStrategy
102
104
  __brand?: never;
103
105
  };
104
106
  //#endregion
@@ -70,7 +70,9 @@ type ExtractNonUndefined<T> = T extends undefined ? never : T;
70
70
  /**
71
71
  * Helper type to check if all properties of a type are optional
72
72
  */
73
- type IsAllOptional<T> = undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;
73
+ type IsAllOptional<T> =
74
+ // If T includes undefined, then it's optional (can be omitted entirely)
75
+ undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;
74
76
  /**
75
77
  * Pregel options that are propagated to the agent
76
78
  */
@@ -71,7 +71,9 @@ type ExtractNonUndefined<T> = T extends undefined ? never : T;
71
71
  /**
72
72
  * Helper type to check if all properties of a type are optional
73
73
  */
74
- type IsAllOptional<T> = undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;
74
+ type IsAllOptional<T> =
75
+ // If T includes undefined, then it's optional (can be omitted entirely)
76
+ undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;
75
77
  /**
76
78
  * Pregel options that are propagated to the agent
77
79
  */
@@ -22,12 +22,15 @@ interface FakeToolCallingModelFields {
22
22
  index?: number;
23
23
  structuredResponse?: any;
24
24
  }
25
+ // Helper function to create checkpointer
26
+
25
27
  /**
26
28
  * Fake chat model for testing tool calling functionality
27
29
  */
28
30
  declare class FakeToolCallingModel extends BaseChatModel {
29
31
  toolCalls: ToolCall$1[][];
30
32
  toolStyle: "openai" | "anthropic";
33
+ // Use a shared reference object so the index persists across bindTools calls
31
34
  private indexRef;
32
35
  structuredResponse?: any;
33
36
  private tools;
@@ -43,6 +46,7 @@ declare class FakeToolCallingModel extends BaseChatModel {
43
46
  current: number;
44
47
  };
45
48
  });
49
+ // Getter/setter for backwards compatibility
46
50
  get index(): number;
47
51
  set index(value: number);
48
52
  _llmType(): string;
@@ -22,12 +22,15 @@ interface FakeToolCallingModelFields {
22
22
  index?: number;
23
23
  structuredResponse?: any;
24
24
  }
25
+ // Helper function to create checkpointer
26
+
25
27
  /**
26
28
  * Fake chat model for testing tool calling functionality
27
29
  */
28
30
  declare class FakeToolCallingModel extends BaseChatModel {
29
31
  toolCalls: ToolCall$1[][];
30
32
  toolStyle: "openai" | "anthropic";
33
+ // Use a shared reference object so the index persists across bindTools calls
31
34
  private indexRef;
32
35
  structuredResponse?: any;
33
36
  private tools;
@@ -43,6 +46,7 @@ declare class FakeToolCallingModel extends BaseChatModel {
43
46
  current: number;
44
47
  };
45
48
  });
49
+ // Getter/setter for backwards compatibility
46
50
  get index(): number;
47
51
  set index(value: number);
48
52
  _llmType(): string;
@@ -10,10 +10,12 @@ import { ChatResult } from "@langchain/core/outputs";
10
10
  import { ModelProfile } from "@langchain/core/language_models/profile";
11
11
 
12
12
  //#region src/chat_models/universal.d.ts
13
+ // TODO: remove once `EventStreamCallbackHandlerInput` is exposed in core
13
14
  interface EventStreamCallbackHandlerInput extends Omit<LogStreamCallbackHandlerInput, "_schemaFormat"> {}
14
15
  interface ConfigurableChatModelCallOptions extends BaseChatModelCallOptions {
15
16
  tools?: (StructuredToolInterface | Record<string, unknown> | ToolDefinition | RunnableToolLike)[];
16
17
  }
18
+ // Configuration map for model providers
17
19
  declare const MODEL_PROVIDER_CONFIG: {
18
20
  readonly openai: {
19
21
  readonly package: "@langchain/openai";
@@ -111,6 +113,7 @@ declare function getChatModelByClassName(className: string): Promise<any>;
111
113
  */
112
114
  declare function _inferModelProvider(modelName: string): string | undefined;
113
115
  interface ConfigurableModelFields extends BaseChatModelParams {
116
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
117
  defaultConfig?: Record<string, any>;
115
118
  /**
116
119
  * @default "any"
@@ -124,6 +127,7 @@ interface ConfigurableModelFields extends BaseChatModelParams {
124
127
  * Methods which should be called after the model is initialized.
125
128
  * The key will be the method name, and the value will be the arguments.
126
129
  */
130
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
131
  queuedMethodOperations?: Record<string, any>;
128
132
  /**
129
133
  * Overrides the profiling information for the model. If not provided,
@@ -139,6 +143,7 @@ interface ConfigurableModelFields extends BaseChatModelParams {
139
143
  declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> {
140
144
  _llmType(): string;
141
145
  lc_namespace: string[];
146
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
147
  _defaultConfig?: Record<string, any>;
143
148
  /**
144
149
  * @default "any"
@@ -152,6 +157,7 @@ declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLa
152
157
  * Methods which should be called after the model is initialized.
153
158
  * The key will be the method name, and the value will be the arguments.
154
159
  */
160
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
161
  _queuedMethodOperations: Record<string, any>;
156
162
  /** @internal */
157
163
  private _modelInstanceCache;
@@ -160,8 +166,12 @@ declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLa
160
166
  constructor(fields: ConfigurableModelFields);
161
167
  _getModelInstance(config?: RunnableConfig): Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure>>>;
162
168
  _generate(messages: BaseMessage[], options?: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
163
- bindTools(tools: BindToolsInput[], params?: Record<string, any>): ConfigurableModel<RunInput, CallOptions>;
169
+ bindTools(tools: BindToolsInput[],
170
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
171
+ params?: Record<string, any>): ConfigurableModel<RunInput, CallOptions>;
172
+ // Extract the input types from the `BaseModel` class.
164
173
  withStructuredOutput: BaseChatModel["withStructuredOutput"];
174
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
175
  _modelParams(config?: RunnableConfig): Record<string, any>;
166
176
  _removePrefix(str: string, prefix: string): string;
167
177
  /**
@@ -195,24 +205,31 @@ declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLa
195
205
  */
196
206
  get profile(): ModelProfile;
197
207
  }
208
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
198
209
  interface InitChatModelFields extends Partial<Record<string, any>> {
199
210
  modelProvider?: string;
200
211
  configurableFields?: string[] | "any";
201
212
  configPrefix?: string;
202
213
  }
203
214
  type ConfigurableFields = "any" | string[];
204
- declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: string, fields?: Partial<Record<string, any>> & {
215
+ declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: string,
216
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
217
+ fields?: Partial<Record<string, any>> & {
205
218
  modelProvider?: string;
206
219
  configurableFields?: never;
207
220
  configPrefix?: string;
208
221
  }): Promise<ConfigurableModel<RunInput, CallOptions>>;
209
- declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: never, options?: Partial<Record<string, any>> & {
222
+ declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: never,
223
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
224
+ options?: Partial<Record<string, any>> & {
210
225
  modelProvider?: string;
211
226
  configurableFields?: never;
212
227
  configPrefix?: string;
213
228
  profile?: ModelProfile;
214
229
  }): Promise<ConfigurableModel<RunInput, CallOptions>>;
215
- declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model?: string, options?: Partial<Record<string, any>> & {
230
+ declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model?: string,
231
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
+ options?: Partial<Record<string, any>> & {
216
233
  modelProvider?: string;
217
234
  configurableFields?: ConfigurableFields;
218
235
  configPrefix?: string;
@@ -10,10 +10,12 @@ import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
10
10
  import { ModelProfile } from "@langchain/core/language_models/profile";
11
11
 
12
12
  //#region src/chat_models/universal.d.ts
13
+ // TODO: remove once `EventStreamCallbackHandlerInput` is exposed in core
13
14
  interface EventStreamCallbackHandlerInput extends Omit<LogStreamCallbackHandlerInput, "_schemaFormat"> {}
14
15
  interface ConfigurableChatModelCallOptions extends BaseChatModelCallOptions {
15
16
  tools?: (StructuredToolInterface | Record<string, unknown> | ToolDefinition | RunnableToolLike)[];
16
17
  }
18
+ // Configuration map for model providers
17
19
  declare const MODEL_PROVIDER_CONFIG: {
18
20
  readonly openai: {
19
21
  readonly package: "@langchain/openai";
@@ -111,6 +113,7 @@ declare function getChatModelByClassName(className: string): Promise<any>;
111
113
  */
112
114
  declare function _inferModelProvider(modelName: string): string | undefined;
113
115
  interface ConfigurableModelFields extends BaseChatModelParams {
116
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
117
  defaultConfig?: Record<string, any>;
115
118
  /**
116
119
  * @default "any"
@@ -124,6 +127,7 @@ interface ConfigurableModelFields extends BaseChatModelParams {
124
127
  * Methods which should be called after the model is initialized.
125
128
  * The key will be the method name, and the value will be the arguments.
126
129
  */
130
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
131
  queuedMethodOperations?: Record<string, any>;
128
132
  /**
129
133
  * Overrides the profiling information for the model. If not provided,
@@ -139,6 +143,7 @@ interface ConfigurableModelFields extends BaseChatModelParams {
139
143
  declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> {
140
144
  _llmType(): string;
141
145
  lc_namespace: string[];
146
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
147
  _defaultConfig?: Record<string, any>;
143
148
  /**
144
149
  * @default "any"
@@ -152,6 +157,7 @@ declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLa
152
157
  * Methods which should be called after the model is initialized.
153
158
  * The key will be the method name, and the value will be the arguments.
154
159
  */
160
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
161
  _queuedMethodOperations: Record<string, any>;
156
162
  /** @internal */
157
163
  private _modelInstanceCache;
@@ -160,8 +166,12 @@ declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLa
160
166
  constructor(fields: ConfigurableModelFields);
161
167
  _getModelInstance(config?: RunnableConfig): Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure>>>;
162
168
  _generate(messages: BaseMessage[], options?: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
163
- bindTools(tools: BindToolsInput[], params?: Record<string, any>): ConfigurableModel<RunInput, CallOptions>;
169
+ bindTools(tools: BindToolsInput[],
170
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
171
+ params?: Record<string, any>): ConfigurableModel<RunInput, CallOptions>;
172
+ // Extract the input types from the `BaseModel` class.
164
173
  withStructuredOutput: BaseChatModel["withStructuredOutput"];
174
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
175
  _modelParams(config?: RunnableConfig): Record<string, any>;
166
176
  _removePrefix(str: string, prefix: string): string;
167
177
  /**
@@ -195,24 +205,31 @@ declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLa
195
205
  */
196
206
  get profile(): ModelProfile;
197
207
  }
208
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
198
209
  interface InitChatModelFields extends Partial<Record<string, any>> {
199
210
  modelProvider?: string;
200
211
  configurableFields?: string[] | "any";
201
212
  configPrefix?: string;
202
213
  }
203
214
  type ConfigurableFields = "any" | string[];
204
- declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: string, fields?: Partial<Record<string, any>> & {
215
+ declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: string,
216
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
217
+ fields?: Partial<Record<string, any>> & {
205
218
  modelProvider?: string;
206
219
  configurableFields?: never;
207
220
  configPrefix?: string;
208
221
  }): Promise<ConfigurableModel<RunInput, CallOptions>>;
209
- declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: never, options?: Partial<Record<string, any>> & {
222
+ declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: never,
223
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
224
+ options?: Partial<Record<string, any>> & {
210
225
  modelProvider?: string;
211
226
  configurableFields?: never;
212
227
  configPrefix?: string;
213
228
  profile?: ModelProfile;
214
229
  }): Promise<ConfigurableModel<RunInput, CallOptions>>;
215
- declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model?: string, options?: Partial<Record<string, any>> & {
230
+ declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model?: string,
231
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
+ options?: Partial<Record<string, any>> & {
216
233
  modelProvider?: string;
217
234
  configurableFields?: ConfigurableFields;
218
235
  configPrefix?: string;
@@ -24,6 +24,7 @@ declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
24
24
  apiKey?: string;
25
25
  apiUrl?: string;
26
26
  includeModel?: boolean;
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
28
  modelClass?: new (...args: any[]) => BaseLanguageModel;
28
29
  }): Promise<T>;
29
30
  //#endregion
@@ -24,6 +24,7 @@ declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {
24
24
  apiKey?: string;
25
25
  apiUrl?: string;
26
26
  includeModel?: boolean;
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
28
  modelClass?: new (...args: any[]) => BaseLanguageModel;
28
29
  }): Promise<T>;
29
30
  //#endregion
@@ -1,4 +1,5 @@
1
1
  //#region src/load/import_type.d.ts
2
+ // Auto-generated by lc-secrets plugin. Do not edit manually.
2
3
  interface OptionalImportMap {}
3
4
  //#endregion
4
5
  export { OptionalImportMap };
@@ -1,4 +1,5 @@
1
1
  //#region src/load/import_type.d.ts
2
+ // Auto-generated by lc-secrets plugin. Do not edit manually.
2
3
  interface OptionalImportMap {}
3
4
  //#endregion
4
5
  export { OptionalImportMap };
@@ -11,7 +11,13 @@ import { OptionalImportMap } from "./import_type.cjs";
11
11
  * @param optionalImportsMap
12
12
  * @returns A loaded instance of a LangChain module.
13
13
  */
14
- declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>): Promise<T>;
14
+ declare function load<T>(text: string,
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ secretsMap?: Record<string, any>,
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ optionalImportsMap?: OptionalImportMap & Record<string, any>,
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ additionalImportsMap?: Record<string, any>): Promise<T>;
15
21
  //#endregion
16
22
  export { load };
17
23
  //# sourceMappingURL=index.d.cts.map
@@ -11,7 +11,13 @@ import { OptionalImportMap } from "./import_type.js";
11
11
  * @param optionalImportsMap
12
12
  * @returns A loaded instance of a LangChain module.
13
13
  */
14
- declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>): Promise<T>;
14
+ declare function load<T>(text: string,
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ secretsMap?: Record<string, any>,
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ optionalImportsMap?: OptionalImportMap & Record<string, any>,
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ additionalImportsMap?: Record<string, any>): Promise<T>;
15
21
  //#endregion
16
22
  export { load };
17
23
  //# sourceMappingURL=index.d.ts.map
@@ -8,6 +8,7 @@ import { Document } from "@langchain/core/documents";
8
8
  * allowing for the encoding and decoding of keys and values. It extends
9
9
  * the BaseStore class.
10
10
  */
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
12
  declare class EncoderBackedStore<K, V, SerializedType = any> extends BaseStore<K, V> {
12
13
  lc_namespace: string[];
13
14
  store: BaseStore<string, SerializedType>;
@@ -8,6 +8,7 @@ import { Document } from "@langchain/core/documents";
8
8
  * allowing for the encoding and decoding of keys and values. It extends
9
9
  * the BaseStore class.
10
10
  */
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
12
  declare class EncoderBackedStore<K, V, SerializedType = any> extends BaseStore<K, V> {
12
13
  lc_namespace: string[];
13
14
  store: BaseStore<string, SerializedType>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Typescript bindings for langchain",
5
5
  "author": "LangChain",
6
6
  "license": "MIT",
@@ -53,14 +53,14 @@
53
53
  "typescript": "~5.8.3",
54
54
  "vitest": "^3.2.4",
55
55
  "yaml": "^2.8.1",
56
- "@langchain/anthropic": "1.2.2",
56
+ "@langchain/anthropic": "1.2.3",
57
57
  "@langchain/cohere": "1.0.1",
58
- "@langchain/core": "1.1.3",
58
+ "@langchain/core": "1.1.4",
59
59
  "@langchain/eslint": "0.1.1",
60
60
  "@langchain/openai": "1.1.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@langchain/core": "1.1.3"
63
+ "@langchain/core": "1.1.4"
64
64
  },
65
65
  "dependencies": {
66
66
  "@langchain/langgraph": "^1.0.0",