@langchain/core 1.1.1 → 1.1.3

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.
Files changed (233) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/agents.d.cts +0 -2
  3. package/dist/agents.d.ts +0 -2
  4. package/dist/callbacks/base.d.cts +22 -60
  5. package/dist/callbacks/base.d.ts +22 -60
  6. package/dist/callbacks/dispatch/index.d.cts +1 -3
  7. package/dist/callbacks/dispatch/index.d.ts +1 -3
  8. package/dist/callbacks/dispatch/web.d.cts +1 -3
  9. package/dist/callbacks/dispatch/web.d.ts +1 -3
  10. package/dist/callbacks/manager.d.cts +2 -12
  11. package/dist/callbacks/manager.d.ts +2 -12
  12. package/dist/chat_history.cjs +1 -1
  13. package/dist/chat_history.d.cts +0 -1
  14. package/dist/chat_history.d.ts +0 -1
  15. package/dist/chat_history.js +1 -1
  16. package/dist/document_loaders/langsmith.d.cts +0 -3
  17. package/dist/document_loaders/langsmith.d.ts +0 -3
  18. package/dist/documents/document.d.cts +3 -12
  19. package/dist/documents/document.d.ts +3 -12
  20. package/dist/example_selectors/length_based.d.cts +1 -1
  21. package/dist/example_selectors/length_based.d.ts +1 -1
  22. package/dist/indexing/base.d.cts +0 -1
  23. package/dist/indexing/base.d.ts +0 -1
  24. package/dist/indexing/record_manager.d.cts +0 -1
  25. package/dist/indexing/record_manager.d.ts +0 -1
  26. package/dist/language_models/base.d.cts +8 -38
  27. package/dist/language_models/base.d.ts +8 -38
  28. package/dist/language_models/chat_models.cjs +1 -1
  29. package/dist/language_models/chat_models.d.cts +6 -33
  30. package/dist/language_models/chat_models.d.ts +6 -33
  31. package/dist/language_models/chat_models.js +1 -1
  32. package/dist/language_models/llms.d.cts +0 -6
  33. package/dist/language_models/llms.d.ts +0 -6
  34. package/dist/load/import_type.d.cts +0 -1
  35. package/dist/load/import_type.d.ts +0 -1
  36. package/dist/load/map_keys.cjs +4 -5
  37. package/dist/load/map_keys.cjs.map +1 -1
  38. package/dist/load/map_keys.d.cts +0 -1
  39. package/dist/load/map_keys.d.ts +0 -1
  40. package/dist/load/map_keys.js +3 -3
  41. package/dist/load/map_keys.js.map +1 -1
  42. package/dist/load/serializable.d.cts +0 -1
  43. package/dist/load/serializable.d.ts +0 -1
  44. package/dist/memory.d.cts +0 -3
  45. package/dist/memory.d.ts +0 -3
  46. package/dist/messages/ai.cjs +6 -48
  47. package/dist/messages/ai.cjs.map +1 -1
  48. package/dist/messages/ai.js +6 -48
  49. package/dist/messages/ai.js.map +1 -1
  50. package/dist/messages/base.cjs +3 -2
  51. package/dist/messages/base.cjs.map +1 -1
  52. package/dist/messages/base.d.cts +1 -13
  53. package/dist/messages/base.d.ts +1 -13
  54. package/dist/messages/base.js +3 -2
  55. package/dist/messages/base.js.map +1 -1
  56. package/dist/messages/content/data.d.cts +2 -7
  57. package/dist/messages/content/data.d.ts +2 -7
  58. package/dist/messages/content/index.d.cts +1 -4
  59. package/dist/messages/content/index.d.ts +1 -4
  60. package/dist/messages/content/multimodal.d.cts +0 -1
  61. package/dist/messages/content/multimodal.d.ts +0 -1
  62. package/dist/messages/content/tools.d.cts +0 -1
  63. package/dist/messages/content/tools.d.ts +0 -1
  64. package/dist/messages/index.cjs +4 -2
  65. package/dist/messages/index.d.cts +2 -2
  66. package/dist/messages/index.d.ts +2 -2
  67. package/dist/messages/index.js +5 -4
  68. package/dist/messages/tool.d.cts +2 -9
  69. package/dist/messages/tool.d.ts +2 -9
  70. package/dist/messages/transformers.cjs +2 -2
  71. package/dist/messages/transformers.d.cts +0 -3
  72. package/dist/messages/transformers.d.ts +0 -3
  73. package/dist/messages/transformers.js +2 -2
  74. package/dist/messages/utils.cjs +77 -4
  75. package/dist/messages/utils.cjs.map +1 -1
  76. package/dist/messages/utils.d.cts +35 -7
  77. package/dist/messages/utils.d.ts +35 -7
  78. package/dist/messages/utils.js +77 -5
  79. package/dist/messages/utils.js.map +1 -1
  80. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs +169 -0
  81. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs.map +1 -0
  82. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js +168 -0
  83. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js.map +1 -0
  84. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs +122 -0
  85. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs.map +1 -0
  86. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js +121 -0
  87. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js.map +1 -0
  88. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs +18 -0
  89. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs.map +1 -0
  90. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js +17 -0
  91. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js.map +1 -0
  92. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.cjs +27 -0
  93. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.cjs.map +1 -0
  94. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js +26 -0
  95. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js.map +1 -0
  96. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.cjs +141 -0
  97. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.cjs.map +1 -0
  98. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js +141 -0
  99. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js.map +1 -0
  100. package/dist/output_parsers/json.cjs.map +1 -1
  101. package/dist/output_parsers/json.d.cts +1 -5
  102. package/dist/output_parsers/json.d.ts +1 -5
  103. package/dist/output_parsers/json.js.map +1 -1
  104. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +2 -6
  105. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +2 -6
  106. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +10 -34
  107. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +10 -34
  108. package/dist/output_parsers/transform.d.cts +0 -1
  109. package/dist/output_parsers/transform.d.ts +0 -1
  110. package/dist/outputs.d.cts +0 -6
  111. package/dist/outputs.d.ts +0 -6
  112. package/dist/prompts/base.d.cts +2 -10
  113. package/dist/prompts/base.d.ts +2 -10
  114. package/dist/prompts/chat.cjs +2 -2
  115. package/dist/prompts/chat.d.cts +13 -51
  116. package/dist/prompts/chat.d.ts +13 -51
  117. package/dist/prompts/chat.js +2 -2
  118. package/dist/prompts/few_shot.d.cts +1 -5
  119. package/dist/prompts/few_shot.d.ts +1 -5
  120. package/dist/prompts/image.d.cts +2 -10
  121. package/dist/prompts/image.d.ts +2 -10
  122. package/dist/prompts/prompt.d.cts +4 -15
  123. package/dist/prompts/prompt.d.ts +4 -16
  124. package/dist/prompts/serde.d.cts +0 -1
  125. package/dist/prompts/serde.d.ts +0 -1
  126. package/dist/prompts/string.d.cts +1 -5
  127. package/dist/prompts/string.d.ts +1 -5
  128. package/dist/prompts/structured.d.cts +3 -16
  129. package/dist/prompts/structured.d.ts +3 -16
  130. package/dist/retrievers/document_compressors/index.d.cts +0 -1
  131. package/dist/retrievers/document_compressors/index.d.ts +0 -1
  132. package/dist/retrievers/index.d.cts +2 -6
  133. package/dist/retrievers/index.d.ts +2 -6
  134. package/dist/runnables/base.cjs +7 -7
  135. package/dist/runnables/base.cjs.map +1 -1
  136. package/dist/runnables/base.d.cts +12 -64
  137. package/dist/runnables/base.d.ts +12 -64
  138. package/dist/runnables/base.js +1 -1
  139. package/dist/runnables/branch.d.cts +0 -2
  140. package/dist/runnables/branch.d.ts +0 -2
  141. package/dist/runnables/config.d.cts +0 -1
  142. package/dist/runnables/config.d.ts +0 -1
  143. package/dist/runnables/graph.d.cts +1 -5
  144. package/dist/runnables/graph.d.ts +1 -5
  145. package/dist/runnables/graph_mermaid.cjs +2 -1
  146. package/dist/runnables/graph_mermaid.cjs.map +1 -1
  147. package/dist/runnables/graph_mermaid.js +3 -1
  148. package/dist/runnables/graph_mermaid.js.map +1 -1
  149. package/dist/runnables/history.cjs +1 -1
  150. package/dist/runnables/history.d.cts +4 -12
  151. package/dist/runnables/history.d.ts +4 -12
  152. package/dist/runnables/history.js +1 -1
  153. package/dist/runnables/passthrough.d.cts +0 -2
  154. package/dist/runnables/passthrough.d.ts +0 -2
  155. package/dist/runnables/router.d.cts +0 -1
  156. package/dist/runnables/router.d.ts +0 -1
  157. package/dist/runnables/types.d.cts +2 -9
  158. package/dist/runnables/types.d.ts +2 -9
  159. package/dist/runnables/utils.cjs +5 -0
  160. package/dist/runnables/utils.cjs.map +1 -1
  161. package/dist/runnables/utils.js +5 -1
  162. package/dist/runnables/utils.js.map +1 -1
  163. package/dist/singletons/async_local_storage/context.d.cts +0 -2
  164. package/dist/singletons/async_local_storage/context.d.ts +0 -2
  165. package/dist/singletons/async_local_storage/globals.d.cts +0 -1
  166. package/dist/singletons/async_local_storage/globals.d.ts +0 -1
  167. package/dist/singletons/callbacks.cjs.map +1 -1
  168. package/dist/singletons/callbacks.js.map +1 -1
  169. package/dist/stores.d.cts +0 -1
  170. package/dist/stores.d.ts +0 -1
  171. package/dist/structured_query/utils.d.cts +1 -4
  172. package/dist/structured_query/utils.d.ts +1 -4
  173. package/dist/tools/index.d.cts +1 -6
  174. package/dist/tools/index.d.ts +1 -6
  175. package/dist/tools/types.d.cts +3 -13
  176. package/dist/tools/types.d.ts +3 -13
  177. package/dist/tracers/base.d.cts +1 -20
  178. package/dist/tracers/base.d.ts +1 -20
  179. package/dist/tracers/console.cjs +3 -3
  180. package/dist/tracers/console.cjs.map +1 -1
  181. package/dist/tracers/console.d.cts +0 -2
  182. package/dist/tracers/console.d.ts +0 -2
  183. package/dist/tracers/console.js +3 -3
  184. package/dist/tracers/console.js.map +1 -1
  185. package/dist/tracers/event_stream.d.cts +0 -4
  186. package/dist/tracers/event_stream.d.ts +0 -4
  187. package/dist/tracers/log_stream.d.cts +0 -6
  188. package/dist/tracers/log_stream.d.ts +0 -6
  189. package/dist/types/_internal.d.cts +0 -3
  190. package/dist/types/_internal.d.ts +0 -3
  191. package/dist/types/type-utils.d.cts +0 -2
  192. package/dist/types/type-utils.d.ts +0 -2
  193. package/dist/utils/async_caller.cjs +2 -7
  194. package/dist/utils/async_caller.cjs.map +1 -1
  195. package/dist/utils/async_caller.d.cts +0 -3
  196. package/dist/utils/async_caller.d.ts +0 -3
  197. package/dist/utils/async_caller.js +1 -6
  198. package/dist/utils/async_caller.js.map +1 -1
  199. package/dist/utils/env.d.cts +0 -4
  200. package/dist/utils/env.d.ts +0 -4
  201. package/dist/utils/event_source_parse.d.cts +1 -4
  202. package/dist/utils/event_source_parse.d.ts +1 -4
  203. package/dist/utils/function_calling.d.cts +1 -3
  204. package/dist/utils/function_calling.d.ts +1 -3
  205. package/dist/utils/json.cjs +182 -22
  206. package/dist/utils/json.cjs.map +1 -1
  207. package/dist/utils/json.d.cts +1 -3
  208. package/dist/utils/json.d.ts +1 -3
  209. package/dist/utils/json.js +182 -22
  210. package/dist/utils/json.js.map +1 -1
  211. package/dist/utils/stream.d.cts +1 -13
  212. package/dist/utils/stream.d.ts +1 -13
  213. package/dist/utils/testing/chat_models.d.cts +3 -11
  214. package/dist/utils/testing/chat_models.d.ts +3 -11
  215. package/dist/utils/testing/message_history.cjs +1 -1
  216. package/dist/utils/testing/message_history.js +1 -1
  217. package/dist/utils/testing/retrievers.d.cts +1 -3
  218. package/dist/utils/testing/retrievers.d.ts +1 -3
  219. package/dist/utils/testing/vectorstores.d.cts +0 -1
  220. package/dist/utils/testing/vectorstores.d.ts +0 -1
  221. package/dist/utils/types/index.cjs +4 -0
  222. package/dist/utils/types/index.d.cts +2 -4
  223. package/dist/utils/types/index.d.ts +2 -4
  224. package/dist/utils/types/index.js +4 -2
  225. package/dist/utils/types/zod.cjs +24 -0
  226. package/dist/utils/types/zod.cjs.map +1 -1
  227. package/dist/utils/types/zod.d.cts +4 -4
  228. package/dist/utils/types/zod.d.ts +4 -4
  229. package/dist/utils/types/zod.js +23 -1
  230. package/dist/utils/types/zod.js.map +1 -1
  231. package/dist/vectorstores.d.cts +5 -17
  232. package/dist/vectorstores.d.ts +5 -17
  233. package/package.json +6 -6
