@langchain/core 1.1.5-dev-1765432861398 → 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.
Files changed (276) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/agents.cjs +1 -0
  3. package/agents.d.cts +1 -0
  4. package/agents.d.ts +1 -0
  5. package/agents.js +1 -0
  6. package/caches.cjs +1 -0
  7. package/caches.d.cts +1 -0
  8. package/caches.d.ts +1 -0
  9. package/caches.js +1 -0
  10. package/callbacks/base.cjs +1 -0
  11. package/callbacks/base.d.cts +1 -0
  12. package/callbacks/base.d.ts +1 -0
  13. package/callbacks/base.js +1 -0
  14. package/callbacks/dispatch/web.cjs +1 -0
  15. package/callbacks/dispatch/web.d.cts +1 -0
  16. package/callbacks/dispatch/web.d.ts +1 -0
  17. package/callbacks/dispatch/web.js +1 -0
  18. package/callbacks/dispatch.cjs +1 -0
  19. package/callbacks/dispatch.d.cts +1 -0
  20. package/callbacks/dispatch.d.ts +1 -0
  21. package/callbacks/dispatch.js +1 -0
  22. package/callbacks/manager.cjs +1 -0
  23. package/callbacks/manager.d.cts +1 -0
  24. package/callbacks/manager.d.ts +1 -0
  25. package/callbacks/manager.js +1 -0
  26. package/callbacks/promises.cjs +1 -0
  27. package/callbacks/promises.d.cts +1 -0
  28. package/callbacks/promises.d.ts +1 -0
  29. package/callbacks/promises.js +1 -0
  30. package/chat_history.cjs +1 -0
  31. package/chat_history.d.cts +1 -0
  32. package/chat_history.d.ts +1 -0
  33. package/chat_history.js +1 -0
  34. package/context.cjs +1 -0
  35. package/context.d.cts +1 -0
  36. package/context.d.ts +1 -0
  37. package/context.js +1 -0
  38. package/dist/load/index.d.cts.map +1 -1
  39. package/dist/messages/format.cjs +1 -1
  40. package/dist/messages/format.cjs.map +1 -1
  41. package/dist/messages/format.js +1 -1
  42. package/dist/messages/format.js.map +1 -1
  43. package/dist/runnables/graph_mermaid.cjs +9 -3
  44. package/dist/runnables/graph_mermaid.cjs.map +1 -1
  45. package/dist/runnables/graph_mermaid.js +9 -3
  46. package/dist/runnables/graph_mermaid.js.map +1 -1
  47. package/dist/tracers/base.cjs +9 -10
  48. package/dist/tracers/base.cjs.map +1 -1
  49. package/dist/tracers/base.js +9 -10
  50. package/dist/tracers/base.js.map +1 -1
  51. package/dist/utils/fast-json-patch/src/core.cjs +10 -0
  52. package/dist/utils/fast-json-patch/src/core.cjs.map +1 -1
  53. package/dist/utils/fast-json-patch/src/core.js +10 -0
  54. package/dist/utils/fast-json-patch/src/core.js.map +1 -1
  55. package/dist/utils/json_schema.cjs +4 -3
  56. package/dist/utils/json_schema.cjs.map +1 -1
  57. package/dist/utils/json_schema.d.cts +5 -2
  58. package/dist/utils/json_schema.d.cts.map +1 -1
  59. package/dist/utils/json_schema.d.ts +5 -2
  60. package/dist/utils/json_schema.d.ts.map +1 -1
  61. package/dist/utils/json_schema.js +4 -3
  62. package/dist/utils/json_schema.js.map +1 -1
  63. package/dist/utils/testing/chat_models.cjs +45 -1
  64. package/dist/utils/testing/chat_models.cjs.map +1 -1
  65. package/dist/utils/testing/chat_models.d.cts +3 -0
  66. package/dist/utils/testing/chat_models.d.cts.map +1 -1
  67. package/dist/utils/testing/chat_models.d.ts +3 -0
  68. package/dist/utils/testing/chat_models.d.ts.map +1 -1
  69. package/dist/utils/testing/chat_models.js +45 -1
  70. package/dist/utils/testing/chat_models.js.map +1 -1
  71. package/dist/utils/types/zod.cjs +1 -1
  72. package/dist/utils/types/zod.cjs.map +1 -1
  73. package/dist/utils/types/zod.js +1 -1
  74. package/dist/utils/types/zod.js.map +1 -1
  75. package/dist/vectorstores.d.cts.map +1 -1
  76. package/document_loaders/base.cjs +1 -0
  77. package/document_loaders/base.d.cts +1 -0
  78. package/document_loaders/base.d.ts +1 -0
  79. package/document_loaders/base.js +1 -0
  80. package/document_loaders/langsmith.cjs +1 -0
  81. package/document_loaders/langsmith.d.cts +1 -0
  82. package/document_loaders/langsmith.d.ts +1 -0
  83. package/document_loaders/langsmith.js +1 -0
  84. package/documents.cjs +1 -0
  85. package/documents.d.cts +1 -0
  86. package/documents.d.ts +1 -0
  87. package/documents.js +1 -0
  88. package/embeddings.cjs +1 -0
  89. package/embeddings.d.cts +1 -0
  90. package/embeddings.d.ts +1 -0
  91. package/embeddings.js +1 -0
  92. package/example_selectors.cjs +1 -0
  93. package/example_selectors.d.cts +1 -0
  94. package/example_selectors.d.ts +1 -0
  95. package/example_selectors.js +1 -0
  96. package/indexing.cjs +1 -0
  97. package/indexing.d.cts +1 -0
  98. package/indexing.d.ts +1 -0
  99. package/indexing.js +1 -0
  100. package/language_models/base.cjs +1 -0
  101. package/language_models/base.d.cts +1 -0
  102. package/language_models/base.d.ts +1 -0
  103. package/language_models/base.js +1 -0
  104. package/language_models/chat_models.cjs +1 -0
  105. package/language_models/chat_models.d.cts +1 -0
  106. package/language_models/chat_models.d.ts +1 -0
  107. package/language_models/chat_models.js +1 -0
  108. package/language_models/llms.cjs +1 -0
  109. package/language_models/llms.d.cts +1 -0
  110. package/language_models/llms.d.ts +1 -0
  111. package/language_models/llms.js +1 -0
  112. package/language_models/profile.cjs +1 -0
  113. package/language_models/profile.d.cts +1 -0
  114. package/language_models/profile.d.ts +1 -0
  115. package/language_models/profile.js +1 -0
  116. package/load/serializable.cjs +1 -0
  117. package/load/serializable.d.cts +1 -0
  118. package/load/serializable.d.ts +1 -0
  119. package/load/serializable.js +1 -0
  120. package/load.cjs +1 -0
  121. package/load.d.cts +1 -0
  122. package/load.d.ts +1 -0
  123. package/load.js +1 -0
  124. package/memory.cjs +1 -0
  125. package/memory.d.cts +1 -0
  126. package/memory.d.ts +1 -0
  127. package/memory.js +1 -0
  128. package/messages/tool.cjs +1 -0
  129. package/messages/tool.d.cts +1 -0
  130. package/messages/tool.d.ts +1 -0
  131. package/messages/tool.js +1 -0
  132. package/messages.cjs +1 -0
  133. package/messages.d.cts +1 -0
  134. package/messages.d.ts +1 -0
  135. package/messages.js +1 -0
  136. package/output_parsers/openai_functions.cjs +1 -0
  137. package/output_parsers/openai_functions.d.cts +1 -0
  138. package/output_parsers/openai_functions.d.ts +1 -0
  139. package/output_parsers/openai_functions.js +1 -0
  140. package/output_parsers/openai_tools.cjs +1 -0
  141. package/output_parsers/openai_tools.d.cts +1 -0
  142. package/output_parsers/openai_tools.d.ts +1 -0
  143. package/output_parsers/openai_tools.js +1 -0
  144. package/output_parsers.cjs +1 -0
  145. package/output_parsers.d.cts +1 -0
  146. package/output_parsers.d.ts +1 -0
  147. package/output_parsers.js +1 -0
  148. package/outputs.cjs +1 -0
  149. package/outputs.d.cts +1 -0
  150. package/outputs.d.ts +1 -0
  151. package/outputs.js +1 -0
  152. package/package.json +1 -1
  153. package/prompt_values.cjs +1 -0
  154. package/prompt_values.d.cts +1 -0
  155. package/prompt_values.d.ts +1 -0
  156. package/prompt_values.js +1 -0
  157. package/prompts.cjs +1 -0
  158. package/prompts.d.cts +1 -0
  159. package/prompts.d.ts +1 -0
  160. package/prompts.js +1 -0
  161. package/retrievers/document_compressors.cjs +1 -0
  162. package/retrievers/document_compressors.d.cts +1 -0
  163. package/retrievers/document_compressors.d.ts +1 -0
  164. package/retrievers/document_compressors.js +1 -0
  165. package/retrievers.cjs +1 -0
  166. package/retrievers.d.cts +1 -0
  167. package/retrievers.d.ts +1 -0
  168. package/retrievers.js +1 -0
  169. package/runnables/graph.cjs +1 -0
  170. package/runnables/graph.d.cts +1 -0
  171. package/runnables/graph.d.ts +1 -0
  172. package/runnables/graph.js +1 -0
  173. package/runnables.cjs +1 -0
  174. package/runnables.d.cts +1 -0
  175. package/runnables.d.ts +1 -0
  176. package/runnables.js +1 -0
  177. package/singletons.cjs +1 -0
  178. package/singletons.d.cts +1 -0
  179. package/singletons.d.ts +1 -0
  180. package/singletons.js +1 -0
  181. package/stores.cjs +1 -0
  182. package/stores.d.cts +1 -0
  183. package/stores.d.ts +1 -0
  184. package/stores.js +1 -0
  185. package/structured_query.cjs +1 -0
  186. package/structured_query.d.cts +1 -0
  187. package/structured_query.d.ts +1 -0
  188. package/structured_query.js +1 -0
  189. package/tools.cjs +1 -0
  190. package/tools.d.cts +1 -0
  191. package/tools.d.ts +1 -0
  192. package/tools.js +1 -0
  193. package/tracers/base.cjs +1 -0
  194. package/tracers/base.d.cts +1 -0
  195. package/tracers/base.d.ts +1 -0
  196. package/tracers/base.js +1 -0
  197. package/tracers/console.cjs +1 -0
  198. package/tracers/console.d.cts +1 -0
  199. package/tracers/console.d.ts +1 -0
  200. package/tracers/console.js +1 -0
  201. package/tracers/log_stream.cjs +1 -0
  202. package/tracers/log_stream.d.cts +1 -0
  203. package/tracers/log_stream.d.ts +1 -0
  204. package/tracers/log_stream.js +1 -0
  205. package/tracers/run_collector.cjs +1 -0
  206. package/tracers/run_collector.d.cts +1 -0
  207. package/tracers/run_collector.d.ts +1 -0
  208. package/tracers/run_collector.js +1 -0
  209. package/tracers/tracer_langchain.cjs +1 -0
  210. package/tracers/tracer_langchain.d.cts +1 -0
  211. package/tracers/tracer_langchain.d.ts +1 -0
  212. package/tracers/tracer_langchain.js +1 -0
  213. package/types/stream.cjs +1 -0
  214. package/types/stream.d.cts +1 -0
  215. package/types/stream.d.ts +1 -0
  216. package/types/stream.js +1 -0
  217. package/utils/async_caller.cjs +1 -0
  218. package/utils/async_caller.d.cts +1 -0
  219. package/utils/async_caller.d.ts +1 -0
  220. package/utils/async_caller.js +1 -0
  221. package/utils/chunk_array.cjs +1 -0
  222. package/utils/chunk_array.d.cts +1 -0
  223. package/utils/chunk_array.d.ts +1 -0
  224. package/utils/chunk_array.js +1 -0
  225. package/utils/env.cjs +1 -0
  226. package/utils/env.d.cts +1 -0
  227. package/utils/env.d.ts +1 -0
  228. package/utils/env.js +1 -0
  229. package/utils/event_source_parse.cjs +1 -0
  230. package/utils/event_source_parse.d.cts +1 -0
  231. package/utils/event_source_parse.d.ts +1 -0
  232. package/utils/event_source_parse.js +1 -0
  233. package/utils/format.cjs +1 -0
  234. package/utils/format.d.cts +1 -0
  235. package/utils/format.d.ts +1 -0
  236. package/utils/format.js +1 -0
  237. package/utils/function_calling.cjs +1 -0
  238. package/utils/function_calling.d.cts +1 -0
  239. package/utils/function_calling.d.ts +1 -0
  240. package/utils/function_calling.js +1 -0
  241. package/utils/hash.cjs +1 -0
  242. package/utils/hash.d.cts +1 -0
  243. package/utils/hash.d.ts +1 -0
  244. package/utils/hash.js +1 -0
  245. package/utils/json_patch.cjs +1 -0
  246. package/utils/json_patch.d.cts +1 -0
  247. package/utils/json_patch.d.ts +1 -0
  248. package/utils/json_patch.js +1 -0
  249. package/utils/json_schema.cjs +1 -0
  250. package/utils/json_schema.d.cts +1 -0
  251. package/utils/json_schema.d.ts +1 -0
  252. package/utils/json_schema.js +1 -0
  253. package/utils/math.cjs +1 -0
  254. package/utils/math.d.cts +1 -0
  255. package/utils/math.d.ts +1 -0
  256. package/utils/math.js +1 -0
  257. package/utils/stream.cjs +1 -0
  258. package/utils/stream.d.cts +1 -0
  259. package/utils/stream.d.ts +1 -0
  260. package/utils/stream.js +1 -0
  261. package/utils/testing.cjs +1 -0
  262. package/utils/testing.d.cts +1 -0
  263. package/utils/testing.d.ts +1 -0
  264. package/utils/testing.js +1 -0
  265. package/utils/tiktoken.cjs +1 -0
  266. package/utils/tiktoken.d.cts +1 -0
  267. package/utils/tiktoken.d.ts +1 -0
  268. package/utils/tiktoken.js +1 -0
  269. package/utils/types.cjs +1 -0
  270. package/utils/types.d.cts +1 -0
  271. package/utils/types.d.ts +1 -0
  272. package/utils/types.js +1 -0
  273. package/vectorstores.cjs +1 -0
  274. package/vectorstores.d.cts +1 -0
  275. package/vectorstores.d.ts +1 -0
  276. package/vectorstores.js +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"zod.js","names":["schema: unknown","schema: z3.ZodType<RunOutput> | Record<string, unknown>","input: unknown","obj: unknown","schema: InteropZodType<T>","schema: InteropZodType<unknown> | Record<string, unknown>","schema: T","extension: InteropZodObjectShape","outputShape: Mutable<z4.$ZodShape>","meta","schema: InteropZodType","recursive: boolean","cache: WeakMap<InteropZodType, InteropZodType>","outputSchema: InteropZodType","predicate: (key: string, value: InteropZodType) => boolean","modifiedShape: Record<string, z3.ZodTypeAny>","e: unknown"],"sources":["../../../src/utils/types/zod.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\nimport {\n parse,\n parseAsync,\n globalRegistry,\n util,\n clone,\n _unknown,\n _never,\n $ZodUnknown,\n $ZodNever,\n $ZodOptional,\n} from \"zod/v4/core\";\n\nexport type ZodStringV3 = z3.ZodString;\n\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\n\nexport type ZodObjectV4 = z4.$ZodObject;\n\nexport type ZodDefaultV3<T extends z3.ZodTypeAny> = z3.ZodDefault<T>;\nexport type ZodDefaultV4<T extends z4.SomeType> = z4.$ZodDefault<T>;\nexport type ZodOptionalV3<T extends z3.ZodTypeAny> = z3.ZodOptional<T>;\nexport type ZodOptionalV4<T extends z4.SomeType> = z4.$ZodOptional<T>;\nexport type ZodNullableV4<T extends z4.SomeType> = z4.$ZodNullable<T>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InteropZodType<Output = any, Input = Output> =\n | z3.ZodType<Output, z3.ZodTypeDef, Input>\n | z4.$ZodType<Output, Input>;\n\nexport type InteropZodObject = ZodObjectV3 | ZodObjectV4;\nexport type InteropZodDefault<T = InteropZodObjectShape> =\n T extends z3.ZodTypeAny\n ? ZodDefaultV3<T>\n : T extends z4.SomeType\n ? ZodDefaultV4<T>\n : never;\nexport type InteropZodOptional<T = InteropZodObjectShape> =\n T extends z3.ZodTypeAny\n ? ZodOptionalV3<T>\n : T extends z4.SomeType\n ? ZodOptionalV4<T>\n : never;\n\nexport type InteropZodObjectShape<\n T extends InteropZodObject = InteropZodObject\n> = T extends z3.ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : T extends z4.$ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : never;\n\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<\n unknown,\n z3.ZodTypeDef,\n infer Input\n>\n ? Input\n : T extends z4.$ZodType<unknown, infer Input>\n ? Input\n : T extends { _zod: { input: infer Input } }\n ? Input\n : never;\n\nexport type InferInteropZodOutput<T> = T extends z3.ZodType<\n infer Output,\n z3.ZodTypeDef,\n unknown\n>\n ? Output\n : T extends z4.$ZodType<infer Output, unknown>\n ? Output\n : T extends { _zod: { output: infer Output } }\n ? Output\n : never;\n\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\nexport function isZodSchemaV4(\n schema: unknown\n): schema is z4.$ZodType<unknown, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_zod\" in obj)) {\n return false;\n }\n\n const zod = obj._zod;\n return (\n typeof zod === \"object\" &&\n zod !== null &&\n \"def\" in (zod as Record<string, unknown>)\n );\n}\n\nexport function isZodSchemaV3(\n schema: unknown\n): schema is z3.ZodType<unknown, z3.ZodTypeDef, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_def\" in obj) || \"_zod\" in obj) {\n return false;\n }\n\n const def = obj._def;\n return (\n typeof def === \"object\" &&\n def != null &&\n \"typeName\" in (def as Record<string, unknown>)\n );\n}\n\n/** Backward compatible isZodSchema for Zod 3 */\nexport function isZodSchema<\n RunOutput extends Record<string, unknown> = Record<string, unknown>\n>(\n schema: z3.ZodType<RunOutput> | Record<string, unknown>\n): schema is z3.ZodType<RunOutput> {\n if (isZodSchemaV4(schema)) {\n console.warn(\n \"[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior.\"\n );\n }\n return isZodSchemaV3(schema);\n}\n\n/**\n * Given either a Zod schema, or plain object, determine if the input is a Zod schema.\n *\n * @param {unknown} input\n * @returns {boolean} Whether or not the provided input is a Zod schema.\n */\nexport function isInteropZodSchema(input: unknown): input is InteropZodType {\n if (!input) {\n return false;\n }\n if (typeof input !== \"object\") {\n return false;\n }\n if (Array.isArray(input)) {\n return false;\n }\n if (\n isZodSchemaV4(input) ||\n isZodSchemaV3(input as z3.ZodType<Record<string, unknown>>)\n ) {\n return true;\n }\n return false;\n}\n\nexport type InteropZodLiteral = z3.ZodLiteral<unknown> | z4.$ZodLiteral;\n\nexport function isZodLiteralV3(obj: unknown): obj is z3.ZodLiteral<unknown> {\n // Zod v3 literal schemas have _def.typeName === \"ZodLiteral\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodLiteral\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodLiteralV4(obj: unknown): obj is z4.$ZodLiteral {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 literal schemas have _zod.def.type === \"literal\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"literal\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodLiteral (Zod v3 or v4 literal schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 literal schema, false otherwise.\n */\nexport function isInteropZodLiteral(obj: unknown): obj is InteropZodLiteral {\n if (isZodLiteralV3(obj)) return true;\n if (isZodLiteralV4(obj)) return true;\n return false;\n}\n\ntype InteropZodSafeParseResult<T> = z3.SafeParseReturnType<T, T>;\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns a safe parse result.\n * This function handles both Zod v3 and v4 schemas, returning a result object indicating success or failure.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<InteropZodSafeParseResult<T>>} A promise that resolves to a safe parse result object.\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopSafeParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<InteropZodSafeParseResult<T>> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = await parseAsync(schema, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as z3.ZodError<T>,\n };\n }\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return await schema.safeParseAsync(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<T>} A promise that resolves to the parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<T> {\n if (isZodSchemaV4(schema)) {\n return await parseAsync(schema, input);\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return await schema.parseAsync(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Safely parses the input using the provided Zod schema (v3 or v4) and returns a result object\n * indicating success or failure. This function is compatible with both Zod v3 and v4 schemas.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {InteropZodSafeParseResult<T>} An object with either the parsed data (on success)\n * or the error (on failure).\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopSafeParse<T>(\n schema: InteropZodType<T>,\n input: unknown\n): InteropZodSafeParseResult<T> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = parse(schema, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as z3.ZodError<T>,\n };\n }\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.safeParse(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {T} The parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopParse<T>(schema: InteropZodType<T>, input: unknown): T {\n if (isZodSchemaV4(schema)) {\n return parse(schema, input);\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.parse(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Retrieves the description from a schema definition (v3, v4, or plain object), if available.\n *\n * @param {unknown} schema - The schema to extract the description from.\n * @returns {string | undefined} The description of the schema, or undefined if not present.\n */\nexport function getSchemaDescription(\n schema: InteropZodType<unknown> | Record<string, unknown>\n): string | undefined {\n if (isZodSchemaV4(schema)) {\n return globalRegistry.get(schema)?.description;\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.description as string | undefined;\n }\n if (\"description\" in schema && typeof schema.description === \"string\") {\n return schema.description;\n }\n return undefined;\n}\n\n/**\n * Determines if the provided Zod schema is \"shapeless\".\n * A shapeless schema is one that does not define any object shape,\n * such as ZodString, ZodNumber, ZodBoolean, ZodAny, etc.\n * For ZodObject, it must have no shape keys to be considered shapeless.\n * ZodRecord schemas are considered shapeless since they define dynamic\n * key-value mappings without fixed keys.\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is shapeless, false otherwise.\n */\nexport function isShapelessZodSchema(schema: unknown): boolean {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // Check for v3 schemas\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n // @ts-expect-error - zod v3 types are not compatible with zod v4 types\n const def = schema._def as { typeName?: string };\n\n // ZodObject is only shaped if it has actual shape keys\n if (def.typeName === \"ZodObject\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // ZodRecord is shapeless (dynamic key-value mapping)\n if (def.typeName === \"ZodRecord\") {\n return true;\n }\n }\n\n // Check for v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Object type is only shaped if it has actual shape keys\n if (def.type === \"object\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // Record type is shapeless (dynamic key-value mapping)\n if (def.type === \"record\") {\n return true;\n }\n }\n\n // For other schemas, check if they have a `shape` property\n // If they don't have shape, they're likely shapeless\n if (typeof schema === \"object\" && schema !== null && !(\"shape\" in schema)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Determines if the provided Zod schema should be treated as a simple string schema\n * that maps to DynamicTool. This aligns with the type-level constraint of\n * InteropZodType<string | undefined> which only matches basic string schemas.\n * If the provided schema is just z.string(), we can make the determination that\n * the tool is just a generic string tool that doesn't require any input validation.\n *\n * This function only returns true for basic ZodString schemas, including:\n * - Basic string schemas (z.string())\n * - String schemas with validations (z.string().min(1), z.string().email(), etc.)\n *\n * This function returns false for everything else, including:\n * - String schemas with defaults (z.string().default(\"value\"))\n * - Branded string schemas (z.string().brand<\"UserId\">())\n * - String schemas with catch operations (z.string().catch(\"default\"))\n * - Optional/nullable string schemas (z.string().optional())\n * - Transformed schemas (z.string().transform() or z.object().transform())\n * - Object or record schemas, even if they're empty\n * - Any other schema type\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is a basic ZodString, false otherwise.\n */\nexport function isSimpleStringZodSchema(\n schema: unknown\n): schema is InteropZodType<string | undefined> {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // For v3 schemas\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n // @ts-expect-error - zod v3 types are not compatible with zod v4 types\n const def = schema._def as { typeName?: string };\n\n // Only accept basic ZodString\n return def.typeName === \"ZodString\";\n }\n\n // For v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Only accept basic string type\n return def.type === \"string\";\n }\n\n return false;\n}\n\nexport function isZodObjectV3(obj: unknown): obj is ZodObjectV3 {\n // Zod v3 object schemas have _def.typeName === \"ZodObject\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodObject\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodObjectV4(obj: unknown): obj is z4.$ZodObject {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 object schemas have _zod.def.type === \"object\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"object\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodArrayV4(obj: unknown): obj is z4.$ZodArray {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 array schemas have _zod.def.type === \"array\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"array\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodOptionalV4(obj: unknown): obj is z4.$ZodOptional {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 optional schemas have _zod.def.type === \"optional\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"optional\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodNullableV4(obj: unknown): obj is z4.$ZodNullable {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 nullable schemas have _zod.def.type === \"nullable\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"nullable\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodObject (Zod v3 or v4 object schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 object schema, false otherwise.\n */\nexport function isInteropZodObject(obj: unknown): obj is InteropZodObject {\n if (isZodObjectV3(obj)) return true;\n if (isZodObjectV4(obj)) return true;\n return false;\n}\n\n/**\n * Retrieves the shape (fields) of a Zod object schema, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObjectShape<T>} The shape of the object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function getInteropZodObjectShape<T extends InteropZodObject>(\n schema: T\n): InteropZodObjectShape<T> {\n if (isZodSchemaV3(schema)) {\n return schema.shape;\n }\n if (isZodSchemaV4(schema)) {\n return schema._zod.def.shape as InteropZodObjectShape<T>;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Extends a Zod object schema with additional fields, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {InteropZodObjectShape} extension - The fields to add to the schema.\n * @returns {InteropZodObject} The extended Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function extendInteropZodObject<T extends InteropZodObject>(\n schema: T,\n extension: InteropZodObjectShape\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n return schema.extend(extension as z3.ZodRawShape);\n }\n if (isZodSchemaV4(schema)) {\n return util.extend(schema, extension);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a partial version of a Zod object schema, making all fields optional.\n * Supports both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObject} The partial Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPartial<T extends InteropZodObject>(\n schema: T\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n // z3: .partial() exists and works as expected\n return schema.partial();\n }\n if (isZodSchemaV4(schema)) {\n // z4: util.partial exists and works as expected\n return util.partial($ZodOptional, schema, undefined);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a strict version of a Zod object schema, disallowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies strictness\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply strictness recursively to nested objects/arrays.\n * @returns {InteropZodObject} The strict Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectStrict<T extends InteropZodObject>(\n schema: T,\n recursive = false\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.strict();\n }\n if (isZodObjectV4(schema)) {\n const outputShape: Mutable<z4.$ZodShape> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it strict\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectStrict(keySchema, recursive);\n outputShape[key] = outputSchema as ZodObjectV4;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema strict if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectStrict(\n elementSchema,\n recursive\n ) as ZodObjectV4;\n }\n outputShape[key] = clone(keySchema, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema);\n if (meta) globalRegistry.add(outputShape[key], meta);\n }\n }\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _never($ZodNever),\n });\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a passthrough version of a Zod object schema, allowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies passthrough\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply passthrough recursively to nested objects/arrays.\n * @returns {InteropZodObject} The passthrough Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPassthrough<T extends InteropZodObject>(\n schema: T,\n recursive = false\n): InteropZodObject {\n if (isZodObjectV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.passthrough();\n }\n if (isZodObjectV4(schema)) {\n const outputShape: Mutable<z4.$ZodShape> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it passthrough\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectPassthrough(\n keySchema,\n recursive\n );\n outputShape[key] = outputSchema as ZodObjectV4;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema passthrough if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectPassthrough(\n elementSchema,\n recursive\n ) as ZodObjectV4;\n }\n outputShape[key] = clone(keySchema, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema);\n if (meta) globalRegistry.add(outputShape[key], meta);\n }\n }\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _unknown($ZodUnknown),\n });\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a getter function for the default value of a Zod schema, if one is defined.\n * Supports both Zod v3 and v4 schemas. If the schema has a default value,\n * the returned function will return that value when called. If no default is defined,\n * returns undefined.\n *\n * @template T - The type of the Zod schema.\n * @param {T} schema - The Zod schema instance (either v3 or v4).\n * @returns {(() => InferInteropZodOutput<T>) | undefined} A function that returns the default value, or undefined if no default is set.\n */\nexport function getInteropZodDefaultGetter<T extends InteropZodType>(\n schema: T\n): (() => InferInteropZodOutput<T>) | undefined {\n if (isZodSchemaV3(schema)) {\n try {\n const defaultValue = schema.parse(undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n if (isZodSchemaV4(schema)) {\n try {\n const defaultValue = parse(schema, undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nfunction isZodTransformV3(\n schema: InteropZodType\n): schema is z3.ZodEffects<z3.ZodTypeAny> {\n return (\n isZodSchemaV3(schema) &&\n \"typeName\" in schema._def &&\n schema._def.typeName === \"ZodEffects\"\n );\n}\n\nfunction isZodTransformV4(schema: InteropZodType): schema is z4.$ZodPipe {\n return isZodSchemaV4(schema) && schema._zod.def.type === \"pipe\";\n}\n\nfunction interopZodTransformInputSchemaImpl(\n schema: InteropZodType,\n recursive: boolean,\n cache: WeakMap<InteropZodType, InteropZodType>\n): InteropZodType {\n const cached = cache.get(schema);\n if (cached !== undefined) {\n return cached;\n }\n\n // Zod v3: ._def.schema is the input schema for ZodEffects (transform)\n if (isZodSchemaV3(schema)) {\n if (isZodTransformV3(schema)) {\n return interopZodTransformInputSchemaImpl(\n schema._def.schema,\n recursive,\n cache\n );\n }\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema;\n }\n\n // Zod v4: _def.type is the input schema for ZodEffects (transform)\n if (isZodSchemaV4(schema)) {\n let outputSchema: InteropZodType = schema;\n if (isZodTransformV4(schema)) {\n outputSchema = interopZodTransformInputSchemaImpl(\n schema._zod.def.in,\n recursive,\n cache\n );\n }\n if (recursive) {\n // Handle nested object schemas\n if (isZodObjectV4(outputSchema)) {\n const outputShape: Mutable<z4.$ZodShape> = outputSchema._zod.def.shape;\n for (const [key, keySchema] of Object.entries(\n outputSchema._zod.def.shape\n )) {\n outputShape[key] = interopZodTransformInputSchemaImpl(\n keySchema,\n recursive,\n cache\n ) as z4.$ZodType;\n }\n outputSchema = clone<ZodObjectV4>(outputSchema, {\n ...outputSchema._zod.def,\n shape: outputShape,\n });\n }\n // Handle nested array schemas\n else if (isZodArrayV4(outputSchema)) {\n const elementSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.element,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodArray>(outputSchema, {\n ...outputSchema._zod.def,\n element: elementSchema as z4.$ZodType,\n });\n }\n // Handle optional schemas\n else if (isZodOptionalV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodOptional>(outputSchema, {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n });\n }\n // Handle nullable schemas\n else if (isZodNullableV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodNullable>(outputSchema, {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n });\n }\n }\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(outputSchema as z4.$ZodType, meta);\n cache.set(schema, outputSchema);\n return outputSchema;\n }\n\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Returns the input type of a Zod transform schema, for both v3 and v4.\n * If the schema is not a transform, returns undefined. If `recursive` is true,\n * recursively processes nested object schemas and arrays of object schemas.\n *\n * @param schema - The Zod schema instance (v3 or v4)\n * @param {boolean} [recursive=false] - Whether to recursively process nested objects/arrays.\n * @returns The input Zod schema of the transform, or undefined if not a transform\n */\nexport function interopZodTransformInputSchema(\n schema: InteropZodType,\n recursive = false\n): InteropZodType {\n const cache = new WeakMap<InteropZodType, InteropZodType>();\n return interopZodTransformInputSchemaImpl(schema, recursive, cache);\n}\n\n/**\n * Creates a modified version of a Zod object schema where fields matching a predicate are made optional.\n * Supports both Zod v3 and v4 schemas and preserves the original schema version.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {(key: string, value: InteropZodType) => boolean} predicate - Function to determine which fields should be optional.\n * @returns {InteropZodObject} The modified Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(\n schema: T,\n predicate: (key: string, value: InteropZodType) => boolean\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n const shape = getInteropZodObjectShape(schema);\n const modifiedShape: Record<string, z3.ZodTypeAny> = {};\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value)) {\n // Make this field optional using v3 methods\n modifiedShape[key] = (value as z3.ZodTypeAny).optional();\n } else {\n // Keep field as-is\n modifiedShape[key] = value;\n }\n }\n\n // Use v3's extend method to create a new schema with the modified shape\n return schema.extend(modifiedShape as z3.ZodRawShape);\n }\n\n if (isZodSchemaV4(schema)) {\n const shape = getInteropZodObjectShape(schema);\n const outputShape: Mutable<z4.$ZodShape> = { ...schema._zod.def.shape };\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value)) {\n // Make this field optional using v4 methods\n outputShape[key] = new $ZodOptional({\n type: \"optional\" as const,\n innerType: value as z4.$ZodType,\n });\n }\n // Otherwise keep the field as-is (already in outputShape)\n }\n\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n });\n\n // Preserve metadata\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n\n return modifiedSchema;\n }\n\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\nexport function isInteropZodError(e: unknown) {\n return (\n // eslint-disable-next-line no-instanceof/no-instanceof\n e instanceof Error &&\n (e.constructor.name === \"ZodError\" || e.constructor.name === \"$ZodError\")\n );\n}\n"],"mappings":";;;AAwFA,SAAgB,cACdA,QACyC;AACzC,KAAI,OAAO,WAAW,YAAY,WAAW,KAC3C,QAAO;CAGT,MAAM,MAAM;AACZ,KAAI,EAAE,UAAU,KACd,QAAO;CAGT,MAAM,MAAM,IAAI;AAChB,QACE,OAAO,QAAQ,YACf,QAAQ,QACR,SAAU;AAEb;AAED,SAAgB,cACdA,QACuD;AACvD,KAAI,OAAO,WAAW,YAAY,WAAW,KAC3C,QAAO;CAGT,MAAM,MAAM;AACZ,KAAI,EAAE,UAAU,QAAQ,UAAU,IAChC,QAAO;CAGT,MAAM,MAAM,IAAI;AAChB,QACE,OAAO,QAAQ,YACf,OAAO,QACP,cAAe;AAElB;;AAGD,SAAgB,YAGdC,QACiC;AACjC,KAAI,cAAc,OAAO,EACvB,QAAQ,KACN,4HACD;AAEH,QAAO,cAAc,OAAO;AAC7B;;;;;;;AAQD,SAAgB,mBAAmBC,OAAyC;AAC1E,KAAI,CAAC,MACH,QAAO;AAET,KAAI,OAAO,UAAU,SACnB,QAAO;AAET,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO;AAET,KACE,cAAc,MAAM,IACpB,cAAc,MAA6C,CAE3D,QAAO;AAET,QAAO;AACR;AAID,SAAgB,eAAeC,KAA6C;AAE1E,KACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,OAAO,IAAI,SAAS,YACpB,IAAI,SAAS,QACb,cAAc,IAAI,QAClB,IAAI,KAAK,aAAa,aAEtB,QAAO;AAET,QAAO;AACR;AAED,SAAgB,eAAeA,KAAqC;AAClE,KAAI,CAAC,cAAc,IAAI,CAAE,QAAO;AAEhC,KACE,OAAO,QAAQ,YAC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;EACzB,MAAM,QAAQ,yBAAyB,OAAO;EAC9C,MAAMP,cAAqC,EAAE,GAAG,OAAO,KAAK,IAAI,MAAO;AAEvE,OAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,MAAM,CAC9C,KAAI,UAAU,KAAK,MAAM,EAEvB,YAAY,OAAO,IAAI,aAAa;GAClC,MAAM;GACN,WAAW;EACZ;EAKL,MAAM,iBAAiB,MAAmB,QAAQ;GAChD,GAAG,OAAO,KAAK;GACf,OAAO;EACR,EAAC;EAGF,MAAM,OAAO,eAAe,IAAI,OAAO;AACvC,MAAI,MAAM,eAAe,IAAI,gBAAgB,KAAK;AAElD,SAAO;CACR;AAED,OAAM,IAAI,MACR;AAEH;AAED,SAAgB,kBAAkBQ,GAAY;AAC5C,QAEE,aAAa,UACZ,EAAE,YAAY,SAAS,cAAc,EAAE,YAAY,SAAS;AAEhE"}
1
+ {"version":3,"file":"zod.js","names":["schema: unknown","schema: z3.ZodType<RunOutput> | Record<string, unknown>","input: unknown","obj: unknown","schema: InteropZodType<T>","schema: InteropZodType<unknown> | Record<string, unknown>","schema: T","extension: InteropZodObjectShape","outputShape: Mutable<z4.$ZodShape>","meta","schema: InteropZodType","recursive: boolean","cache: WeakMap<InteropZodType, InteropZodType>","outputSchema: InteropZodType","predicate: (key: string, value: InteropZodType) => boolean","modifiedShape: Record<string, z3.ZodTypeAny>","e: unknown"],"sources":["../../../src/utils/types/zod.ts"],"sourcesContent":["import type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\nimport {\n parse,\n parseAsync,\n globalRegistry,\n util,\n clone,\n _unknown,\n _never,\n $ZodUnknown,\n $ZodNever,\n $ZodOptional,\n} from \"zod/v4/core\";\n\nexport type ZodStringV3 = z3.ZodString;\n\nexport type ZodStringV4 = z4.$ZodType<string, unknown>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ZodObjectV3 = z3.ZodObject<any, any, any, any>;\n\nexport type ZodObjectV4 = z4.$ZodObject;\n\nexport type ZodDefaultV3<T extends z3.ZodTypeAny> = z3.ZodDefault<T>;\nexport type ZodDefaultV4<T extends z4.SomeType> = z4.$ZodDefault<T>;\nexport type ZodOptionalV3<T extends z3.ZodTypeAny> = z3.ZodOptional<T>;\nexport type ZodOptionalV4<T extends z4.SomeType> = z4.$ZodOptional<T>;\nexport type ZodNullableV4<T extends z4.SomeType> = z4.$ZodNullable<T>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InteropZodType<Output = any, Input = Output> =\n | z3.ZodType<Output, z3.ZodTypeDef, Input>\n | z4.$ZodType<Output, Input>;\n\nexport type InteropZodObject = ZodObjectV3 | ZodObjectV4;\nexport type InteropZodDefault<T = InteropZodObjectShape> =\n T extends z3.ZodTypeAny\n ? ZodDefaultV3<T>\n : T extends z4.SomeType\n ? ZodDefaultV4<T>\n : never;\nexport type InteropZodOptional<T = InteropZodObjectShape> =\n T extends z3.ZodTypeAny\n ? ZodOptionalV3<T>\n : T extends z4.SomeType\n ? ZodOptionalV4<T>\n : never;\n\nexport type InteropZodObjectShape<\n T extends InteropZodObject = InteropZodObject\n> = T extends z3.ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : T extends z4.$ZodObject<infer Shape>\n ? { [K in keyof Shape]: Shape[K] }\n : never;\n\nexport type InteropZodIssue = z3.ZodIssue | z4.$ZodIssue;\n\n// Simplified type inference to avoid circular dependencies\nexport type InferInteropZodInput<T> = T extends z3.ZodType<\n unknown,\n z3.ZodTypeDef,\n infer Input\n>\n ? Input\n : T extends z4.$ZodType<unknown, infer Input>\n ? Input\n : T extends { _zod: { input: infer Input } }\n ? Input\n : never;\n\nexport type InferInteropZodOutput<T> = T extends z3.ZodType<\n infer Output,\n z3.ZodTypeDef,\n unknown\n>\n ? Output\n : T extends z4.$ZodType<infer Output, unknown>\n ? Output\n : T extends { _zod: { output: infer Output } }\n ? Output\n : never;\n\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\nexport function isZodSchemaV4(\n schema: unknown\n): schema is z4.$ZodType<unknown, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_zod\" in obj)) {\n return false;\n }\n\n const zod = obj._zod;\n return (\n typeof zod === \"object\" &&\n zod !== null &&\n \"def\" in (zod as Record<string, unknown>)\n );\n}\n\nexport function isZodSchemaV3(\n schema: unknown\n): schema is z3.ZodType<unknown, z3.ZodTypeDef, unknown> {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n\n const obj = schema as Record<string, unknown>;\n if (!(\"_def\" in obj) || \"_zod\" in obj) {\n return false;\n }\n\n const def = obj._def;\n return (\n typeof def === \"object\" &&\n def != null &&\n \"typeName\" in (def as Record<string, unknown>)\n );\n}\n\n/** Backward compatible isZodSchema for Zod 3 */\nexport function isZodSchema<\n RunOutput extends Record<string, unknown> = Record<string, unknown>\n>(\n schema: z3.ZodType<RunOutput> | Record<string, unknown>\n): schema is z3.ZodType<RunOutput> {\n if (isZodSchemaV4(schema)) {\n console.warn(\n \"[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior.\"\n );\n }\n return isZodSchemaV3(schema);\n}\n\n/**\n * Given either a Zod schema, or plain object, determine if the input is a Zod schema.\n *\n * @param {unknown} input\n * @returns {boolean} Whether or not the provided input is a Zod schema.\n */\nexport function isInteropZodSchema(input: unknown): input is InteropZodType {\n if (!input) {\n return false;\n }\n if (typeof input !== \"object\") {\n return false;\n }\n if (Array.isArray(input)) {\n return false;\n }\n if (\n isZodSchemaV4(input) ||\n isZodSchemaV3(input as z3.ZodType<Record<string, unknown>>)\n ) {\n return true;\n }\n return false;\n}\n\nexport type InteropZodLiteral = z3.ZodLiteral<unknown> | z4.$ZodLiteral;\n\nexport function isZodLiteralV3(obj: unknown): obj is z3.ZodLiteral<unknown> {\n // Zod v3 literal schemas have _def.typeName === \"ZodLiteral\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodLiteral\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodLiteralV4(obj: unknown): obj is z4.$ZodLiteral {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 literal schemas have _zod.def.type === \"literal\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"literal\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodLiteral (Zod v3 or v4 literal schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 literal schema, false otherwise.\n */\nexport function isInteropZodLiteral(obj: unknown): obj is InteropZodLiteral {\n if (isZodLiteralV3(obj)) return true;\n if (isZodLiteralV4(obj)) return true;\n return false;\n}\n\ntype InteropZodSafeParseResult<T> = z3.SafeParseReturnType<T, T>;\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns a safe parse result.\n * This function handles both Zod v3 and v4 schemas, returning a result object indicating success or failure.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<InteropZodSafeParseResult<T>>} A promise that resolves to a safe parse result object.\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopSafeParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<InteropZodSafeParseResult<T>> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = await parseAsync(schema, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as z3.ZodError<T>,\n };\n }\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return await schema.safeParseAsync(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {Promise<T>} A promise that resolves to the parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport async function interopParseAsync<T>(\n schema: InteropZodType<T>,\n input: unknown\n): Promise<T> {\n if (isZodSchemaV4(schema)) {\n return await parseAsync(schema, input);\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return await schema.parseAsync(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Safely parses the input using the provided Zod schema (v3 or v4) and returns a result object\n * indicating success or failure. This function is compatible with both Zod v3 and v4 schemas.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {InteropZodSafeParseResult<T>} An object with either the parsed data (on success)\n * or the error (on failure).\n * @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopSafeParse<T>(\n schema: InteropZodType<T>,\n input: unknown\n): InteropZodSafeParseResult<T> {\n if (isZodSchemaV4(schema)) {\n try {\n const data = parse(schema, input);\n return {\n success: true,\n data,\n };\n } catch (error) {\n return {\n success: false,\n error: error as z3.ZodError<T>,\n };\n }\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.safeParse(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n * Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n *\n * @template T - The expected output type of the schema.\n * @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n * @param {unknown} input - The input value to parse.\n * @returns {T} The parsed value.\n * @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n */\nexport function interopParse<T>(schema: InteropZodType<T>, input: unknown): T {\n if (isZodSchemaV4(schema)) {\n return parse(schema, input);\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.parse(input);\n }\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Retrieves the description from a schema definition (v3, v4, or plain object), if available.\n *\n * @param {unknown} schema - The schema to extract the description from.\n * @returns {string | undefined} The description of the schema, or undefined if not present.\n */\nexport function getSchemaDescription(\n schema: InteropZodType<unknown> | Record<string, unknown>\n): string | undefined {\n if (isZodSchemaV4(schema)) {\n return globalRegistry.get(schema)?.description;\n }\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n return schema.description as string | undefined;\n }\n if (\"description\" in schema && typeof schema.description === \"string\") {\n return schema.description;\n }\n return undefined;\n}\n\n/**\n * Determines if the provided Zod schema is \"shapeless\".\n * A shapeless schema is one that does not define any object shape,\n * such as ZodString, ZodNumber, ZodBoolean, ZodAny, etc.\n * For ZodObject, it must have no shape keys to be considered shapeless.\n * ZodRecord schemas are considered shapeless since they define dynamic\n * key-value mappings without fixed keys.\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is shapeless, false otherwise.\n */\nexport function isShapelessZodSchema(schema: unknown): boolean {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // Check for v3 schemas\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n // @ts-expect-error - zod v3 types are not compatible with zod v4 types\n const def = schema._def as { typeName?: string };\n\n // ZodObject is only shaped if it has actual shape keys\n if (def.typeName === \"ZodObject\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // ZodRecord is shapeless (dynamic key-value mapping)\n if (def.typeName === \"ZodRecord\") {\n return true;\n }\n }\n\n // Check for v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Object type is only shaped if it has actual shape keys\n if (def.type === \"object\") {\n const obj = schema as { shape?: Record<string, unknown> };\n return !obj.shape || Object.keys(obj.shape).length === 0;\n }\n\n // Record type is shapeless (dynamic key-value mapping)\n if (def.type === \"record\") {\n return true;\n }\n }\n\n // For other schemas, check if they have a `shape` property\n // If they don't have shape, they're likely shapeless\n if (typeof schema === \"object\" && schema !== null && !(\"shape\" in schema)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Determines if the provided Zod schema should be treated as a simple string schema\n * that maps to DynamicTool. This aligns with the type-level constraint of\n * InteropZodType<string | undefined> which only matches basic string schemas.\n * If the provided schema is just z.string(), we can make the determination that\n * the tool is just a generic string tool that doesn't require any input validation.\n *\n * This function only returns true for basic ZodString schemas, including:\n * - Basic string schemas (z.string())\n * - String schemas with validations (z.string().min(1), z.string().email(), etc.)\n *\n * This function returns false for everything else, including:\n * - String schemas with defaults (z.string().default(\"value\"))\n * - Branded string schemas (z.string().brand<\"UserId\">())\n * - String schemas with catch operations (z.string().catch(\"default\"))\n * - Optional/nullable string schemas (z.string().optional())\n * - Transformed schemas (z.string().transform() or z.object().transform())\n * - Object or record schemas, even if they're empty\n * - Any other schema type\n *\n * @param schema The Zod schema to check.\n * @returns {boolean} True if the schema is a basic ZodString, false otherwise.\n */\nexport function isSimpleStringZodSchema(\n schema: unknown\n): schema is InteropZodType<string | undefined> {\n if (!isInteropZodSchema(schema)) {\n return false;\n }\n\n // For v3 schemas\n if (isZodSchemaV3(schema as z3.ZodType<Record<string, unknown>>)) {\n // @ts-expect-error - zod v3 types are not compatible with zod v4 types\n const def = schema._def as { typeName?: string };\n\n // Only accept basic ZodString\n return def.typeName === \"ZodString\";\n }\n\n // For v4 schemas\n if (isZodSchemaV4(schema)) {\n const def = schema._zod.def;\n\n // Only accept basic string type\n return def.type === \"string\";\n }\n\n return false;\n}\n\nexport function isZodObjectV3(obj: unknown): obj is ZodObjectV3 {\n // Zod v3 object schemas have _def.typeName === \"ZodObject\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_def\" in obj &&\n typeof obj._def === \"object\" &&\n obj._def !== null &&\n \"typeName\" in obj._def &&\n obj._def.typeName === \"ZodObject\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodObjectV4(obj: unknown): obj is z4.$ZodObject {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 object schemas have _zod.def.type === \"object\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"object\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodArrayV4(obj: unknown): obj is z4.$ZodArray {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 array schemas have _zod.def.type === \"array\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"array\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodOptionalV4(obj: unknown): obj is z4.$ZodOptional {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 optional schemas have _zod.def.type === \"optional\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"optional\"\n ) {\n return true;\n }\n return false;\n}\n\nexport function isZodNullableV4(obj: unknown): obj is z4.$ZodNullable {\n if (!isZodSchemaV4(obj)) return false;\n // Zod v4 nullable schemas have _zod.def.type === \"nullable\"\n if (\n typeof obj === \"object\" &&\n obj !== null &&\n \"_zod\" in obj &&\n typeof obj._zod === \"object\" &&\n obj._zod !== null &&\n \"def\" in obj._zod &&\n typeof obj._zod.def === \"object\" &&\n obj._zod.def !== null &&\n \"type\" in obj._zod.def &&\n obj._zod.def.type === \"nullable\"\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * Determines if the provided value is an InteropZodObject (Zod v3 or v4 object schema).\n *\n * @param obj The value to check.\n * @returns {boolean} True if the value is a Zod v3 or v4 object schema, false otherwise.\n */\nexport function isInteropZodObject(obj: unknown): obj is InteropZodObject {\n if (isZodObjectV3(obj)) return true;\n if (isZodObjectV4(obj)) return true;\n return false;\n}\n\n/**\n * Retrieves the shape (fields) of a Zod object schema, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObjectShape<T>} The shape of the object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function getInteropZodObjectShape<T extends InteropZodObject>(\n schema: T\n): InteropZodObjectShape<T> {\n if (isZodSchemaV3(schema)) {\n return schema.shape;\n }\n if (isZodSchemaV4(schema)) {\n return schema._zod.def.shape as InteropZodObjectShape<T>;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Extends a Zod object schema with additional fields, supporting both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {InteropZodObjectShape} extension - The fields to add to the schema.\n * @returns {InteropZodObject} The extended Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function extendInteropZodObject<T extends InteropZodObject>(\n schema: T,\n extension: InteropZodObjectShape\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n return schema.extend(extension as z3.ZodRawShape);\n }\n if (isZodSchemaV4(schema)) {\n return util.extend(schema, extension);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a partial version of a Zod object schema, making all fields optional.\n * Supports both Zod v3 and v4.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @returns {InteropZodObject} The partial Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPartial<T extends InteropZodObject>(\n schema: T\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n // z3: .partial() exists and works as expected\n return schema.partial();\n }\n if (isZodSchemaV4(schema)) {\n // z4: util.partial exists and works as expected\n return util.partial($ZodOptional, schema, undefined);\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a strict version of a Zod object schema, disallowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies strictness\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply strictness recursively to nested objects/arrays.\n * @returns {InteropZodObject} The strict Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectStrict<T extends InteropZodObject>(\n schema: T,\n recursive = false\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.strict();\n }\n if (isZodObjectV4(schema)) {\n const outputShape: Mutable<z4.$ZodShape> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it strict\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectStrict(keySchema, recursive);\n outputShape[key] = outputSchema as ZodObjectV4;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema strict if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectStrict(\n elementSchema,\n recursive\n ) as ZodObjectV4;\n }\n outputShape[key] = clone(keySchema, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema);\n if (meta) globalRegistry.add(outputShape[key], meta);\n }\n }\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _never($ZodNever),\n });\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a passthrough version of a Zod object schema, allowing unknown keys.\n * Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies passthrough\n * recursively to all nested object schemas and arrays of object schemas.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {boolean} [recursive=false] - Whether to apply passthrough recursively to nested objects/arrays.\n * @returns {InteropZodObject} The passthrough Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectPassthrough<T extends InteropZodObject>(\n schema: T,\n recursive = false\n): InteropZodObject {\n if (isZodObjectV3(schema)) {\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema.passthrough();\n }\n if (isZodObjectV4(schema)) {\n const outputShape: Mutable<z4.$ZodShape> = schema._zod.def.shape;\n if (recursive) {\n for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n // If the shape key is a v4 object schema, we need to make it passthrough\n if (isZodObjectV4(keySchema)) {\n const outputSchema = interopZodObjectPassthrough(\n keySchema,\n recursive\n );\n outputShape[key] = outputSchema as ZodObjectV4;\n }\n // If the shape key is a v4 array schema, we need to make the element\n // schema passthrough if it's an object schema\n else if (isZodArrayV4(keySchema)) {\n let elementSchema = keySchema._zod.def.element;\n if (isZodObjectV4(elementSchema)) {\n elementSchema = interopZodObjectPassthrough(\n elementSchema,\n recursive\n ) as ZodObjectV4;\n }\n outputShape[key] = clone(keySchema, {\n ...keySchema._zod.def,\n element: elementSchema,\n });\n }\n // Otherwise, just use the keySchema\n else {\n outputShape[key] = keySchema;\n }\n // Assign meta fields to the keySchema\n const meta = globalRegistry.get(keySchema);\n if (meta) globalRegistry.add(outputShape[key], meta);\n }\n }\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n catchall: _unknown($ZodUnknown),\n });\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n return modifiedSchema;\n }\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\n/**\n * Returns a getter function for the default value of a Zod schema, if one is defined.\n * Supports both Zod v3 and v4 schemas. If the schema has a default value,\n * the returned function will return that value when called. If no default is defined,\n * returns undefined.\n *\n * @template T - The type of the Zod schema.\n * @param {T} schema - The Zod schema instance (either v3 or v4).\n * @returns {(() => InferInteropZodOutput<T>) | undefined} A function that returns the default value, or undefined if no default is set.\n */\nexport function getInteropZodDefaultGetter<T extends InteropZodType>(\n schema: T\n): (() => InferInteropZodOutput<T>) | undefined {\n if (isZodSchemaV3(schema)) {\n try {\n const defaultValue = schema.parse(undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n if (isZodSchemaV4(schema)) {\n try {\n const defaultValue = parse(schema, undefined);\n return () => defaultValue as InferInteropZodOutput<T>;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nfunction isZodTransformV3(\n schema: InteropZodType\n): schema is z3.ZodEffects<z3.ZodTypeAny> {\n return (\n isZodSchemaV3(schema) &&\n \"typeName\" in schema._def &&\n schema._def.typeName === \"ZodEffects\"\n );\n}\n\nfunction isZodTransformV4(schema: InteropZodType): schema is z4.$ZodPipe {\n return isZodSchemaV4(schema) && schema._zod.def.type === \"pipe\";\n}\n\nfunction interopZodTransformInputSchemaImpl(\n schema: InteropZodType,\n recursive: boolean,\n cache: WeakMap<InteropZodType, InteropZodType>\n): InteropZodType {\n const cached = cache.get(schema);\n if (cached !== undefined) {\n return cached;\n }\n\n // Zod v3: ._def.schema is the input schema for ZodEffects (transform)\n if (isZodSchemaV3(schema)) {\n if (isZodTransformV3(schema)) {\n return interopZodTransformInputSchemaImpl(\n schema._def.schema,\n recursive,\n cache\n );\n }\n // TODO: v3 schemas aren't recursively handled here\n // (currently not necessary since zodToJsonSchema handles this)\n return schema;\n }\n\n // Zod v4: _def.type is the input schema for ZodEffects (transform)\n if (isZodSchemaV4(schema)) {\n let outputSchema: InteropZodType = schema;\n if (isZodTransformV4(schema)) {\n outputSchema = interopZodTransformInputSchemaImpl(\n schema._zod.def.in,\n recursive,\n cache\n );\n }\n if (recursive) {\n // Handle nested object schemas\n if (isZodObjectV4(outputSchema)) {\n const outputShape: Mutable<z4.$ZodShape> = {};\n for (const [key, keySchema] of Object.entries(\n outputSchema._zod.def.shape\n )) {\n outputShape[key] = interopZodTransformInputSchemaImpl(\n keySchema,\n recursive,\n cache\n ) as z4.$ZodType;\n }\n outputSchema = clone<ZodObjectV4>(outputSchema, {\n ...outputSchema._zod.def,\n shape: outputShape,\n });\n }\n // Handle nested array schemas\n else if (isZodArrayV4(outputSchema)) {\n const elementSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.element,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodArray>(outputSchema, {\n ...outputSchema._zod.def,\n element: elementSchema as z4.$ZodType,\n });\n }\n // Handle optional schemas\n else if (isZodOptionalV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodOptional>(outputSchema, {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n });\n }\n // Handle nullable schemas\n else if (isZodNullableV4(outputSchema)) {\n const innerSchema = interopZodTransformInputSchemaImpl(\n outputSchema._zod.def.innerType as InteropZodType,\n recursive,\n cache\n );\n outputSchema = clone<z4.$ZodNullable>(outputSchema, {\n ...outputSchema._zod.def,\n innerType: innerSchema as z4.$ZodType,\n });\n }\n }\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(outputSchema as z4.$ZodType, meta);\n cache.set(schema, outputSchema);\n return outputSchema;\n }\n\n throw new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n\n/**\n * Returns the input type of a Zod transform schema, for both v3 and v4.\n * If the schema is not a transform, returns undefined. If `recursive` is true,\n * recursively processes nested object schemas and arrays of object schemas.\n *\n * @param schema - The Zod schema instance (v3 or v4)\n * @param {boolean} [recursive=false] - Whether to recursively process nested objects/arrays.\n * @returns The input Zod schema of the transform, or undefined if not a transform\n */\nexport function interopZodTransformInputSchema(\n schema: InteropZodType,\n recursive = false\n): InteropZodType {\n const cache = new WeakMap<InteropZodType, InteropZodType>();\n return interopZodTransformInputSchemaImpl(schema, recursive, cache);\n}\n\n/**\n * Creates a modified version of a Zod object schema where fields matching a predicate are made optional.\n * Supports both Zod v3 and v4 schemas and preserves the original schema version.\n *\n * @template T - The type of the Zod object schema.\n * @param {T} schema - The Zod object schema instance (either v3 or v4).\n * @param {(key: string, value: InteropZodType) => boolean} predicate - Function to determine which fields should be optional.\n * @returns {InteropZodObject} The modified Zod object schema.\n * @throws {Error} If the schema is not a Zod v3 or v4 object.\n */\nexport function interopZodObjectMakeFieldsOptional<T extends InteropZodObject>(\n schema: T,\n predicate: (key: string, value: InteropZodType) => boolean\n): InteropZodObject {\n if (isZodSchemaV3(schema)) {\n const shape = getInteropZodObjectShape(schema);\n const modifiedShape: Record<string, z3.ZodTypeAny> = {};\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value)) {\n // Make this field optional using v3 methods\n modifiedShape[key] = (value as z3.ZodTypeAny).optional();\n } else {\n // Keep field as-is\n modifiedShape[key] = value;\n }\n }\n\n // Use v3's extend method to create a new schema with the modified shape\n return schema.extend(modifiedShape as z3.ZodRawShape);\n }\n\n if (isZodSchemaV4(schema)) {\n const shape = getInteropZodObjectShape(schema);\n const outputShape: Mutable<z4.$ZodShape> = { ...schema._zod.def.shape };\n\n for (const [key, value] of Object.entries(shape)) {\n if (predicate(key, value)) {\n // Make this field optional using v4 methods\n outputShape[key] = new $ZodOptional({\n type: \"optional\" as const,\n innerType: value as z4.$ZodType,\n });\n }\n // Otherwise keep the field as-is (already in outputShape)\n }\n\n const modifiedSchema = clone<ZodObjectV4>(schema, {\n ...schema._zod.def,\n shape: outputShape,\n });\n\n // Preserve metadata\n const meta = globalRegistry.get(schema);\n if (meta) globalRegistry.add(modifiedSchema, meta);\n\n return modifiedSchema;\n }\n\n throw new Error(\n \"Schema must be an instance of z3.ZodObject or z4.$ZodObject\"\n );\n}\n\nexport function isInteropZodError(e: unknown) {\n return (\n // eslint-disable-next-line no-instanceof/no-instanceof\n e instanceof Error &&\n (e.constructor.name === \"ZodError\" || e.constructor.name === \"$ZodError\")\n );\n}\n"],"mappings":";;;AAwFA,SAAgB,cACdA,QACyC;AACzC,KAAI,OAAO,WAAW,YAAY,WAAW,KAC3C,QAAO;CAGT,MAAM,MAAM;AACZ,KAAI,EAAE,UAAU,KACd,QAAO;CAGT,MAAM,MAAM,IAAI;AAChB,QACE,OAAO,QAAQ,YACf,QAAQ,QACR,SAAU;AAEb;AAED,SAAgB,cACdA,QACuD;AACvD,KAAI,OAAO,WAAW,YAAY,WAAW,KAC3C,QAAO;CAGT,MAAM,MAAM;AACZ,K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S,cAAc,EAAE,YAAY,SAAS;AAEhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"vectorstores.d.cts","names":["EmbeddingsInterface","DocumentInterface","BaseRetriever","BaseRetrieverInterface","BaseRetrieverInput","Serializable","CallbackManagerForRetrieverRun","Callbacks","AddDocumentOptions","Record","MaxMarginalRelevanceSearchOptions","FilterType","VectorStoreRetrieverMMRSearchKwargs","VectorStoreRetrieverInput","V","VectorStoreInterface","VectorStoreRetrieverInterface","Promise","VectorStoreRetriever","Partial","VectorStore","SaveableVectorStore"],"sources":["../src/vectorstores.d.ts"],"sourcesContent":["import type { EmbeddingsInterface } from \"./embeddings.js\";\nimport type { DocumentInterface } from \"./documents/document.js\";\nimport { BaseRetriever, BaseRetrieverInterface, type BaseRetrieverInput } from \"./retrievers/index.js\";\nimport { Serializable } from \"./load/serializable.js\";\nimport { CallbackManagerForRetrieverRun, Callbacks } from \"./callbacks/manager.js\";\n/**\n * Type for options when adding a document to the VectorStore.\n */\ntype AddDocumentOptions = Record<string, any>;\n/**\n * Options for configuring a maximal marginal relevance (MMR) search.\n *\n * MMR search optimizes for both similarity to the query and diversity\n * among the results, balancing the retrieval of relevant documents\n * with variation in the content returned.\n *\n * Fields:\n *\n * - `fetchK` (optional): The initial number of documents to retrieve from the\n * vector store before applying the MMR algorithm. This larger set provides a\n * pool of documents from which the algorithm can select the most diverse\n * results based on relevance to the query.\n *\n * - `filter` (optional): A filter of type `FilterType` to refine the search\n * results, allowing additional conditions to target specific subsets\n * of documents.\n *\n * - `k`: The number of documents to return in the final results. This is the\n * primary count of documents that are most relevant to the query.\n *\n * - `lambda` (optional): A value between 0 and 1 that determines the balance\n * between relevance and diversity:\n * - A `lambda` of 0 emphasizes diversity, maximizing content variation.\n * - A `lambda` of 1 emphasizes similarity to the query, focusing on relevance.\n * Values between 0 and 1 provide a mix of relevance and diversity.\n *\n * @template FilterType - The type used for filtering results, as defined\n * by the vector store.\n */\nexport type MaxMarginalRelevanceSearchOptions<FilterType> = {\n k: number;\n fetchK?: number;\n lambda?: number;\n filter?: FilterType;\n};\n/**\n * Options for configuring a maximal marginal relevance (MMR) search\n * when using the `VectorStoreRetriever`.\n *\n * These parameters control how the MMR algorithm balances relevance to the\n * query and diversity among the retrieved documents.\n *\n * Fields:\n * - `fetchK` (optional): Specifies the initial number of documents to fetch\n * before applying the MMR algorithm. This larger set provides a pool of\n * documents from which the algorithm can select the most diverse results\n * based on relevance to the query.\n *\n * - `lambda` (optional): A value between 0 and 1 that determines the balance\n * between relevance and diversity:\n * - A `lambda` of 0 maximizes diversity among the results, prioritizing varied content.\n * - A `lambda` of 1 maximizes similarity to the query, prioritizing relevance.\n * Values between 0 and 1 provide a mix of relevance and diversity.\n */\nexport type VectorStoreRetrieverMMRSearchKwargs = {\n fetchK?: number;\n lambda?: number;\n};\n/**\n * Input configuration options for creating a `VectorStoreRetriever` instance.\n *\n * This type combines properties from `BaseRetrieverInput` with specific settings\n * for the `VectorStoreRetriever`, including options for similarity or maximal\n * marginal relevance (MMR) search types.\n *\n * Fields:\n *\n * - `callbacks` (optional): An array of callback functions that handle various\n * events during retrieval, such as logging, error handling, or progress updates.\n *\n * - `tags` (optional): An array of strings used to add contextual tags to\n * retrieval operations, allowing for easier categorization and tracking.\n *\n * - `metadata` (optional): A record of key-value pairs to store additional\n * contextual information for retrieval operations, which can be useful\n * for logging or auditing purposes.\n *\n * - `verbose` (optional): A boolean flag that, if set to `true`, enables\n * detailed logging and output during the retrieval process. Defaults to `false`.\n *\n * - `vectorStore`: The `VectorStore` instance implementing `VectorStoreInterface`\n * that will be used for document storage and retrieval.\n *\n * - `k` (optional): Specifies the number of documents to retrieve per search\n * query. Defaults to 4 if not specified.\n *\n * - `filter` (optional): A filter of type `FilterType` (defined by the vector store)\n * to refine the set of documents returned, allowing for targeted search results.\n *\n * - `searchType`: Determines the type of search to perform:\n * - `\"similarity\"`: Executes a similarity search, retrieving documents based purely\n * on vector similarity to the query.\n * - `\"mmr\"`: Executes a maximal marginal relevance (MMR) search, balancing similarity\n * and diversity in the search results.\n *\n * - `searchKwargs` (optional): Used only if `searchType` is `\"mmr\"`, this object\n * provides additional options for MMR search, including:\n * - `fetchK`: Specifies the number of documents to initially fetch before applying\n * the MMR algorithm, providing a pool from which the most diverse results are selected.\n * - `lambda`: A diversity parameter, where 0 emphasizes diversity and 1 emphasizes\n * relevance to the query. Values between 0 and 1 provide a balance of relevance and diversity.\n *\n * @template V - The type of vector store implementing `VectorStoreInterface`.\n */\nexport type VectorStoreRetrieverInput<V extends VectorStoreInterface> = BaseRetrieverInput & ({\n vectorStore: V;\n k?: number;\n filter?: V[\"FilterType\"];\n searchType?: \"similarity\";\n} | {\n vectorStore: V;\n k?: number;\n filter?: V[\"FilterType\"];\n searchType: \"mmr\";\n searchKwargs?: VectorStoreRetrieverMMRSearchKwargs;\n});\n/**\n * Interface for a retriever that uses a vector store to store and retrieve\n * document embeddings. This retriever interface allows for adding documents\n * to the underlying vector store and conducting retrieval operations.\n *\n * `VectorStoreRetrieverInterface` extends `BaseRetrieverInterface` to provide\n * document retrieval capabilities based on vector similarity.\n *\n * @interface VectorStoreRetrieverInterface\n * @extends BaseRetrieverInterface\n */\nexport interface VectorStoreRetrieverInterface<V extends VectorStoreInterface = VectorStoreInterface> extends BaseRetrieverInterface {\n vectorStore: V;\n /**\n * Adds an array of documents to the vector store.\n *\n * This method embeds the provided documents and stores them within the\n * vector store. Additional options can be specified for custom behavior\n * during the addition process.\n *\n * @param documents - An array of documents to embed and add to the vector store.\n * @param options - Optional settings to customize document addition.\n * @returns A promise that resolves to an array of document IDs or `void`,\n * depending on the implementation.\n */\n addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n}\n/**\n * Class for retrieving documents from a `VectorStore` based on vector similarity\n * or maximal marginal relevance (MMR).\n *\n * `VectorStoreRetriever` extends `BaseRetriever`, implementing methods for\n * adding documents to the underlying vector store and performing document\n * retrieval with optional configurations.\n *\n * @class VectorStoreRetriever\n * @extends BaseRetriever\n * @implements VectorStoreRetrieverInterface\n * @template V - Type of vector store implementing `VectorStoreInterface`.\n */\nexport declare class VectorStoreRetriever<V extends VectorStoreInterface = VectorStoreInterface> extends BaseRetriever implements VectorStoreRetrieverInterface {\n static lc_name(): string;\n get lc_namespace(): string[];\n /**\n * The instance of `VectorStore` used for storing and retrieving document embeddings.\n * This vector store must implement the `VectorStoreInterface` to be compatible\n * with the retriever’s operations.\n */\n vectorStore: V;\n /**\n * Specifies the number of documents to retrieve for each search query.\n * Defaults to 4 if not specified, providing a basic result count for similarity or MMR searches.\n */\n k: number;\n /**\n * Determines the type of search operation to perform on the vector store.\n *\n * - `\"similarity\"` (default): Conducts a similarity search based purely on vector similarity\n * to the query.\n * - `\"mmr\"`: Executes a maximal marginal relevance (MMR) search, balancing relevance and\n * diversity in the retrieved results.\n */\n searchType: string;\n /**\n * Additional options specific to maximal marginal relevance (MMR) search, applicable\n * only if `searchType` is set to `\"mmr\"`.\n *\n * Includes:\n * - `fetchK`: The initial number of documents fetched before applying the MMR algorithm,\n * allowing for a larger selection from which to choose the most diverse results.\n * - `lambda`: A parameter between 0 and 1 to adjust the relevance-diversity balance,\n * where 0 prioritizes diversity and 1 prioritizes relevance.\n */\n searchKwargs?: VectorStoreRetrieverMMRSearchKwargs;\n /**\n * Optional filter applied to search results, defined by the `FilterType` of the vector store.\n * Allows for refined, targeted results by restricting the returned documents based\n * on specified filter criteria.\n */\n filter?: V[\"FilterType\"];\n /**\n * Returns the type of vector store, as defined by the `vectorStore` instance.\n *\n * @returns {string} The vector store type.\n */\n _vectorstoreType(): string;\n /**\n * Initializes a new instance of `VectorStoreRetriever` with the specified configuration.\n *\n * This constructor configures the retriever to interact with a given `VectorStore`\n * and supports different retrieval strategies, including similarity search and maximal\n * marginal relevance (MMR) search. Various options allow customization of the number\n * of documents retrieved per query, filtering based on conditions, and fine-tuning\n * MMR-specific parameters.\n *\n * @param fields - Configuration options for setting up the retriever:\n *\n * - `vectorStore` (required): The `VectorStore` instance implementing `VectorStoreInterface`\n * that will be used to store and retrieve document embeddings. This is the core component\n * of the retriever, enabling vector-based similarity and MMR searches.\n *\n * - `k` (optional): Specifies the number of documents to retrieve per search query. If not\n * provided, defaults to 4. This count determines the number of most relevant documents returned\n * for each search operation, balancing performance with comprehensiveness.\n *\n * - `searchType` (optional): Defines the search approach used by the retriever, allowing for\n * flexibility between two methods:\n * - `\"similarity\"` (default): A similarity-based search, retrieving documents with high vector\n * similarity to the query. This type prioritizes relevance and is often used when diversity\n * among results is less critical.\n * - `\"mmr\"`: Maximal Marginal Relevance search, which combines relevance with diversity. MMR\n * is useful for scenarios where varied content is essential, as it selects results that\n * both match the query and introduce content diversity.\n *\n * - `filter` (optional): A filter of type `FilterType`, defined by the vector store, that allows\n * for refined and targeted search results. This filter applies specified conditions to limit\n * which documents are eligible for retrieval, offering control over the scope of results.\n *\n * - `searchKwargs` (optional, applicable only if `searchType` is `\"mmr\"`): Additional settings\n * for configuring MMR-specific behavior. These parameters allow further tuning of the MMR\n * search process:\n * - `fetchK`: The initial number of documents fetched from the vector store before the MMR\n * algorithm is applied. Fetching a larger set enables the algorithm to select a more\n * diverse subset of documents.\n * - `lambda`: A parameter controlling the relevance-diversity balance, where 0 emphasizes\n * diversity and 1 prioritizes relevance. Intermediate values provide a blend of the two,\n * allowing customization based on the importance of content variety relative to query relevance.\n */\n constructor(fields: VectorStoreRetrieverInput<V>);\n /**\n * Retrieves relevant documents based on the specified query, using either\n * similarity or maximal marginal relevance (MMR) search.\n *\n * If `searchType` is set to `\"mmr\"`, performs an MMR search to balance\n * similarity and diversity among results. If `searchType` is `\"similarity\"`,\n * retrieves results purely based on similarity to the query.\n *\n * @param query - The query string used to find relevant documents.\n * @param runManager - Optional callback manager for tracking retrieval progress.\n * @returns A promise that resolves to an array of `DocumentInterface` instances\n * representing the most relevant documents to the query.\n * @throws {Error} Throws an error if MMR search is requested but not supported\n * by the vector store.\n * @protected\n */\n _getRelevantDocuments(query: string, runManager?: CallbackManagerForRetrieverRun): Promise<DocumentInterface[]>;\n /**\n * Adds an array of documents to the vector store, embedding them as part of\n * the storage process.\n *\n * This method delegates document embedding and storage to the `addDocuments`\n * method of the underlying vector store.\n *\n * @param documents - An array of documents to embed and add to the vector store.\n * @param options - Optional settings to customize document addition.\n * @returns A promise that resolves to an array of document IDs or `void`,\n * depending on the vector store's implementation.\n */\n addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n}\n/**\n * Interface defining the structure and operations of a vector store, which\n * facilitates the storage, retrieval, and similarity search of document vectors.\n *\n * `VectorStoreInterface` provides methods for adding, deleting, and searching\n * documents based on vector embeddings, including support for similarity\n * search with optional filtering and relevance-based retrieval.\n *\n * @extends Serializable\n */\nexport interface VectorStoreInterface extends Serializable {\n /**\n * Defines the filter type used in search and delete operations. Can be an\n * object for structured conditions or a string for simpler filtering.\n */\n FilterType: object | string;\n /**\n * Instance of `EmbeddingsInterface` used to generate vector embeddings for\n * documents, enabling vector-based search operations.\n */\n embeddings: EmbeddingsInterface;\n /**\n * Returns a string identifying the type of vector store implementation,\n * useful for distinguishing between different vector storage backends.\n *\n * @returns {string} A string indicating the vector store type.\n */\n _vectorstoreType(): string;\n /**\n * Adds precomputed vectors and their corresponding documents to the vector store.\n *\n * @param vectors - An array of vectors, with each vector representing a document.\n * @param documents - An array of `DocumentInterface` instances corresponding to each vector.\n * @param options - Optional configurations for adding documents, potentially covering indexing or metadata handling.\n * @returns A promise that resolves to an array of document IDs or void, depending on implementation.\n */\n addVectors(vectors: number[][], documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Adds an array of documents to the vector store.\n *\n * @param documents - An array of documents to be embedded and stored in the vector store.\n * @param options - Optional configurations for embedding and storage operations.\n * @returns A promise that resolves to an array of document IDs or void, depending on implementation.\n */\n addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Deletes documents from the vector store based on the specified parameters.\n *\n * @param _params - A flexible object containing key-value pairs that define\n * the conditions for selecting documents to delete.\n * @returns A promise that resolves once the deletion operation is complete.\n */\n delete(_params?: Record<string, any>): Promise<void>;\n /**\n * Searches for documents similar to a given vector query and returns them\n * with similarity scores.\n *\n * @param query - A vector representing the query for similarity search.\n * @param k - The number of similar documents to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @returns A promise that resolves to an array of tuples, each containing a\n * `DocumentInterface` and its corresponding similarity score.\n */\n similaritySearchVectorWithScore(query: number[], k: number, filter?: this[\"FilterType\"]): Promise<[DocumentInterface, number][]>;\n /**\n * Searches for documents similar to a text query, embedding the query\n * and retrieving documents based on vector similarity.\n *\n * @param query - The text query to search for.\n * @param k - Optional number of similar documents to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @param callbacks - Optional callbacks for tracking progress or events\n * during the search process.\n * @returns A promise that resolves to an array of `DocumentInterface`\n * instances representing similar documents.\n */\n similaritySearch(query: string, k?: number, filter?: this[\"FilterType\"], callbacks?: Callbacks): Promise<DocumentInterface[]>;\n /**\n * Searches for documents similar to a text query and includes similarity\n * scores in the result.\n *\n * @param query - The text query to search for.\n * @param k - Optional number of similar documents to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @param callbacks - Optional callbacks for tracking progress or events\n * during the search process.\n * @returns A promise that resolves to an array of tuples, each containing\n * a `DocumentInterface` and its similarity score.\n */\n similaritySearchWithScore(query: string, k?: number, filter?: this[\"FilterType\"], callbacks?: Callbacks): Promise<[DocumentInterface, number][]>;\n /**\n * Return documents selected using the maximal marginal relevance.\n * Maximal marginal relevance optimizes for similarity to the query AND diversity\n * among selected documents.\n *\n * @param {string} query - Text to look up documents similar to.\n * @param {number} options.k - Number of documents to return.\n * @param {number} options.fetchK - Number of documents to fetch before passing to the MMR algorithm.\n * @param {number} options.lambda - Number between 0 and 1 that determines the degree of diversity among the results,\n * where 0 corresponds to maximum diversity and 1 to minimum diversity.\n * @param {this[\"FilterType\"]} options.filter - Optional filter\n * @param _callbacks\n *\n * @returns {Promise<DocumentInterface[]>} - List of documents selected by maximal marginal relevance.\n */\n maxMarginalRelevanceSearch?(query: string, options: MaxMarginalRelevanceSearchOptions<this[\"FilterType\"]>, callbacks: Callbacks | undefined): Promise<DocumentInterface[]>;\n /**\n * Converts the vector store into a retriever, making it suitable for use in\n * retrieval-based workflows and allowing additional configuration.\n *\n * @param kOrFields - Optional parameter for specifying either the number of\n * documents to retrieve or partial retriever configurations.\n * @param filter - Optional filter based on `FilterType` for retrieval restriction.\n * @param callbacks - Optional callbacks for tracking retrieval events or progress.\n * @param tags - General-purpose tags to add contextual information to the retriever.\n * @param metadata - General-purpose metadata providing additional context\n * for retrieval.\n * @param verbose - If `true`, enables detailed logging during retrieval.\n * @returns An instance of `VectorStoreRetriever` configured with the specified options.\n */\n asRetriever(kOrFields?: number | Partial<VectorStoreRetrieverInput<this>>, filter?: this[\"FilterType\"], callbacks?: Callbacks, tags?: string[], metadata?: Record<string, unknown>, verbose?: boolean): VectorStoreRetriever<this>;\n}\n/**\n * Abstract class representing a vector storage system for performing\n * similarity searches on embedded documents.\n *\n * `VectorStore` provides methods for adding precomputed vectors or documents,\n * removing documents based on criteria, and performing similarity searches\n * with optional scoring. Subclasses are responsible for implementing specific\n * storage mechanisms and the exact behavior of certain abstract methods.\n *\n * @abstract\n * @extends Serializable\n * @implements VectorStoreInterface\n */\nexport declare abstract class VectorStore extends Serializable implements VectorStoreInterface {\n FilterType: object | string;\n /**\n * Namespace within LangChain to uniquely identify this vector store's\n * location, based on the vector store type.\n *\n * @internal\n */\n lc_namespace: string[];\n /**\n * Embeddings interface for generating vector embeddings from text queries,\n * enabling vector-based similarity searches.\n */\n embeddings: EmbeddingsInterface;\n /**\n * Initializes a new vector store with embeddings and database configuration.\n *\n * @param embeddings - Instance of `EmbeddingsInterface` used to embed queries.\n * @param dbConfig - Configuration settings for the database or storage system.\n */\n constructor(embeddings: EmbeddingsInterface, dbConfig: Record<string, any>);\n /**\n * Returns a string representing the type of vector store, which subclasses\n * must implement to identify their specific vector storage type.\n *\n * @returns {string} A string indicating the vector store type.\n * @abstract\n */\n abstract _vectorstoreType(): string;\n /**\n * Adds precomputed vectors and corresponding documents to the vector store.\n *\n * @param vectors - An array of vectors representing each document.\n * @param documents - Array of documents associated with each vector.\n * @param options - Optional configuration for adding vectors, such as indexing.\n * @returns A promise resolving to an array of document IDs or void, based on implementation.\n * @abstract\n */\n abstract addVectors(vectors: number[][], documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Adds documents to the vector store, embedding them first through the\n * `embeddings` instance.\n *\n * @param documents - Array of documents to embed and add.\n * @param options - Optional configuration for embedding and storing documents.\n * @returns A promise resolving to an array of document IDs or void, based on implementation.\n * @abstract\n */\n abstract addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Deletes documents from the vector store based on the specified parameters.\n *\n * @param _params - Flexible key-value pairs defining conditions for document deletion.\n * @returns A promise that resolves once the deletion is complete.\n */\n delete(_params?: Record<string, any>): Promise<void>;\n /**\n * Performs a similarity search using a vector query and returns results\n * along with their similarity scores.\n *\n * @param query - Vector representing the search query.\n * @param k - Number of similar results to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @returns A promise resolving to an array of tuples containing documents and their similarity scores.\n * @abstract\n */\n abstract similaritySearchVectorWithScore(query: number[], k: number, filter?: this[\"FilterType\"]): Promise<[DocumentInterface, number][]>;\n /**\n * Searches for documents similar to a text query by embedding the query and\n * performing a similarity search on the resulting vector.\n *\n * @param query - Text query for finding similar documents.\n * @param k - Number of similar results to return. Defaults to 4.\n * @param filter - Optional filter based on `FilterType`.\n * @param _callbacks - Optional callbacks for monitoring search progress\n * @returns A promise resolving to an array of `DocumentInterface` instances representing similar documents.\n */\n similaritySearch(query: string, k?: number, filter?: this[\"FilterType\"] | undefined, _callbacks?: Callbacks | undefined): Promise<DocumentInterface[]>;\n /**\n * Searches for documents similar to a text query by embedding the query,\n * and returns results with similarity scores.\n *\n * @param query - Text query for finding similar documents.\n * @param k - Number of similar results to return. Defaults to 4.\n * @param filter - Optional filter based on `FilterType`.\n * @param _callbacks - Optional callbacks for monitoring search progress\n * @returns A promise resolving to an array of tuples, each containing a\n * document and its similarity score.\n */\n similaritySearchWithScore(query: string, k?: number, filter?: this[\"FilterType\"] | undefined, _callbacks?: Callbacks | undefined): Promise<[DocumentInterface, number][]>;\n /**\n * Return documents selected using the maximal marginal relevance.\n * Maximal marginal relevance optimizes for similarity to the query AND diversity\n * among selected documents.\n *\n * @param {string} query - Text to look up documents similar to.\n * @param {number} options.k - Number of documents to return.\n * @param {number} options.fetchK - Number of documents to fetch before passing to the MMR algorithm.\n * @param {number} options.lambda - Number between 0 and 1 that determines the degree of diversity among the results,\n * where 0 corresponds to maximum diversity and 1 to minimum diversity.\n * @param {this[\"FilterType\"]} options.filter - Optional filter\n * @param _callbacks\n *\n * @returns {Promise<DocumentInterface[]>} - List of documents selected by maximal marginal relevance.\n */\n maxMarginalRelevanceSearch?(query: string, options: MaxMarginalRelevanceSearchOptions<this[\"FilterType\"]>, _callbacks: Callbacks | undefined): Promise<DocumentInterface[]>;\n /**\n * Creates a `VectorStore` instance from an array of text strings and optional\n * metadata, using the specified embeddings and database configuration.\n *\n * Subclasses must implement this method to define how text and metadata\n * are embedded and stored in the vector store. Throws an error if not overridden.\n *\n * @param _texts - Array of strings representing the text documents to be stored.\n * @param _metadatas - Metadata for the texts, either as an array (one for each text)\n * or a single object (applied to all texts).\n * @param _embeddings - Instance of `EmbeddingsInterface` to embed the texts.\n * @param _dbConfig - Database configuration settings.\n * @returns A promise that resolves to a new `VectorStore` instance.\n * @throws {Error} Throws an error if this method is not overridden by a subclass.\n */\n static fromTexts(_texts: string[], _metadatas: object[] | object, _embeddings: EmbeddingsInterface, _dbConfig: Record<string, any>): Promise<VectorStore>;\n /**\n * Creates a `VectorStore` instance from an array of documents, using the specified\n * embeddings and database configuration.\n *\n * Subclasses must implement this method to define how documents are embedded\n * and stored. Throws an error if not overridden.\n *\n * @param _docs - Array of `DocumentInterface` instances representing the documents to be stored.\n * @param _embeddings - Instance of `EmbeddingsInterface` to embed the documents.\n * @param _dbConfig - Database configuration settings.\n * @returns A promise that resolves to a new `VectorStore` instance.\n * @throws {Error} Throws an error if this method is not overridden by a subclass.\n */\n static fromDocuments(_docs: DocumentInterface[], _embeddings: EmbeddingsInterface, _dbConfig: Record<string, any>): Promise<VectorStore>;\n /**\n * Creates a `VectorStoreRetriever` instance with flexible configuration options.\n *\n * @param kOrFields\n * - If a number is provided, it sets the `k` parameter (number of items to retrieve).\n * - If an object is provided, it should contain various configuration options.\n * @param filter\n * - Optional filter criteria to limit the items retrieved based on the specified filter type.\n * @param callbacks\n * - Optional callbacks that may be triggered at specific stages of the retrieval process.\n * @param tags\n * - Tags to categorize or label the `VectorStoreRetriever`. Defaults to an empty array if not provided.\n * @param metadata\n * - Additional metadata as key-value pairs to add contextual information for the retrieval process.\n * @param verbose\n * - If `true`, enables detailed logging for the retrieval process. Defaults to `false`.\n *\n * @returns\n * - A configured `VectorStoreRetriever` instance based on the provided parameters.\n *\n * @example\n * Basic usage with a `k` value:\n * ```typescript\n * const retriever = myVectorStore.asRetriever(5);\n * ```\n *\n * Usage with a configuration object:\n * ```typescript\n * const retriever = myVectorStore.asRetriever({\n * k: 10,\n * filter: myFilter,\n * tags: ['example', 'test'],\n * verbose: true,\n * searchType: 'mmr',\n * searchKwargs: { alpha: 0.5 },\n * });\n * ```\n */\n asRetriever(kOrFields?: number | Partial<VectorStoreRetrieverInput<this>>, filter?: this[\"FilterType\"], callbacks?: Callbacks, tags?: string[], metadata?: Record<string, unknown>, verbose?: boolean): VectorStoreRetriever<this>;\n}\n/**\n * Abstract class extending `VectorStore` that defines a contract for saving\n * and loading vector store instances.\n *\n * The `SaveableVectorStore` class allows vector store implementations to\n * persist their data and retrieve it when needed.The format for saving and\n * loading data is left to the implementing subclass.\n *\n * Subclasses must implement the `save` method to handle their custom\n * serialization logic, while the `load` method enables reconstruction of a\n * vector store from saved data, requiring compatible embeddings through the\n * `EmbeddingsInterface`.\n *\n * @abstract\n * @extends VectorStore\n */\nexport declare abstract class SaveableVectorStore extends VectorStore {\n /**\n * Saves the current state of the vector store to the specified directory.\n *\n * This method must be implemented by subclasses to define their own\n * serialization process for persisting vector data. The implementation\n * determines the structure and format of the saved data.\n *\n * @param directory - The directory path where the vector store data\n * will be saved.\n * @abstract\n */\n abstract save(directory: string): Promise<void>;\n /**\n * Loads a vector store instance from the specified directory, using the\n * provided embeddings to ensure compatibility.\n *\n * This static method reconstructs a `SaveableVectorStore` from previously\n * saved data. Implementations should interpret the saved data format to\n * recreate the vector store instance.\n *\n * @param _directory - The directory path from which the vector store\n * data will be loaded.\n * @param _embeddings - An instance of `EmbeddingsInterface` to align\n * the embeddings with the loaded vector data.\n * @returns A promise that resolves to a `SaveableVectorStore` instance\n * constructed from the saved data.\n */\n static load(_directory: string, _embeddings: EmbeddingsInterface): Promise<SaveableVectorStore>;\n}\nexport {};\n//# sourceMappingURL=vectorstores.d.ts.map"],"mappings":";;;;;;;;;;AAImF;AAmCnF,KA/BKQ,kBAAAA,GAAqBC,MA+BdC,CAAAA,MAAAA,EAAiC,GAAA,CAAAC;AAyB7C;AAkDA;;;;;;;;AAUsD;AAatD;;;;;;;;AAAoI;AA6BpI;;;;;;;;;;;AAsH4BV,KArPhBS,iCAqPgBT,CAAAA,UAAAA,CAAAA,GAAAA;EAA+BO,CAAAA,EAAAA,MAAAA;EAAqBS,MAAAA,CAAAA,EAAAA,MAAAA;EAtHyBf,MAAAA,CAAAA,EAAAA,MAAAA;EAAyBc,MAAAA,CAAAA,EA3HrHL,UA2HqHK;AAA6B,CAAA;AAkI/J;;;;;;;;;;;;;;;;;;;AA+F0HT,KAvU9GK,mCAAAA,GAuU8GL;EAAgCN,MAAAA,CAAAA,EAAAA,MAAAA;EAARgB,MAAAA,CAAAA,EAAAA,MAAAA;CAerGJ;;;;;;AA9Ga;AA6H1D;;;;;;;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KE,WAAAA,SAAoBf,YAAAA,YAAwBU;;;;;;;;;;;;;cAa1Df;;;;;;;0BAOYA,+BAA+BS;;;;;;;;;;;;;;;;;;sDAkBHR,+BAA+BO,qBAAqBS;;;;;;;;;;mCAUvEhB,+BAA+BO,qBAAqBS;;;;;;;mBAOpER,sBAAsBQ;;;;;;;;;;;qGAW4DA,SAAShB;;;;;;;;;;;oGAWVM,wBAAwBU,QAAQhB;;;;;;;;;;;;6GAYvBM,wBAAwBU,SAAShB;;;;;;;;;;;;;;;;sDAgBxFS,mEAAmEH,wBAAwBU,QAAQhB;;;;;;;;;;;;;;;;iFAgBxED,gCAAgCS,sBAAsBQ,QAAQG;;;;;;;;;;;;;;8BAcjHnB,kCAAkCD,gCAAgCS,sBAAsBQ,QAAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAuC3FD,QAAQN,2EAA2EN,uCAAuCE,6CAA6CS;;;;;;;;;;;;;;;;;;uBAkB9KG,mBAAAA,SAA4BD,WAAAA;;;;;;;;;;;;oCAYpBH;;;;;;;;;;;;;;;;+CAgBWjB,sBAAsBiB,QAAQI"}
1
+ {"version":3,"file":"vectorstores.d.cts","names":["EmbeddingsInterface","DocumentInterface","BaseRetriever","BaseRetrieverInterface","BaseRetrieverInput","Serializable","CallbackManagerForRetrieverRun","Callbacks","AddDocumentOptions","Record","MaxMarginalRelevanceSearchOptions","FilterType","VectorStoreRetrieverMMRSearchKwargs","VectorStoreRetrieverInput","V","VectorStoreInterface","VectorStoreRetrieverInterface","Promise","VectorStoreRetriever","Partial","VectorStore","SaveableVectorStore"],"sources":["../src/vectorstores.d.ts"],"sourcesContent":["import type { EmbeddingsInterface } from \"./embeddings.js\";\nimport type { DocumentInterface } from \"./documents/document.js\";\nimport { BaseRetriever, BaseRetrieverInterface, type BaseRetrieverInput } from \"./retrievers/index.js\";\nimport { Serializable } from \"./load/serializable.js\";\nimport { CallbackManagerForRetrieverRun, Callbacks } from \"./callbacks/manager.js\";\n/**\n * Type for options when adding a document to the VectorStore.\n */\ntype AddDocumentOptions = Record<string, any>;\n/**\n * Options for configuring a maximal marginal relevance (MMR) search.\n *\n * MMR search optimizes for both similarity to the query and diversity\n * among the results, balancing the retrieval of relevant documents\n * with variation in the content returned.\n *\n * Fields:\n *\n * - `fetchK` (optional): The initial number of documents to retrieve from the\n * vector store before applying the MMR algorithm. This larger set provides a\n * pool of documents from which the algorithm can select the most diverse\n * results based on relevance to the query.\n *\n * - `filter` (optional): A filter of type `FilterType` to refine the search\n * results, allowing additional conditions to target specific subsets\n * of documents.\n *\n * - `k`: The number of documents to return in the final results. This is the\n * primary count of documents that are most relevant to the query.\n *\n * - `lambda` (optional): A value between 0 and 1 that determines the balance\n * between relevance and diversity:\n * - A `lambda` of 0 emphasizes diversity, maximizing content variation.\n * - A `lambda` of 1 emphasizes similarity to the query, focusing on relevance.\n * Values between 0 and 1 provide a mix of relevance and diversity.\n *\n * @template FilterType - The type used for filtering results, as defined\n * by the vector store.\n */\nexport type MaxMarginalRelevanceSearchOptions<FilterType> = {\n k: number;\n fetchK?: number;\n lambda?: number;\n filter?: FilterType;\n};\n/**\n * Options for configuring a maximal marginal relevance (MMR) search\n * when using the `VectorStoreRetriever`.\n *\n * These parameters control how the MMR algorithm balances relevance to the\n * query and diversity among the retrieved documents.\n *\n * Fields:\n * - `fetchK` (optional): Specifies the initial number of documents to fetch\n * before applying the MMR algorithm. This larger set provides a pool of\n * documents from which the algorithm can select the most diverse results\n * based on relevance to the query.\n *\n * - `lambda` (optional): A value between 0 and 1 that determines the balance\n * between relevance and diversity:\n * - A `lambda` of 0 maximizes diversity among the results, prioritizing varied content.\n * - A `lambda` of 1 maximizes similarity to the query, prioritizing relevance.\n * Values between 0 and 1 provide a mix of relevance and diversity.\n */\nexport type VectorStoreRetrieverMMRSearchKwargs = {\n fetchK?: number;\n lambda?: number;\n};\n/**\n * Input configuration options for creating a `VectorStoreRetriever` instance.\n *\n * This type combines properties from `BaseRetrieverInput` with specific settings\n * for the `VectorStoreRetriever`, including options for similarity or maximal\n * marginal relevance (MMR) search types.\n *\n * Fields:\n *\n * - `callbacks` (optional): An array of callback functions that handle various\n * events during retrieval, such as logging, error handling, or progress updates.\n *\n * - `tags` (optional): An array of strings used to add contextual tags to\n * retrieval operations, allowing for easier categorization and tracking.\n *\n * - `metadata` (optional): A record of key-value pairs to store additional\n * contextual information for retrieval operations, which can be useful\n * for logging or auditing purposes.\n *\n * - `verbose` (optional): A boolean flag that, if set to `true`, enables\n * detailed logging and output during the retrieval process. Defaults to `false`.\n *\n * - `vectorStore`: The `VectorStore` instance implementing `VectorStoreInterface`\n * that will be used for document storage and retrieval.\n *\n * - `k` (optional): Specifies the number of documents to retrieve per search\n * query. Defaults to 4 if not specified.\n *\n * - `filter` (optional): A filter of type `FilterType` (defined by the vector store)\n * to refine the set of documents returned, allowing for targeted search results.\n *\n * - `searchType`: Determines the type of search to perform:\n * - `\"similarity\"`: Executes a similarity search, retrieving documents based purely\n * on vector similarity to the query.\n * - `\"mmr\"`: Executes a maximal marginal relevance (MMR) search, balancing similarity\n * and diversity in the search results.\n *\n * - `searchKwargs` (optional): Used only if `searchType` is `\"mmr\"`, this object\n * provides additional options for MMR search, including:\n * - `fetchK`: Specifies the number of documents to initially fetch before applying\n * the MMR algorithm, providing a pool from which the most diverse results are selected.\n * - `lambda`: A diversity parameter, where 0 emphasizes diversity and 1 emphasizes\n * relevance to the query. Values between 0 and 1 provide a balance of relevance and diversity.\n *\n * @template V - The type of vector store implementing `VectorStoreInterface`.\n */\nexport type VectorStoreRetrieverInput<V extends VectorStoreInterface> = BaseRetrieverInput & ({\n vectorStore: V;\n k?: number;\n filter?: V[\"FilterType\"];\n searchType?: \"similarity\";\n} | {\n vectorStore: V;\n k?: number;\n filter?: V[\"FilterType\"];\n searchType: \"mmr\";\n searchKwargs?: VectorStoreRetrieverMMRSearchKwargs;\n});\n/**\n * Interface for a retriever that uses a vector store to store and retrieve\n * document embeddings. This retriever interface allows for adding documents\n * to the underlying vector store and conducting retrieval operations.\n *\n * `VectorStoreRetrieverInterface` extends `BaseRetrieverInterface` to provide\n * document retrieval capabilities based on vector similarity.\n *\n * @interface VectorStoreRetrieverInterface\n * @extends BaseRetrieverInterface\n */\nexport interface VectorStoreRetrieverInterface<V extends VectorStoreInterface = VectorStoreInterface> extends BaseRetrieverInterface {\n vectorStore: V;\n /**\n * Adds an array of documents to the vector store.\n *\n * This method embeds the provided documents and stores them within the\n * vector store. Additional options can be specified for custom behavior\n * during the addition process.\n *\n * @param documents - An array of documents to embed and add to the vector store.\n * @param options - Optional settings to customize document addition.\n * @returns A promise that resolves to an array of document IDs or `void`,\n * depending on the implementation.\n */\n addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n}\n/**\n * Class for retrieving documents from a `VectorStore` based on vector similarity\n * or maximal marginal relevance (MMR).\n *\n * `VectorStoreRetriever` extends `BaseRetriever`, implementing methods for\n * adding documents to the underlying vector store and performing document\n * retrieval with optional configurations.\n *\n * @class VectorStoreRetriever\n * @extends BaseRetriever\n * @implements VectorStoreRetrieverInterface\n * @template V - Type of vector store implementing `VectorStoreInterface`.\n */\nexport declare class VectorStoreRetriever<V extends VectorStoreInterface = VectorStoreInterface> extends BaseRetriever implements VectorStoreRetrieverInterface {\n static lc_name(): string;\n get lc_namespace(): string[];\n /**\n * The instance of `VectorStore` used for storing and retrieving document embeddings.\n * This vector store must implement the `VectorStoreInterface` to be compatible\n * with the retriever’s operations.\n */\n vectorStore: V;\n /**\n * Specifies the number of documents to retrieve for each search query.\n * Defaults to 4 if not specified, providing a basic result count for similarity or MMR searches.\n */\n k: number;\n /**\n * Determines the type of search operation to perform on the vector store.\n *\n * - `\"similarity\"` (default): Conducts a similarity search based purely on vector similarity\n * to the query.\n * - `\"mmr\"`: Executes a maximal marginal relevance (MMR) search, balancing relevance and\n * diversity in the retrieved results.\n */\n searchType: string;\n /**\n * Additional options specific to maximal marginal relevance (MMR) search, applicable\n * only if `searchType` is set to `\"mmr\"`.\n *\n * Includes:\n * - `fetchK`: The initial number of documents fetched before applying the MMR algorithm,\n * allowing for a larger selection from which to choose the most diverse results.\n * - `lambda`: A parameter between 0 and 1 to adjust the relevance-diversity balance,\n * where 0 prioritizes diversity and 1 prioritizes relevance.\n */\n searchKwargs?: VectorStoreRetrieverMMRSearchKwargs;\n /**\n * Optional filter applied to search results, defined by the `FilterType` of the vector store.\n * Allows for refined, targeted results by restricting the returned documents based\n * on specified filter criteria.\n */\n filter?: V[\"FilterType\"];\n /**\n * Returns the type of vector store, as defined by the `vectorStore` instance.\n *\n * @returns {string} The vector store type.\n */\n _vectorstoreType(): string;\n /**\n * Initializes a new instance of `VectorStoreRetriever` with the specified configuration.\n *\n * This constructor configures the retriever to interact with a given `VectorStore`\n * and supports different retrieval strategies, including similarity search and maximal\n * marginal relevance (MMR) search. Various options allow customization of the number\n * of documents retrieved per query, filtering based on conditions, and fine-tuning\n * MMR-specific parameters.\n *\n * @param fields - Configuration options for setting up the retriever:\n *\n * - `vectorStore` (required): The `VectorStore` instance implementing `VectorStoreInterface`\n * that will be used to store and retrieve document embeddings. This is the core component\n * of the retriever, enabling vector-based similarity and MMR searches.\n *\n * - `k` (optional): Specifies the number of documents to retrieve per search query. If not\n * provided, defaults to 4. This count determines the number of most relevant documents returned\n * for each search operation, balancing performance with comprehensiveness.\n *\n * - `searchType` (optional): Defines the search approach used by the retriever, allowing for\n * flexibility between two methods:\n * - `\"similarity\"` (default): A similarity-based search, retrieving documents with high vector\n * similarity to the query. This type prioritizes relevance and is often used when diversity\n * among results is less critical.\n * - `\"mmr\"`: Maximal Marginal Relevance search, which combines relevance with diversity. MMR\n * is useful for scenarios where varied content is essential, as it selects results that\n * both match the query and introduce content diversity.\n *\n * - `filter` (optional): A filter of type `FilterType`, defined by the vector store, that allows\n * for refined and targeted search results. This filter applies specified conditions to limit\n * which documents are eligible for retrieval, offering control over the scope of results.\n *\n * - `searchKwargs` (optional, applicable only if `searchType` is `\"mmr\"`): Additional settings\n * for configuring MMR-specific behavior. These parameters allow further tuning of the MMR\n * search process:\n * - `fetchK`: The initial number of documents fetched from the vector store before the MMR\n * algorithm is applied. Fetching a larger set enables the algorithm to select a more\n * diverse subset of documents.\n * - `lambda`: A parameter controlling the relevance-diversity balance, where 0 emphasizes\n * diversity and 1 prioritizes relevance. Intermediate values provide a blend of the two,\n * allowing customization based on the importance of content variety relative to query relevance.\n */\n constructor(fields: VectorStoreRetrieverInput<V>);\n /**\n * Retrieves relevant documents based on the specified query, using either\n * similarity or maximal marginal relevance (MMR) search.\n *\n * If `searchType` is set to `\"mmr\"`, performs an MMR search to balance\n * similarity and diversity among results. If `searchType` is `\"similarity\"`,\n * retrieves results purely based on similarity to the query.\n *\n * @param query - The query string used to find relevant documents.\n * @param runManager - Optional callback manager for tracking retrieval progress.\n * @returns A promise that resolves to an array of `DocumentInterface` instances\n * representing the most relevant documents to the query.\n * @throws {Error} Throws an error if MMR search is requested but not supported\n * by the vector store.\n * @protected\n */\n _getRelevantDocuments(query: string, runManager?: CallbackManagerForRetrieverRun): Promise<DocumentInterface[]>;\n /**\n * Adds an array of documents to the vector store, embedding them as part of\n * the storage process.\n *\n * This method delegates document embedding and storage to the `addDocuments`\n * method of the underlying vector store.\n *\n * @param documents - An array of documents to embed and add to the vector store.\n * @param options - Optional settings to customize document addition.\n * @returns A promise that resolves to an array of document IDs or `void`,\n * depending on the vector store's implementation.\n */\n addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n}\n/**\n * Interface defining the structure and operations of a vector store, which\n * facilitates the storage, retrieval, and similarity search of document vectors.\n *\n * `VectorStoreInterface` provides methods for adding, deleting, and searching\n * documents based on vector embeddings, including support for similarity\n * search with optional filtering and relevance-based retrieval.\n *\n * @extends Serializable\n */\nexport interface VectorStoreInterface extends Serializable {\n /**\n * Defines the filter type used in search and delete operations. Can be an\n * object for structured conditions or a string for simpler filtering.\n */\n FilterType: object | string;\n /**\n * Instance of `EmbeddingsInterface` used to generate vector embeddings for\n * documents, enabling vector-based search operations.\n */\n embeddings: EmbeddingsInterface;\n /**\n * Returns a string identifying the type of vector store implementation,\n * useful for distinguishing between different vector storage backends.\n *\n * @returns {string} A string indicating the vector store type.\n */\n _vectorstoreType(): string;\n /**\n * Adds precomputed vectors and their corresponding documents to the vector store.\n *\n * @param vectors - An array of vectors, with each vector representing a document.\n * @param documents - An array of `DocumentInterface` instances corresponding to each vector.\n * @param options - Optional configurations for adding documents, potentially covering indexing or metadata handling.\n * @returns A promise that resolves to an array of document IDs or void, depending on implementation.\n */\n addVectors(vectors: number[][], documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Adds an array of documents to the vector store.\n *\n * @param documents - An array of documents to be embedded and stored in the vector store.\n * @param options - Optional configurations for embedding and storage operations.\n * @returns A promise that resolves to an array of document IDs or void, depending on implementation.\n */\n addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Deletes documents from the vector store based on the specified parameters.\n *\n * @param _params - A flexible object containing key-value pairs that define\n * the conditions for selecting documents to delete.\n * @returns A promise that resolves once the deletion operation is complete.\n */\n delete(_params?: Record<string, any>): Promise<void>;\n /**\n * Searches for documents similar to a given vector query and returns them\n * with similarity scores.\n *\n * @param query - A vector representing the query for similarity search.\n * @param k - The number of similar documents to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @returns A promise that resolves to an array of tuples, each containing a\n * `DocumentInterface` and its corresponding similarity score.\n */\n similaritySearchVectorWithScore(query: number[], k: number, filter?: this[\"FilterType\"]): Promise<[DocumentInterface, number][]>;\n /**\n * Searches for documents similar to a text query, embedding the query\n * and retrieving documents based on vector similarity.\n *\n * @param query - The text query to search for.\n * @param k - Optional number of similar documents to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @param callbacks - Optional callbacks for tracking progress or events\n * during the search process.\n * @returns A promise that resolves to an array of `DocumentInterface`\n * instances representing similar documents.\n */\n similaritySearch(query: string, k?: number, filter?: this[\"FilterType\"], callbacks?: Callbacks): Promise<DocumentInterface[]>;\n /**\n * Searches for documents similar to a text query and includes similarity\n * scores in the result.\n *\n * @param query - The text query to search for.\n * @param k - Optional number of similar documents to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @param callbacks - Optional callbacks for tracking progress or events\n * during the search process.\n * @returns A promise that resolves to an array of tuples, each containing\n * a `DocumentInterface` and its similarity score.\n */\n similaritySearchWithScore(query: string, k?: number, filter?: this[\"FilterType\"], callbacks?: Callbacks): Promise<[DocumentInterface, number][]>;\n /**\n * Return documents selected using the maximal marginal relevance.\n * Maximal marginal relevance optimizes for similarity to the query AND diversity\n * among selected documents.\n *\n * @param {string} query - Text to look up documents similar to.\n * @param {number} options.k - Number of documents to return.\n * @param {number} options.fetchK - Number of documents to fetch before passing to the MMR algorithm.\n * @param {number} options.lambda - Number between 0 and 1 that determines the degree of diversity among the results,\n * where 0 corresponds to maximum diversity and 1 to minimum diversity.\n * @param {this[\"FilterType\"]} options.filter - Optional filter\n * @param _callbacks\n *\n * @returns {Promise<DocumentInterface[]>} - List of documents selected by maximal marginal relevance.\n */\n maxMarginalRelevanceSearch?(query: string, options: MaxMarginalRelevanceSearchOptions<this[\"FilterType\"]>, callbacks: Callbacks | undefined): Promise<DocumentInterface[]>;\n /**\n * Converts the vector store into a retriever, making it suitable for use in\n * retrieval-based workflows and allowing additional configuration.\n *\n * @param kOrFields - Optional parameter for specifying either the number of\n * documents to retrieve or partial retriever configurations.\n * @param filter - Optional filter based on `FilterType` for retrieval restriction.\n * @param callbacks - Optional callbacks for tracking retrieval events or progress.\n * @param tags - General-purpose tags to add contextual information to the retriever.\n * @param metadata - General-purpose metadata providing additional context\n * for retrieval.\n * @param verbose - If `true`, enables detailed logging during retrieval.\n * @returns An instance of `VectorStoreRetriever` configured with the specified options.\n */\n asRetriever(kOrFields?: number | Partial<VectorStoreRetrieverInput<this>>, filter?: this[\"FilterType\"], callbacks?: Callbacks, tags?: string[], metadata?: Record<string, unknown>, verbose?: boolean): VectorStoreRetriever<this>;\n}\n/**\n * Abstract class representing a vector storage system for performing\n * similarity searches on embedded documents.\n *\n * `VectorStore` provides methods for adding precomputed vectors or documents,\n * removing documents based on criteria, and performing similarity searches\n * with optional scoring. Subclasses are responsible for implementing specific\n * storage mechanisms and the exact behavior of certain abstract methods.\n *\n * @abstract\n * @extends Serializable\n * @implements VectorStoreInterface\n */\nexport declare abstract class VectorStore extends Serializable implements VectorStoreInterface {\n FilterType: object | string;\n /**\n * Namespace within LangChain to uniquely identify this vector store's\n * location, based on the vector store type.\n *\n * @internal\n */\n lc_namespace: string[];\n /**\n * Embeddings interface for generating vector embeddings from text queries,\n * enabling vector-based similarity searches.\n */\n embeddings: EmbeddingsInterface;\n /**\n * Initializes a new vector store with embeddings and database configuration.\n *\n * @param embeddings - Instance of `EmbeddingsInterface` used to embed queries.\n * @param dbConfig - Configuration settings for the database or storage system.\n */\n constructor(embeddings: EmbeddingsInterface, dbConfig: Record<string, any>);\n /**\n * Returns a string representing the type of vector store, which subclasses\n * must implement to identify their specific vector storage type.\n *\n * @returns {string} A string indicating the vector store type.\n * @abstract\n */\n abstract _vectorstoreType(): string;\n /**\n * Adds precomputed vectors and corresponding documents to the vector store.\n *\n * @param vectors - An array of vectors representing each document.\n * @param documents - Array of documents associated with each vector.\n * @param options - Optional configuration for adding vectors, such as indexing.\n * @returns A promise resolving to an array of document IDs or void, based on implementation.\n * @abstract\n */\n abstract addVectors(vectors: number[][], documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Adds documents to the vector store, embedding them first through the\n * `embeddings` instance.\n *\n * @param documents - Array of documents to embed and add.\n * @param options - Optional configuration for embedding and storing documents.\n * @returns A promise resolving to an array of document IDs or void, based on implementation.\n * @abstract\n */\n abstract addDocuments(documents: DocumentInterface[], options?: AddDocumentOptions): Promise<string[] | void>;\n /**\n * Deletes documents from the vector store based on the specified parameters.\n *\n * @param _params - Flexible key-value pairs defining conditions for document deletion.\n * @returns A promise that resolves once the deletion is complete.\n */\n delete(_params?: Record<string, any>): Promise<void>;\n /**\n * Performs a similarity search using a vector query and returns results\n * along with their similarity scores.\n *\n * @param query - Vector representing the search query.\n * @param k - Number of similar results to return.\n * @param filter - Optional filter based on `FilterType` to restrict results.\n * @returns A promise resolving to an array of tuples containing documents and their similarity scores.\n * @abstract\n */\n abstract similaritySearchVectorWithScore(query: number[], k: number, filter?: this[\"FilterType\"]): Promise<[DocumentInterface, number][]>;\n /**\n * Searches for documents similar to a text query by embedding the query and\n * performing a similarity search on the resulting vector.\n *\n * @param query - Text query for finding similar documents.\n * @param k - Number of similar results to return. Defaults to 4.\n * @param filter - Optional filter based on `FilterType`.\n * @param _callbacks - Optional callbacks for monitoring search progress\n * @returns A promise resolving to an array of `DocumentInterface` instances representing similar documents.\n */\n similaritySearch(query: string, k?: number, filter?: this[\"FilterType\"] | undefined, _callbacks?: Callbacks | undefined): Promise<DocumentInterface[]>;\n /**\n * Searches for documents similar to a text query by embedding the query,\n * and returns results with similarity scores.\n *\n * @param query - Text query for finding similar documents.\n * @param k - Number of similar results to return. Defaults to 4.\n * @param filter - Optional filter based on `FilterType`.\n * @param _callbacks - Optional callbacks for monitoring search progress\n * @returns A promise resolving to an array of tuples, each containing a\n * document and its similarity score.\n */\n similaritySearchWithScore(query: string, k?: number, filter?: this[\"FilterType\"] | undefined, _callbacks?: Callbacks | undefined): Promise<[DocumentInterface, number][]>;\n /**\n * Return documents selected using the maximal marginal relevance.\n * Maximal marginal relevance optimizes for similarity to the query AND diversity\n * among selected documents.\n *\n * @param {string} query - Text to look up documents similar to.\n * @param {number} options.k - Number of documents to return.\n * @param {number} options.fetchK - Number of documents to fetch before passing to the MMR algorithm.\n * @param {number} options.lambda - Number between 0 and 1 that determines the degree of diversity among the results,\n * where 0 corresponds to maximum diversity and 1 to minimum diversity.\n * @param {this[\"FilterType\"]} options.filter - Optional filter\n * @param _callbacks\n *\n * @returns {Promise<DocumentInterface[]>} - List of documents selected by maximal marginal relevance.\n */\n maxMarginalRelevanceSearch?(query: string, options: MaxMarginalRelevanceSearchOptions<this[\"FilterType\"]>, _callbacks: Callbacks | undefined): Promise<DocumentInterface[]>;\n /**\n * Creates a `VectorStore` instance from an array of text strings and optional\n * metadata, using the specified embeddings and database configuration.\n *\n * Subclasses must implement this method to define how text and metadata\n * are embedded and stored in the vector store. Throws an error if not overridden.\n *\n * @param _texts - Array of strings representing the text documents to be stored.\n * @param _metadatas - Metadata for the texts, either as an array (one for each text)\n * or a single object (applied to all texts).\n * @param _embeddings - Instance of `EmbeddingsInterface` to embed the texts.\n * @param _dbConfig - Database configuration settings.\n * @returns A promise that resolves to a new `VectorStore` instance.\n * @throws {Error} Throws an error if this method is not overridden by a subclass.\n */\n static fromTexts(_texts: string[], _metadatas: object[] | object, _embeddings: EmbeddingsInterface, _dbConfig: Record<string, any>): Promise<VectorStore>;\n /**\n * Creates a `VectorStore` instance from an array of documents, using the specified\n * embeddings and database configuration.\n *\n * Subclasses must implement this method to define how documents are embedded\n * and stored. Throws an error if not overridden.\n *\n * @param _docs - Array of `DocumentInterface` instances representing the documents to be stored.\n * @param _embeddings - Instance of `EmbeddingsInterface` to embed the documents.\n * @param _dbConfig - Database configuration settings.\n * @returns A promise that resolves to a new `VectorStore` instance.\n * @throws {Error} Throws an error if this method is not overridden by a subclass.\n */\n static fromDocuments(_docs: DocumentInterface[], _embeddings: EmbeddingsInterface, _dbConfig: Record<string, any>): Promise<VectorStore>;\n /**\n * Creates a `VectorStoreRetriever` instance with flexible configuration options.\n *\n * @param kOrFields\n * - If a number is provided, it sets the `k` parameter (number of items to retrieve).\n * - If an object is provided, it should contain various configuration options.\n * @param filter\n * - Optional filter criteria to limit the items retrieved based on the specified filter type.\n * @param callbacks\n * - Optional callbacks that may be triggered at specific stages of the retrieval process.\n * @param tags\n * - Tags to categorize or label the `VectorStoreRetriever`. Defaults to an empty array if not provided.\n * @param metadata\n * - Additional metadata as key-value pairs to add contextual information for the retrieval process.\n * @param verbose\n * - If `true`, enables detailed logging for the retrieval process. Defaults to `false`.\n *\n * @returns\n * - A configured `VectorStoreRetriever` instance based on the provided parameters.\n *\n * @example\n * Basic usage with a `k` value:\n * ```typescript\n * const retriever = myVectorStore.asRetriever(5);\n * ```\n *\n * Usage with a configuration object:\n * ```typescript\n * const retriever = myVectorStore.asRetriever({\n * k: 10,\n * filter: myFilter,\n * tags: ['example', 'test'],\n * verbose: true,\n * searchType: 'mmr',\n * searchKwargs: { alpha: 0.5 },\n * });\n * ```\n */\n asRetriever(kOrFields?: number | Partial<VectorStoreRetrieverInput<this>>, filter?: this[\"FilterType\"], callbacks?: Callbacks, tags?: string[], metadata?: Record<string, unknown>, verbose?: boolean): VectorStoreRetriever<this>;\n}\n/**\n * Abstract class extending `VectorStore` that defines a contract for saving\n * and loading vector store instances.\n *\n * The `SaveableVectorStore` class allows vector store implementations to\n * persist their data and retrieve it when needed.The format for saving and\n * loading data is left to the implementing subclass.\n *\n * Subclasses must implement the `save` method to handle their custom\n * serialization logic, while the `load` method enables reconstruction of a\n * vector store from saved data, requiring compatible embeddings through the\n * `EmbeddingsInterface`.\n *\n * @abstract\n * @extends VectorStore\n */\nexport declare abstract class SaveableVectorStore extends VectorStore {\n /**\n * Saves the current state of the vector store to the specified directory.\n *\n * This method must be implemented by subclasses to define their own\n * serialization process for persisting vector data. The implementation\n * determines the structure and format of the saved data.\n *\n * @param directory - The directory path where the vector store data\n * will be saved.\n * @abstract\n */\n abstract save(directory: string): Promise<void>;\n /**\n * Loads a vector store instance from the specified directory, using the\n * provided embeddings to ensure compatibility.\n *\n * This static method reconstructs a `SaveableVectorStore` from previously\n * saved data. Implementations should interpret the saved data format to\n * recreate the vector store instance.\n *\n * @param _directory - The directory path from which the vector store\n * data will be loaded.\n * @param _embeddings - An instance of `EmbeddingsInterface` to align\n * the embeddings with the loaded vector data.\n * @returns A promise that resolves to a `SaveableVectorStore` instance\n * constructed from the saved data.\n */\n static load(_directory: string, _emb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;;;;;;;;;;;;;;;uBAkB9KG,mBAAAA,SAA4BD,WAAAA;;;;;;;;;;;;oCAYpBH;;;;;;;;;;;;;;;;+CAgBWjB,sBAAsBiB,QAAQI"}
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/document_loaders/base.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/document_loaders/base.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/document_loaders/base.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/document_loaders/base.js";
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/document_loaders/langsmith.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/document_loaders/langsmith.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/document_loaders/langsmith.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/document_loaders/langsmith.js";
package/documents.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/documents/index.cjs");
@@ -0,0 +1 @@
1
+ export * from "./dist/documents/index.js";
package/documents.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/documents/index.js";
package/documents.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/documents/index.js";
package/embeddings.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/embeddings.cjs");
@@ -0,0 +1 @@
1
+ export * from "./dist/embeddings.js";
@@ -0,0 +1 @@
1
+ export * from "./dist/embeddings.js";
package/embeddings.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/embeddings.js";
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/example_selectors/index.cjs");
@@ -0,0 +1 @@
1
+ export * from "./dist/example_selectors/index.js";
@@ -0,0 +1 @@
1
+ export * from "./dist/example_selectors/index.js";
@@ -0,0 +1 @@
1
+ export * from "./dist/example_selectors/index.js";
package/indexing.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/indexing/index.cjs");
package/indexing.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/indexing/index.js";
package/indexing.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/indexing/index.js";
package/indexing.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/indexing/index.js";
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/language_models/base.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/base.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/base.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/base.js";
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/language_models/chat_models.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/chat_models.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/chat_models.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/chat_models.js";
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/language_models/llms.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/llms.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/llms.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/llms.js";
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/language_models/profile.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/profile.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/profile.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/language_models/profile.js";
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/load/serializable.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/load/serializable.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/load/serializable.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/load/serializable.js";
package/load.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/load/index.cjs");
package/load.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/load/index.js";
package/load.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/load/index.js";
package/load.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/load/index.js";
package/memory.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/memory.cjs");
package/memory.d.cts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/memory.js";
package/memory.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/memory.js";
package/memory.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/memory.js";
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/messages/tool.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/messages/tool.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/messages/tool.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/messages/tool.js";
package/messages.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./dist/messages/index.cjs");