@@ -1,7 +1,5 @@
1
1
  //#region src/documents/document.d.ts
2
- interface DocumentInput<
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- Metadata extends Record<string, any> = Record<string, any>> {
2
+ interface DocumentInput<Metadata extends Record<string, any> = Record<string, any>> {
5
3
  pageContent: string;
6
4
  metadata?: Metadata;
7
5
  /**
@@ -12,9 +10,7 @@ Metadata extends Record<string, any> = Record<string, any>> {
12
10
  */
13
11
  id?: string;
14
12
  }
15
- interface DocumentInterface<
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- Metadata extends Record<string, any> = Record<string, any>> {
13
+ interface DocumentInterface<Metadata extends Record<string, any> = Record<string, any>> {
18
14
  pageContent: string;
19
15
  metadata: Metadata;
20
16
  /**
@@ -28,14 +24,9 @@ Metadata extends Record<string, any> = Record<string, any>> {
28
24
  /**
29
25
  * Interface for interacting with a document.
30
26
  */
31
- declare class Document<
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
27
+ declare class Document<Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
34
28
  pageContent: string;
35
29
  metadata: Metadata;
36
- // The ID field is optional at the moment.
37
- // It will likely become required in a future major release after
38
- // it has been adopted by enough vectorstore implementations.
39
30
  /**
40
31
  * An optional identifier for the document.
41
32
  *
@@ -1,7 +1,5 @@
1
1
  //#region src/documents/document.d.ts
2
- interface DocumentInput<
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- Metadata extends Record<string, any> = Record<string, any>> {
2
+ interface DocumentInput<Metadata extends Record<string, any> = Record<string, any>> {
5
3
  pageContent: string;
6
4
  metadata?: Metadata;
7
5
  /**
@@ -12,9 +10,7 @@ Metadata extends Record<string, any> = Record<string, any>> {
12
10
  */
13
11
  id?: string;
14
12
  }
15
- interface DocumentInterface<
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- Metadata extends Record<string, any> = Record<string, any>> {
13
+ interface DocumentInterface<Metadata extends Record<string, any> = Record<string, any>> {
18
14
  pageContent: string;
19
15
  metadata: Metadata;
20
16
  /**
@@ -28,14 +24,9 @@ Metadata extends Record<string, any> = Record<string, any>> {
28
24
  /**
29
25
  * Interface for interacting with a document.
30
26
  */
31
- declare class Document<
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
27
+ declare class Document<Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
34
28
  pageContent: string;
35
29
  metadata: Metadata;
36
- // The ID field is optional at the moment.
37
- // It will likely become required in a future major release after
38
- // it has been adopted by enough vectorstore implementations.
39
30
  /**
40
31
  * An optional identifier for the document.
41
32
  *
@@ -56,7 +56,7 @@ interface LengthBasedExampleSelectorInput {
56
56
  */
57
57
  declare class LengthBasedExampleSelector extends BaseExampleSelector {
58
58
  protected examples: Example[];
59
- examplePrompt!: PromptTemplate;
59
+ examplePrompt: PromptTemplate;
60
60
  getTextLength: (text: string) => number;
61
61
  maxLength: number;
62
62
  exampleTextLengths: number[];
@@ -56,7 +56,7 @@ interface LengthBasedExampleSelectorInput {
56
56
  */
57
57
  declare class LengthBasedExampleSelector extends BaseExampleSelector {
58
58
  protected examples: Example[];
59
- examplePrompt!: PromptTemplate;
59
+ examplePrompt: PromptTemplate;
60
60
  getTextLength: (text: string) => number;
61
61
  maxLength: number;
62
62
  exampleTextLengths: number[];
@@ -89,7 +89,6 @@ type IndexOptions = {
89
89
  declare function _batch<T>(size: number, iterable: T[]): T[][];
90
90
  declare function _deduplicateInOrder(hashedDocuments: HashedDocumentInterface[]): HashedDocumentInterface[];
91
91
  declare function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null;
92
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
92
  declare const _isBaseDocumentLoader: (arg: any) => arg is BaseDocumentLoader;
94
93
  interface IndexArgs {
95
94
  docsSource: BaseDocumentLoader | DocumentInterface[];
@@ -89,7 +89,6 @@ type IndexOptions = {
89
89
  declare function _batch<T>(size: number, iterable: T[]): T[][];
90
90
  declare function _deduplicateInOrder(hashedDocuments: HashedDocumentInterface[]): HashedDocumentInterface[];
91
91
  declare function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null;
92
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
92
  declare const _isBaseDocumentLoader: (arg: any) => arg is BaseDocumentLoader;
94
93
  interface IndexArgs {
95
94
  docsSource: BaseDocumentLoader | DocumentInterface[];
@@ -1,7 +1,6 @@
1
1
  import { Serializable } from "../load/serializable.cjs";
2
2
 
3
3
  //#region src/indexing/record_manager.d.ts
4
- // Arbitrary value, used for generating namespaced UUIDs.
5
4
  declare const UUIDV5_NAMESPACE = "10f90ea3-90a4-4962-bf75-83a0f3c1c62a";
6
5
  type UpdateOptions = {
7
6
  groupIds?: (string | null)[];
@@ -1,7 +1,6 @@
1
1
  import { Serializable } from "../load/serializable.js";
2
2
 
3
3
  //#region src/indexing/record_manager.d.ts
4
- // Arbitrary value, used for generating namespaced UUIDs.
5
4
  declare const UUIDV5_NAMESPACE = "10f90ea3-90a4-4962-bf75-83a0f3c1c62a";
6
5
  type UpdateOptions = {
7
6
  groupIds?: (string | null)[];
@@ -14,7 +14,6 @@ import { $ZodType } from "zod/v4/core";
14
14
  import { TiktokenModel } from "js-tiktoken/lite";
15
15
 
16
16
  //#region src/language_models/base.d.ts
17
- // https://www.npmjs.com/package/js-tiktoken
18
17
  declare const getModelNameForTiktoken: (modelName: string) => TiktokenModel;
19
18
  declare const getEmbeddingContextSize: (modelName?: string | undefined) => number;
20
19
  /**
@@ -152,15 +151,12 @@ type StructuredOutputMethodOptions<IncludeRaw extends boolean = false> = {
152
151
  /** @deprecated Use StructuredOutputMethodOptions instead */
153
152
  type StructuredOutputMethodParams<RunOutput, IncludeRaw extends boolean = false> = {
154
153
  /** @deprecated Pass schema in as the first argument */
155
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
156
154
  schema: InteropZodType<RunOutput> | Record<string, any>;
157
155
  name?: string;
158
156
  method?: "functionCalling" | "jsonMode";
159
157
  includeRaw?: IncludeRaw;
160
158
  };
161
- interface BaseLanguageModelInterface<
162
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
163
- RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
159
+ interface BaseLanguageModelInterface<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
164
160
  get callKeys(): string[];
165
161
  generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
166
162
  _modelType(): string;
@@ -169,7 +165,6 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
169
165
  /**
170
166
  * Get the identifying parameters of the LLM.
171
167
  */
172
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
173
168
  _identifyingParams(): Record<string, any>;
174
169
  serialize(): SerializedLLM;
175
170
  }
@@ -178,9 +173,7 @@ type LanguageModelLike = Runnable<BaseLanguageModelInput, LanguageModelOutput>;
178
173
  /**
179
174
  * Base class for language models.
180
175
  */
181
- declare abstract class BaseLanguageModel<
182
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
183
- RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
176
+ declare abstract class BaseLanguageModel<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
184
177
  /**
185
178
  * Keys that the language model accepts as call options.
186
179
  */
@@ -210,16 +203,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
210
203
  /**
211
204
  * Get the identifying parameters of the LLM.
212
205
  */
213
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
214
206
  _identifyingParams(): Record<string, any>;
215
207
  /**
216
208
  * Create a unique cache key for a specific call to a specific language model.
217
209
  * @param callOptions Call options for the model
218
210
  * @returns A unique cache key.
219
211
  */
220
- _getSerializedCacheKeyParametersForCall(
221
- // TODO: Fix when we remove the RunnableLambda backwards compatibility shim.
222
- {
212
+ _getSerializedCacheKeyParametersForCall({
223
213
  config,
224
214
  ...callOptions
225
215
  }: CallOptions & {
@@ -241,29 +231,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
241
231
  * @returns {ModelProfile} An object describing the model's capabilities and constraints
242
232
  */
243
233
  get profile(): ModelProfile;
244
- withStructuredOutput?<
245
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
246
- RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
247
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
248
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
249
- withStructuredOutput?<
250
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
251
- RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
252
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
253
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
234
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
235
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
254
236
  raw: BaseMessage;
255
237
  parsed: RunOutput;
256
238
  }>;
257
- withStructuredOutput?<
258
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
259
- RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
260
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
261
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
262
- withStructuredOutput?<
263
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
264
- RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
265
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
266
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
239
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
240
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
267
241
  raw: BaseMessage;
268
242
  parsed: RunOutput;
269
243
  }>;
@@ -280,11 +254,7 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
280
254
  * @param {boolean | undefined} [includeRaw=false] Whether to include the raw output in the result. Defaults to false.
281
255
  * @returns {Runnable<RunInput, RunOutput> | Runnable<RunInput, { raw: BaseMessage; parsed: RunOutput }>} A new runnable that calls the LLM with structured output.
282
256
  */
283
- withStructuredOutput?<
284
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
285
- RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput>
286
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
287
- | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
257
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
288
258
  raw: BaseMessage;
289
259
  parsed: RunOutput;
290
260
  }>;
@@ -16,7 +16,6 @@ import { $ZodType } from "zod/v4/core";
16
16
  import { TiktokenModel } from "js-tiktoken/lite";
17
17
 
18
18
  //#region src/language_models/base.d.ts
19
- // https://www.npmjs.com/package/js-tiktoken
20
19
  declare const getModelNameForTiktoken: (modelName: string) => TiktokenModel;
21
20
  declare const getEmbeddingContextSize: (modelName?: string | undefined) => number;
22
21
  /**
@@ -154,15 +153,12 @@ type StructuredOutputMethodOptions<IncludeRaw extends boolean = false> = {
154
153
  /** @deprecated Use StructuredOutputMethodOptions instead */
155
154
  type StructuredOutputMethodParams<RunOutput, IncludeRaw extends boolean = false> = {
156
155
  /** @deprecated Pass schema in as the first argument */
157
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
158
156
  schema: InteropZodType<RunOutput> | Record<string, any>;
159
157
  name?: string;
160
158
  method?: "functionCalling" | "jsonMode";
161
159
  includeRaw?: IncludeRaw;
162
160
  };
163
- interface BaseLanguageModelInterface<
164
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
- RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
161
+ interface BaseLanguageModelInterface<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
166
162
  get callKeys(): string[];
167
163
  generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
168
164
  _modelType(): string;
@@ -171,7 +167,6 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
171
167
  /**
172
168
  * Get the identifying parameters of the LLM.
173
169
  */
174
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
175
170
  _identifyingParams(): Record<string, any>;
176
171
  serialize(): SerializedLLM;
177
172
  }
@@ -180,9 +175,7 @@ type LanguageModelLike = Runnable<BaseLanguageModelInput, LanguageModelOutput>;
180
175
  /**
181
176
  * Base class for language models.
182
177
  */
183
- declare abstract class BaseLanguageModel<
184
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
185
- RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
178
+ declare abstract class BaseLanguageModel<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
186
179
  /**
187
180
  * Keys that the language model accepts as call options.
188
181
  */
@@ -212,16 +205,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
212
205
  /**
213
206
  * Get the identifying parameters of the LLM.
214
207
  */
215
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
208
  _identifyingParams(): Record<string, any>;
217
209
  /**
218
210
  * Create a unique cache key for a specific call to a specific language model.
219
211
  * @param callOptions Call options for the model
220
212
  * @returns A unique cache key.
221
213
  */
222
- _getSerializedCacheKeyParametersForCall(
223
- // TODO: Fix when we remove the RunnableLambda backwards compatibility shim.
224
- {
214
+ _getSerializedCacheKeyParametersForCall({
225
215
  config,
226
216
  ...callOptions
227
217
  }: CallOptions & {
@@ -243,29 +233,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
243
233
  * @returns {ModelProfile} An object describing the model's capabilities and constraints
244
234
  */
245
235
  get profile(): ModelProfile;
246
- withStructuredOutput?<
247
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
248
- RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
249
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
250
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
251
- withStructuredOutput?<
252
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
253
- RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
254
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
255
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
236
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
237
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
256
238
  raw: BaseMessage;
257
239
  parsed: RunOutput;
258
240
  }>;
259
- withStructuredOutput?<
260
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
261
- RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
262
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
263
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
264
- withStructuredOutput?<
265
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
266
- RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
267
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
268
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
241
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
242
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
269
243
  raw: BaseMessage;
270
244
  parsed: RunOutput;
271
245
  }>;
@@ -282,11 +256,7 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
282
256
  * @param {boolean | undefined} [includeRaw=false] Whether to include the raw output in the result. Defaults to false.
283
257
  * @returns {Runnable<RunInput, RunOutput> | Runnable<RunInput, { raw: BaseMessage; parsed: RunOutput }>} A new runnable that calls the LLM with structured output.
284
258
  */
285
- withStructuredOutput?<
286
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
287
- RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput>
288
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
289
- | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
259
+ withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
290
260
  raw: BaseMessage;
291
261
  parsed: RunOutput;
292
262
  }>;
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_data = require('../messages/content/data.cjs');
3
3
  const require_base = require('../messages/base.cjs');
4
- const require_ai = require('../messages/ai.cjs');
5
4
  const require_utils = require('../messages/utils.cjs');
5
+ const require_ai = require('../messages/ai.cjs');
6
6
  const require_utils_env = require('../utils/env.cjs');
7
7
  const require_callbacks_base = require('../callbacks/base.cjs');
8
8
  const require_callbacks_manager = require('../callbacks/manager.cjs');
@@ -13,7 +13,6 @@ import { ZodType } from "zod/v3";
13
13
  import { $ZodType } from "zod/v4/core";
14
14
 
15
15
  //#region src/language_models/chat_models.d.ts
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
16
  type ToolChoice = string | Record<string, any> | "auto" | "any";
18
17
  /**
19
18
  * Represents a serialized chat model.
@@ -22,7 +21,6 @@ type SerializedChatModel = {
22
21
  _model: string;
23
22
  _type: string;
24
23
  } & Record<string, any>;
25
- // todo?
26
24
  /**
27
25
  * Represents a serialized large language model.
28
26
  */
@@ -105,19 +103,13 @@ type LangSmithParams = {
105
103
  ls_max_tokens?: number;
106
104
  ls_stop?: Array<string>;
107
105
  };
108
- type BindToolsInput = StructuredToolInterface
109
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
- | Record<string, any> | ToolDefinition | RunnableToolLike | StructuredToolParams;
106
+ type BindToolsInput = StructuredToolInterface | Record<string, any> | ToolDefinition | RunnableToolLike | StructuredToolParams;
111
107
  /**
112
108
  * Base class for chat models. It extends the BaseLanguageModel class and
113
109
  * provides methods for generating chat based on input messages.
114
110
  */
115
- declare abstract class BaseChatModel<CallOptions extends BaseChatModelCallOptions = BaseChatModelCallOptions,
116
- // TODO: Fix the parameter order on the next minor version.
117
- OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguageModel<OutputMessageType, CallOptions> {
118
- // Backwards compatibility since fields have been moved to RunnableConfig
111
+ declare abstract class BaseChatModel<CallOptions extends BaseChatModelCallOptions = BaseChatModelCallOptions, OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguageModel<OutputMessageType, CallOptions> {
119
112
  ParsedCallOptions: Omit<CallOptions, Exclude<keyof RunnableConfig, "signal" | "timeout" | "maxConcurrency">>;
120
- // Only ever instantiated in main LangChain
121
113
  lc_namespace: string[];
122
114
  disableStreaming: boolean;
123
115
  outputVersion?: MessageOutputVersion;
@@ -141,7 +133,6 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
141
133
  * @returns A Promise that resolves to a BaseMessageChunk.
142
134
  */
143
135
  invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<OutputMessageType>;
144
- // eslint-disable-next-line require-yield
145
136
  _streamResponseChunks(_messages: BaseMessage[], _options: this["ParsedCallOptions"], _runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
146
137
  _streamIterator(input: BaseLanguageModelInput, options?: CallOptions): AsyncGenerator<OutputMessageType>;
147
138
  getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
@@ -157,7 +148,6 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
157
148
  messages: BaseMessageLike[][];
158
149
  cache: BaseCache<Generation[]>;
159
150
  llmStringKey: string;
160
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
161
151
  parsedOptions: any;
162
152
  handledOptions: RunnableConfig;
163
153
  }): Promise<LLMResult & {
@@ -175,7 +165,6 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
175
165
  /**
176
166
  * Get the parameters used to invoke the model
177
167
  */
178
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
179
168
  invocationParams(_options?: this["ParsedCallOptions"]): any;
180
169
  _modelType(): string;
181
170
  abstract _llmType(): string;
@@ -188,29 +177,13 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
188
177
  */
189
178
  generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
190
179
  abstract _generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
191
- withStructuredOutput<
192
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
193
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput>
194
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
195
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
196
- withStructuredOutput<
197
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
198
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput>
199
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
200
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
180
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
181
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
201
182
  raw: BaseMessage;
202
183
  parsed: RunOutput;
203
184
  }>;
204
- withStructuredOutput<
205
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
206
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput>
207
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
208
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
209
- withStructuredOutput<
210
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
211
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput>
212
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
213
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
185
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
186
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
214
187
  raw: BaseMessage;
215
188
  parsed: RunOutput;
216
189
  }>;
@@ -16,7 +16,6 @@ import { ZodType } from "zod/v3";
16
16
  import { $ZodType } from "zod/v4/core";
17
17
 
18
18
  //#region src/language_models/chat_models.d.ts
19
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
19
  type ToolChoice = string | Record<string, any> | "auto" | "any";
21
20
  /**
22
21
  * Represents a serialized chat model.
@@ -25,7 +24,6 @@ type SerializedChatModel = {
25
24
  _model: string;
26
25
  _type: string;
27
26
  } & Record<string, any>;
28
- // todo?
29
27
  /**
30
28
  * Represents a serialized large language model.
31
29
  */
@@ -108,19 +106,13 @@ type LangSmithParams = {
108
106
  ls_max_tokens?: number;
109
107
  ls_stop?: Array<string>;
110
108
  };
111
- type BindToolsInput = StructuredToolInterface
112
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
- | Record<string, any> | ToolDefinition | RunnableToolLike | StructuredToolParams;
109
+ type BindToolsInput = StructuredToolInterface | Record<string, any> | ToolDefinition | RunnableToolLike | StructuredToolParams;
114
110
  /**
115
111
  * Base class for chat models. It extends the BaseLanguageModel class and
116
112
  * provides methods for generating chat based on input messages.
117
113
  */
118
- declare abstract class BaseChatModel<CallOptions extends BaseChatModelCallOptions = BaseChatModelCallOptions,
119
- // TODO: Fix the parameter order on the next minor version.
120
- OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguageModel<OutputMessageType, CallOptions> {
121
- // Backwards compatibility since fields have been moved to RunnableConfig
114
+ declare abstract class BaseChatModel<CallOptions extends BaseChatModelCallOptions = BaseChatModelCallOptions, OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguageModel<OutputMessageType, CallOptions> {
122
115
  ParsedCallOptions: Omit<CallOptions, Exclude<keyof RunnableConfig, "signal" | "timeout" | "maxConcurrency">>;
123
- // Only ever instantiated in main LangChain
124
116
  lc_namespace: string[];
125
117
  disableStreaming: boolean;
126
118
  outputVersion?: MessageOutputVersion;
@@ -144,7 +136,6 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
144
136
  * @returns A Promise that resolves to a BaseMessageChunk.
145
137
  */
146
138
  invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<OutputMessageType>;
147
- // eslint-disable-next-line require-yield
148
139
  _streamResponseChunks(_messages: BaseMessage[], _options: this["ParsedCallOptions"], _runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
149
140
  _streamIterator(input: BaseLanguageModelInput, options?: CallOptions): AsyncGenerator<OutputMessageType>;
150
141
  getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
@@ -160,7 +151,6 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
160
151
  messages: BaseMessageLike[][];
161
152
  cache: BaseCache<Generation[]>;
162
153
  llmStringKey: string;
163
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
154
  parsedOptions: any;
165
155
  handledOptions: RunnableConfig;
166
156
  }): Promise<LLMResult & {
@@ -178,7 +168,6 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
178
168
  /**
179
169
  * Get the parameters used to invoke the model
180
170
  */
181
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
182
171
  invocationParams(_options?: this["ParsedCallOptions"]): any;
183
172
  _modelType(): string;
184
173
  abstract _llmType(): string;
@@ -191,29 +180,13 @@ OutputMessageType extends BaseMessageChunk = AIMessageChunk> extends BaseLanguag
191
180
  */
192
181
  generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
193
182
  abstract _generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
194
- withStructuredOutput<
195
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
196
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput>
197
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
198
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
199
- withStructuredOutput<
200
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
201
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput>
202
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
203
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
183
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
184
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
204
185
  raw: BaseMessage;
205
186
  parsed: RunOutput;
206
187
  }>;
207
- withStructuredOutput<
208
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
209
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput>
210
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
211
- | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
212
- withStructuredOutput<
213
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
214
- RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput>
215
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
- | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
188
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
189
+ withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
217
190
  raw: BaseMessage;
218
191
  parsed: RunOutput;
219
192
  }>;
@@ -1,8 +1,8 @@
1
1
  import { __export } from "../_virtual/rolldown_runtime.js";
2
2
  import { convertToOpenAIImageBlock, isBase64ContentBlock, isURLContentBlock } from "../messages/content/data.js";
3
3
  import { isBaseMessage } from "../messages/base.js";
4
- import { AIMessage, AIMessageChunk, isAIMessage, isAIMessageChunk } from "../messages/ai.js";
5
4
  import { coerceMessageLikeToMessage } from "../messages/utils.js";
5
+ import { AIMessage, AIMessageChunk, isAIMessage, isAIMessageChunk } from "../messages/ai.js";
6
6
  import { getEnvironmentVariable } from "../utils/env.js";
7
7
  import { callbackHandlerPrefersStreaming } from "../callbacks/base.js";
8
8
  import { CallbackManager } from "../callbacks/manager.js";
@@ -16,9 +16,7 @@ interface BaseLLMCallOptions extends BaseLanguageModelCallOptions {}
16
16
  * LLM Wrapper. Takes in a prompt (or prompts) and returns a string.
17
17
  */
18
18
  declare abstract class BaseLLM<CallOptions extends BaseLLMCallOptions = BaseLLMCallOptions> extends BaseLanguageModel<string, CallOptions> {
19
- // Backwards compatibility since fields have been moved to RunnableConfig
20
19
  ParsedCallOptions: Omit<CallOptions, Exclude<keyof RunnableConfig, "signal" | "timeout" | "maxConcurrency">>;
21
- // Only ever instantiated in main LangChain
22
20
  lc_namespace: string[];
23
21
  /**
24
22
  * This method takes an input and options, and returns a string. It
@@ -29,7 +27,6 @@ declare abstract class BaseLLM<CallOptions extends BaseLLMCallOptions = BaseLLMC
29
27
  * @returns A string result based on the prompt.
30
28
  */
31
29
  invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<string>;
32
- // eslint-disable-next-line require-yield
33
30
  _streamResponseChunks(_input: string, _options: this["ParsedCallOptions"], _runManager?: CallbackManagerForLLMRun): AsyncGenerator<GenerationChunk>;
34
31
  protected _separateRunnableConfigFromCallOptionsCompat(options?: Partial<CallOptions>): [RunnableConfig, this["ParsedCallOptions"]];
35
32
  _streamIterator(input: BaseLanguageModelInput, options?: CallOptions): AsyncGenerator<string>;
@@ -49,7 +46,6 @@ declare abstract class BaseLLM<CallOptions extends BaseLLMCallOptions = BaseLLMC
49
46
  /**
50
47
  * Get the parameters used to invoke the model
51
48
  */
52
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
49
  invocationParams(_options?: this["ParsedCallOptions"]): any;
54
50
  _flattenLLMResult(llmResult: LLMResult): LLMResult[];
55
51
  /** @ignore */
@@ -65,7 +61,6 @@ declare abstract class BaseLLM<CallOptions extends BaseLLMCallOptions = BaseLLMC
65
61
  prompts: string[];
66
62
  cache: BaseCache<Generation[]>;
67
63
  llmStringKey: string;
68
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
64
  parsedOptions: any;
70
65
  handledOptions: RunnableConfig;
71
66
  runId?: string;
@@ -80,7 +75,6 @@ declare abstract class BaseLLM<CallOptions extends BaseLLMCallOptions = BaseLLMC
80
75
  /**
81
76
  * Get the identifying parameters of the LLM.
82
77
  */
83
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
78
  _identifyingParams(): Record<string, any>;
85
79
  /**
86
80
  * Return the string type key uniquely identifying this class of LLM.