@orq-ai/node 3.9.3 → 3.9.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 (168) hide show
  1. package/README.md +2 -5
  2. package/bin/mcp-server.js +560 -866
  3. package/bin/mcp-server.js.map +36 -36
  4. package/docs/sdks/knowledge/README.md +77 -0
  5. package/examples/README.md +26 -0
  6. package/examples/contactsCreate.example.ts +40 -0
  7. package/examples/package-lock.json +626 -0
  8. package/examples/package.json +18 -0
  9. package/funcs/deploymentsStream.js +7 -7
  10. package/funcs/deploymentsStream.js.map +1 -1
  11. package/funcs/{knowledgeBasesChunkText.d.ts → knowledgeCreate.d.ts} +3 -6
  12. package/funcs/knowledgeCreate.d.ts.map +1 -0
  13. package/funcs/{knowledgeBasesChunkText.js → knowledgeCreate.js} +7 -10
  14. package/funcs/knowledgeCreate.js.map +1 -0
  15. package/jsr.json +1 -1
  16. package/lib/config.d.ts +3 -3
  17. package/lib/config.js +3 -3
  18. package/lib/event-streams.d.ts +4 -10
  19. package/lib/event-streams.d.ts.map +1 -1
  20. package/lib/event-streams.js +110 -194
  21. package/lib/event-streams.js.map +1 -1
  22. package/lib/matchers.d.ts.map +1 -1
  23. package/lib/matchers.js +1 -4
  24. package/lib/matchers.js.map +1 -1
  25. package/mcp-server/mcp-server.js +1 -1
  26. package/mcp-server/server.js +3 -3
  27. package/mcp-server/server.js.map +1 -1
  28. package/mcp-server/tools/knowledgeCreate.d.ts +8 -0
  29. package/mcp-server/tools/knowledgeCreate.d.ts.map +1 -0
  30. package/mcp-server/tools/{knowledgeBasesChunkText.js → knowledgeCreate.js} +8 -10
  31. package/mcp-server/tools/knowledgeCreate.js.map +1 -0
  32. package/models/operations/createcontact.js +2 -2
  33. package/models/operations/createdataset.js +2 -2
  34. package/models/operations/createdatasetitem.js +2 -2
  35. package/models/operations/createdatasource.js +2 -2
  36. package/models/operations/createeval.js +16 -16
  37. package/models/operations/createknowledge.d.ts +426 -0
  38. package/models/operations/createknowledge.d.ts.map +1 -0
  39. package/models/operations/createknowledge.js +431 -0
  40. package/models/operations/createknowledge.js.map +1 -0
  41. package/models/operations/fileget.js +2 -2
  42. package/models/operations/filelist.js +2 -2
  43. package/models/operations/fileupload.js +2 -2
  44. package/models/operations/getevals.js +28 -28
  45. package/models/operations/index.d.ts +1 -1
  46. package/models/operations/index.d.ts.map +1 -1
  47. package/models/operations/index.js +1 -1
  48. package/models/operations/index.js.map +1 -1
  49. package/models/operations/listcontacts.js +2 -2
  50. package/models/operations/listdatasetdatapoints.js +2 -2
  51. package/models/operations/listdatasets.js +2 -2
  52. package/models/operations/listdatasources.js +2 -2
  53. package/models/operations/retrievecontact.js +2 -2
  54. package/models/operations/retrievedatapoint.js +2 -2
  55. package/models/operations/retrievedataset.js +2 -2
  56. package/models/operations/retrievedatasource.js +2 -2
  57. package/models/operations/updatecontact.js +2 -2
  58. package/models/operations/updatedatapoint.js +2 -2
  59. package/models/operations/updatedataset.js +2 -2
  60. package/models/operations/updatedatasource.js +2 -2
  61. package/models/operations/updateeval.js +16 -16
  62. package/models/operations/updateknowledge.d.ts +106 -106
  63. package/models/operations/updateknowledge.d.ts.map +1 -1
  64. package/models/operations/updateknowledge.js +125 -129
  65. package/models/operations/updateknowledge.js.map +1 -1
  66. package/package.json +1 -1
  67. package/packages/orq-rc/README.md +5 -2
  68. package/packages/orq-rc/docs/sdks/knowledge/README.md +0 -87
  69. package/packages/orq-rc/examples/README.md +26 -0
  70. package/packages/orq-rc/examples/contactsCreate.example.ts +40 -0
  71. package/packages/orq-rc/examples/package-lock.json +626 -0
  72. package/packages/orq-rc/examples/package.json +18 -0
  73. package/packages/orq-rc/jsr.json +1 -1
  74. package/packages/orq-rc/package-lock.json +56 -67
  75. package/packages/orq-rc/package.json +3 -3
  76. package/packages/orq-rc/src/funcs/deploymentsStream.ts +7 -8
  77. package/packages/orq-rc/src/lib/config.ts +3 -3
  78. package/packages/orq-rc/src/lib/event-streams.ts +114 -231
  79. package/packages/orq-rc/src/lib/matchers.ts +1 -4
  80. package/packages/orq-rc/src/mcp-server/mcp-server.ts +1 -1
  81. package/packages/orq-rc/src/mcp-server/server.ts +3 -3
  82. package/packages/orq-rc/src/models/operations/chunktext.ts +63 -57
  83. package/packages/orq-rc/src/models/operations/createcontact.ts +2 -2
  84. package/packages/orq-rc/src/models/operations/createdataset.ts +2 -2
  85. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +2 -2
  86. package/packages/orq-rc/src/models/operations/createdatasource.ts +2 -2
  87. package/packages/orq-rc/src/models/operations/createeval.ts +16 -16
  88. package/packages/orq-rc/src/models/operations/fileget.ts +2 -2
  89. package/packages/orq-rc/src/models/operations/filelist.ts +2 -2
  90. package/packages/orq-rc/src/models/operations/fileupload.ts +2 -2
  91. package/packages/orq-rc/src/models/operations/getevals.ts +28 -28
  92. package/packages/orq-rc/src/models/operations/listcontacts.ts +2 -2
  93. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +2 -2
  94. package/packages/orq-rc/src/models/operations/listdatasets.ts +2 -2
  95. package/packages/orq-rc/src/models/operations/listdatasources.ts +2 -2
  96. package/packages/orq-rc/src/models/operations/retrievecontact.ts +2 -2
  97. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +2 -2
  98. package/packages/orq-rc/src/models/operations/retrievedataset.ts +2 -2
  99. package/packages/orq-rc/src/models/operations/retrievedatasource.ts +2 -2
  100. package/packages/orq-rc/src/models/operations/updatecontact.ts +2 -2
  101. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +2 -2
  102. package/packages/orq-rc/src/models/operations/updatedataset.ts +2 -2
  103. package/packages/orq-rc/src/models/operations/updatedatasource.ts +2 -2
  104. package/packages/orq-rc/src/models/operations/updateeval.ts +16 -16
  105. package/packages/orq-rc/src/sdk/knowledge.ts +0 -18
  106. package/packages/orq-rc/src/sdk/sdk.ts +6 -0
  107. package/sdk/knowledge.d.ts +4 -0
  108. package/sdk/knowledge.d.ts.map +1 -1
  109. package/sdk/knowledge.js +7 -0
  110. package/sdk/knowledge.js.map +1 -1
  111. package/sdk/sdk.d.ts +0 -3
  112. package/sdk/sdk.d.ts.map +1 -1
  113. package/sdk/sdk.js +0 -4
  114. package/sdk/sdk.js.map +1 -1
  115. package/src/funcs/deploymentsStream.ts +7 -8
  116. package/{packages/orq-rc/src/funcs/knowledgeChunkText.ts → src/funcs/knowledgeCreate.ts} +11 -13
  117. package/src/lib/config.ts +3 -3
  118. package/src/lib/event-streams.ts +114 -231
  119. package/src/lib/matchers.ts +1 -4
  120. package/src/mcp-server/mcp-server.ts +1 -1
  121. package/src/mcp-server/server.ts +3 -3
  122. package/src/mcp-server/tools/knowledgeCreate.ts +35 -0
  123. package/src/models/operations/createcontact.ts +2 -2
  124. package/src/models/operations/createdataset.ts +2 -2
  125. package/src/models/operations/createdatasetitem.ts +2 -2
  126. package/src/models/operations/createdatasource.ts +2 -2
  127. package/src/models/operations/createeval.ts +16 -16
  128. package/src/models/operations/createknowledge.ts +846 -0
  129. package/src/models/operations/fileget.ts +2 -2
  130. package/src/models/operations/filelist.ts +2 -2
  131. package/src/models/operations/fileupload.ts +2 -2
  132. package/src/models/operations/getevals.ts +28 -28
  133. package/src/models/operations/index.ts +1 -1
  134. package/src/models/operations/listcontacts.ts +2 -2
  135. package/src/models/operations/listdatasetdatapoints.ts +2 -2
  136. package/src/models/operations/listdatasets.ts +2 -2
  137. package/src/models/operations/listdatasources.ts +2 -2
  138. package/src/models/operations/retrievecontact.ts +2 -2
  139. package/src/models/operations/retrievedatapoint.ts +2 -2
  140. package/src/models/operations/retrievedataset.ts +2 -2
  141. package/src/models/operations/retrievedatasource.ts +2 -2
  142. package/src/models/operations/updatecontact.ts +2 -2
  143. package/src/models/operations/updatedatapoint.ts +2 -2
  144. package/src/models/operations/updatedataset.ts +2 -2
  145. package/src/models/operations/updatedatasource.ts +2 -2
  146. package/src/models/operations/updateeval.ts +16 -16
  147. package/src/models/operations/updateknowledge.ts +266 -206
  148. package/src/sdk/knowledge.ts +15 -0
  149. package/src/sdk/sdk.ts +0 -6
  150. package/funcs/knowledgeBasesChunkText.d.ts.map +0 -1
  151. package/funcs/knowledgeBasesChunkText.js.map +0 -1
  152. package/mcp-server/tools/knowledgeBasesChunkText.d.ts +0 -8
  153. package/mcp-server/tools/knowledgeBasesChunkText.d.ts.map +0 -1
  154. package/mcp-server/tools/knowledgeBasesChunkText.js.map +0 -1
  155. package/models/operations/chunktext.d.ts +0 -961
  156. package/models/operations/chunktext.d.ts.map +0 -1
  157. package/models/operations/chunktext.js +0 -883
  158. package/models/operations/chunktext.js.map +0 -1
  159. package/packages/orq-rc/src/mcp-server/tools/knowledgeChunkText.ts +0 -37
  160. package/sdk/knowledgebases.d.ts +0 -12
  161. package/sdk/knowledgebases.d.ts.map +0 -1
  162. package/sdk/knowledgebases.js +0 -22
  163. package/sdk/knowledgebases.js.map +0 -1
  164. package/src/models/operations/chunktext.ts +0 -1629
  165. /package/{docs → packages/orq-rc/docs}/sdks/knowledgebases/README.md +0 -0
  166. /package/{src → packages/orq-rc/src}/funcs/knowledgeBasesChunkText.ts +0 -0
  167. /package/{src → packages/orq-rc/src}/mcp-server/tools/knowledgeBasesChunkText.ts +0 -0
  168. /package/{src → packages/orq-rc/src}/sdk/knowledgebases.ts +0 -0
@@ -1,1629 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
- import { remap as remap$ } from "../../lib/primitives.js";
7
- import { safeParse } from "../../lib/schemas.js";
8
- import { ClosedEnum } from "../../types/enums.js";
9
- import { Result as SafeParseResult } from "../../types/fp.js";
10
- import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
-
12
- /**
13
- * Return format: chunks (with metadata) or texts (plain strings)
14
- */
15
- export const ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType =
16
- {
17
- Chunks: "chunks",
18
- Texts: "texts",
19
- } as const;
20
- /**
21
- * Return format: chunks (with metadata) or texts (plain strings)
22
- */
23
- export type ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType =
24
- ClosedEnum<
25
- typeof ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType
26
- >;
27
-
28
- export const AgenticChunker = {
29
- Agentic: "agentic",
30
- } as const;
31
- export type AgenticChunker = ClosedEnum<typeof AgenticChunker>;
32
-
33
- /**
34
- * Agentic LLM-powered chunker that uses AI to determine optimal split points. Best for complex documents requiring intelligent segmentation.
35
- */
36
- export type AgenticChunkerStrategy = {
37
- /**
38
- * The text content to be chunked
39
- */
40
- text: string;
41
- /**
42
- * Whether to include metadata for each chunk
43
- */
44
- metadata?: boolean | undefined;
45
- /**
46
- * Return format: chunks (with metadata) or texts (plain strings)
47
- */
48
- returnType?:
49
- | ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType
50
- | undefined;
51
- strategy: AgenticChunker;
52
- /**
53
- * Chat model to use for chunking. (Available models)[https://docs.orq.ai/docs/proxy#chat-models]
54
- */
55
- model: string;
56
- /**
57
- * Maximum tokens per chunk
58
- */
59
- chunkSize?: number | undefined;
60
- /**
61
- * Size of candidate splits for LLM evaluation
62
- */
63
- candidateSize?: number | undefined;
64
- /**
65
- * Minimum characters allowed per chunk
66
- */
67
- minCharactersPerChunk?: number | undefined;
68
- };
69
-
70
- /**
71
- * Return format: chunks (with metadata) or texts (plain strings)
72
- */
73
- export const ChunkTextChunkingRequestKnowledgeBasesRequestReturnType = {
74
- Chunks: "chunks",
75
- Texts: "texts",
76
- } as const;
77
- /**
78
- * Return format: chunks (with metadata) or texts (plain strings)
79
- */
80
- export type ChunkTextChunkingRequestKnowledgeBasesRequestReturnType =
81
- ClosedEnum<typeof ChunkTextChunkingRequestKnowledgeBasesRequestReturnType>;
82
-
83
- export const SDPMChunker = {
84
- Sdpm: "sdpm",
85
- } as const;
86
- export type SDPMChunker = ClosedEnum<typeof SDPMChunker>;
87
-
88
- export const ChunkTextThreshold2 = {
89
- Auto: "auto",
90
- } as const;
91
- export type ChunkTextThreshold2 = ClosedEnum<typeof ChunkTextThreshold2>;
92
-
93
- /**
94
- * Similarity threshold for grouping (0-1) or "auto" for automatic detection
95
- */
96
- export type ChunkingRequestThreshold = number | ChunkTextThreshold2;
97
-
98
- /**
99
- * Chunking mode: window-based or sentence-based similarity
100
- */
101
- export const ChunkingRequestMode = {
102
- Window: "window",
103
- Sentence: "sentence",
104
- } as const;
105
- /**
106
- * Chunking mode: window-based or sentence-based similarity
107
- */
108
- export type ChunkingRequestMode = ClosedEnum<typeof ChunkingRequestMode>;
109
-
110
- /**
111
- * Sub-Document Prose Model chunker that uses skip-gram patterns to identify optimal split points. Good for technical documents with structured content.
112
- */
113
- export type SDPMChunkerStrategy = {
114
- /**
115
- * The text content to be chunked
116
- */
117
- text: string;
118
- /**
119
- * Whether to include metadata for each chunk
120
- */
121
- metadata?: boolean | undefined;
122
- /**
123
- * Return format: chunks (with metadata) or texts (plain strings)
124
- */
125
- returnType?:
126
- | ChunkTextChunkingRequestKnowledgeBasesRequestReturnType
127
- | undefined;
128
- strategy: SDPMChunker;
129
- /**
130
- * Maximum tokens per chunk
131
- */
132
- chunkSize?: number | undefined;
133
- /**
134
- * Window size for skip-gram patterns
135
- */
136
- skipWindow?: number | undefined;
137
- /**
138
- * Similarity threshold for grouping (0-1) or "auto" for automatic detection
139
- */
140
- threshold?: number | ChunkTextThreshold2 | undefined;
141
- /**
142
- * Embedding model to use for semantic similarity. (Available embedding models)[https://docs.orq.ai/docs/proxy#embedding-models]
143
- */
144
- embeddingModel: string;
145
- /**
146
- * Chunking mode: window-based or sentence-based similarity
147
- */
148
- mode?: ChunkingRequestMode | undefined;
149
- };
150
-
151
- /**
152
- * Return format: chunks (with metadata) or texts (plain strings)
153
- */
154
- export const ChunkTextChunkingRequestKnowledgeBasesReturnType = {
155
- Chunks: "chunks",
156
- Texts: "texts",
157
- } as const;
158
- /**
159
- * Return format: chunks (with metadata) or texts (plain strings)
160
- */
161
- export type ChunkTextChunkingRequestKnowledgeBasesReturnType = ClosedEnum<
162
- typeof ChunkTextChunkingRequestKnowledgeBasesReturnType
163
- >;
164
-
165
- export const SemanticChunker = {
166
- Semantic: "semantic",
167
- } as const;
168
- export type SemanticChunker = ClosedEnum<typeof SemanticChunker>;
169
-
170
- export const Threshold2 = {
171
- Auto: "auto",
172
- } as const;
173
- export type Threshold2 = ClosedEnum<typeof Threshold2>;
174
-
175
- /**
176
- * Similarity threshold for grouping (0-1) or "auto" for automatic detection
177
- */
178
- export type Threshold = number | Threshold2;
179
-
180
- /**
181
- * Chunking mode: window-based or sentence-based similarity
182
- */
183
- export const Mode = {
184
- Window: "window",
185
- Sentence: "sentence",
186
- } as const;
187
- /**
188
- * Chunking mode: window-based or sentence-based similarity
189
- */
190
- export type Mode = ClosedEnum<typeof Mode>;
191
-
192
- /**
193
- * Groups semantically similar sentences using embeddings. Excellent for maintaining topic coherence and context within chunks.
194
- */
195
- export type SemanticChunkerStrategy = {
196
- /**
197
- * The text content to be chunked
198
- */
199
- text: string;
200
- /**
201
- * Whether to include metadata for each chunk
202
- */
203
- metadata?: boolean | undefined;
204
- /**
205
- * Return format: chunks (with metadata) or texts (plain strings)
206
- */
207
- returnType?: ChunkTextChunkingRequestKnowledgeBasesReturnType | undefined;
208
- strategy: SemanticChunker;
209
- /**
210
- * Maximum tokens per chunk
211
- */
212
- chunkSize?: number | undefined;
213
- /**
214
- * Similarity threshold for grouping (0-1) or "auto" for automatic detection
215
- */
216
- threshold?: number | Threshold2 | undefined;
217
- /**
218
- * Embedding model to use for semantic similarity. (Available embedding models)[https://docs.orq.ai/docs/proxy#embedding-models]
219
- */
220
- embeddingModel: string;
221
- /**
222
- * Chunking mode: window-based or sentence-based similarity
223
- */
224
- mode?: Mode | undefined;
225
- /**
226
- * Window size for similarity comparison
227
- */
228
- similarityWindow?: number | undefined;
229
- };
230
-
231
- /**
232
- * Return format: chunks (with metadata) or texts (plain strings)
233
- */
234
- export const ChunkTextChunkingRequestReturnType = {
235
- Chunks: "chunks",
236
- Texts: "texts",
237
- } as const;
238
- /**
239
- * Return format: chunks (with metadata) or texts (plain strings)
240
- */
241
- export type ChunkTextChunkingRequestReturnType = ClosedEnum<
242
- typeof ChunkTextChunkingRequestReturnType
243
- >;
244
-
245
- export const RecursiveChunker = {
246
- Recursive: "recursive",
247
- } as const;
248
- export type RecursiveChunker = ClosedEnum<typeof RecursiveChunker>;
249
-
250
- /**
251
- * Recursively splits text using a hierarchy of separators (paragraphs, sentences, words). Versatile general-purpose chunker that preserves document structure.
252
- */
253
- export type RecursiveChunkerStrategy = {
254
- /**
255
- * The text content to be chunked
256
- */
257
- text: string;
258
- /**
259
- * Whether to include metadata for each chunk
260
- */
261
- metadata?: boolean | undefined;
262
- /**
263
- * Return format: chunks (with metadata) or texts (plain strings)
264
- */
265
- returnType?: ChunkTextChunkingRequestReturnType | undefined;
266
- strategy: RecursiveChunker;
267
- /**
268
- * Maximum tokens per chunk
269
- */
270
- chunkSize?: number | undefined;
271
- /**
272
- * Hierarchy of separators to use for splitting
273
- */
274
- separators?: Array<string> | undefined;
275
- /**
276
- * Minimum characters allowed per chunk
277
- */
278
- minCharactersPerChunk?: number | undefined;
279
- };
280
-
281
- /**
282
- * Return format: chunks (with metadata) or texts (plain strings)
283
- */
284
- export const ChunkingRequestReturnType = {
285
- Chunks: "chunks",
286
- Texts: "texts",
287
- } as const;
288
- /**
289
- * Return format: chunks (with metadata) or texts (plain strings)
290
- */
291
- export type ChunkingRequestReturnType = ClosedEnum<
292
- typeof ChunkingRequestReturnType
293
- >;
294
-
295
- export const SentenceChunker = {
296
- Sentence: "sentence",
297
- } as const;
298
- export type SentenceChunker = ClosedEnum<typeof SentenceChunker>;
299
-
300
- /**
301
- * Splits text at sentence boundaries while respecting token limits. Ideal for maintaining semantic coherence and readability.
302
- */
303
- export type SentenceChunkerStrategy = {
304
- /**
305
- * The text content to be chunked
306
- */
307
- text: string;
308
- /**
309
- * Whether to include metadata for each chunk
310
- */
311
- metadata?: boolean | undefined;
312
- /**
313
- * Return format: chunks (with metadata) or texts (plain strings)
314
- */
315
- returnType?: ChunkingRequestReturnType | undefined;
316
- strategy: SentenceChunker;
317
- /**
318
- * Maximum tokens per chunk
319
- */
320
- chunkSize?: number | undefined;
321
- /**
322
- * Number of overlapping tokens between chunks
323
- */
324
- chunkOverlap?: number | undefined;
325
- /**
326
- * Minimum number of sentences per chunk
327
- */
328
- minSentencesPerChunk?: number | undefined;
329
- };
330
-
331
- /**
332
- * Return format: chunks (with metadata) or texts (plain strings)
333
- */
334
- export const ReturnTypeT = {
335
- Chunks: "chunks",
336
- Texts: "texts",
337
- } as const;
338
- /**
339
- * Return format: chunks (with metadata) or texts (plain strings)
340
- */
341
- export type ReturnTypeT = ClosedEnum<typeof ReturnTypeT>;
342
-
343
- export const TokenChunker = {
344
- Token: "token",
345
- } as const;
346
- export type TokenChunker = ClosedEnum<typeof TokenChunker>;
347
-
348
- /**
349
- * Splits text based on token count. Best for ensuring chunks fit within LLM context windows and maintaining consistent chunk sizes for embedding models.
350
- */
351
- export type TokenChunkerStrategy = {
352
- /**
353
- * The text content to be chunked
354
- */
355
- text: string;
356
- /**
357
- * Whether to include metadata for each chunk
358
- */
359
- metadata?: boolean | undefined;
360
- /**
361
- * Return format: chunks (with metadata) or texts (plain strings)
362
- */
363
- returnType?: ReturnTypeT | undefined;
364
- strategy: TokenChunker;
365
- /**
366
- * Maximum tokens per chunk
367
- */
368
- chunkSize?: number | undefined;
369
- /**
370
- * Number of tokens to overlap between chunks
371
- */
372
- chunkOverlap?: number | undefined;
373
- };
374
-
375
- /**
376
- * Request payload for text chunking with strategy-specific configuration
377
- */
378
- export type ChunkTextChunkingRequest =
379
- | SemanticChunkerStrategy
380
- | SDPMChunkerStrategy
381
- | AgenticChunkerStrategy
382
- | TokenChunkerStrategy
383
- | SentenceChunkerStrategy
384
- | RecursiveChunkerStrategy;
385
-
386
- export type ChunkTextMetadata = {
387
- startIndex: number | null;
388
- endIndex: number | null;
389
- tokenCount: number | null;
390
- };
391
-
392
- export type Chunks = {
393
- /**
394
- * The text content of the chunk
395
- */
396
- text: string;
397
- /**
398
- * The position index of this chunk in the sequence
399
- */
400
- index: number;
401
- metadata?: ChunkTextMetadata | undefined;
402
- };
403
-
404
- /**
405
- * Text successfully chunked
406
- */
407
- export type ChunkTextResponseBody = {
408
- chunks: Array<Chunks>;
409
- };
410
-
411
- /** @internal */
412
- export const ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$inboundSchema:
413
- z.ZodNativeEnum<
414
- typeof ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType
415
- > = z.nativeEnum(
416
- ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType,
417
- );
418
-
419
- /** @internal */
420
- export const ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$outboundSchema:
421
- z.ZodNativeEnum<
422
- typeof ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType
423
- > =
424
- ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$inboundSchema;
425
-
426
- /**
427
- * @internal
428
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
429
- */
430
- export namespace ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$ {
431
- /** @deprecated use `ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$inboundSchema` instead. */
432
- export const inboundSchema =
433
- ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$inboundSchema;
434
- /** @deprecated use `ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$outboundSchema` instead. */
435
- export const outboundSchema =
436
- ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$outboundSchema;
437
- }
438
-
439
- /** @internal */
440
- export const AgenticChunker$inboundSchema: z.ZodNativeEnum<
441
- typeof AgenticChunker
442
- > = z.nativeEnum(AgenticChunker);
443
-
444
- /** @internal */
445
- export const AgenticChunker$outboundSchema: z.ZodNativeEnum<
446
- typeof AgenticChunker
447
- > = AgenticChunker$inboundSchema;
448
-
449
- /**
450
- * @internal
451
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
452
- */
453
- export namespace AgenticChunker$ {
454
- /** @deprecated use `AgenticChunker$inboundSchema` instead. */
455
- export const inboundSchema = AgenticChunker$inboundSchema;
456
- /** @deprecated use `AgenticChunker$outboundSchema` instead. */
457
- export const outboundSchema = AgenticChunker$outboundSchema;
458
- }
459
-
460
- /** @internal */
461
- export const AgenticChunkerStrategy$inboundSchema: z.ZodType<
462
- AgenticChunkerStrategy,
463
- z.ZodTypeDef,
464
- unknown
465
- > = z.object({
466
- text: z.string(),
467
- metadata: z.boolean().default(true),
468
- return_type:
469
- ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$inboundSchema
470
- .default("chunks"),
471
- strategy: AgenticChunker$inboundSchema,
472
- model: z.string(),
473
- chunk_size: z.number().int().default(1024),
474
- candidate_size: z.number().int().default(128),
475
- min_characters_per_chunk: z.number().int().default(24),
476
- }).transform((v) => {
477
- return remap$(v, {
478
- "return_type": "returnType",
479
- "chunk_size": "chunkSize",
480
- "candidate_size": "candidateSize",
481
- "min_characters_per_chunk": "minCharactersPerChunk",
482
- });
483
- });
484
-
485
- /** @internal */
486
- export type AgenticChunkerStrategy$Outbound = {
487
- text: string;
488
- metadata: boolean;
489
- return_type: string;
490
- strategy: string;
491
- model: string;
492
- chunk_size: number;
493
- candidate_size: number;
494
- min_characters_per_chunk: number;
495
- };
496
-
497
- /** @internal */
498
- export const AgenticChunkerStrategy$outboundSchema: z.ZodType<
499
- AgenticChunkerStrategy$Outbound,
500
- z.ZodTypeDef,
501
- AgenticChunkerStrategy
502
- > = z.object({
503
- text: z.string(),
504
- metadata: z.boolean().default(true),
505
- returnType:
506
- ChunkTextChunkingRequestKnowledgeBasesRequestRequestBodyReturnType$outboundSchema
507
- .default("chunks"),
508
- strategy: AgenticChunker$outboundSchema,
509
- model: z.string(),
510
- chunkSize: z.number().int().default(1024),
511
- candidateSize: z.number().int().default(128),
512
- minCharactersPerChunk: z.number().int().default(24),
513
- }).transform((v) => {
514
- return remap$(v, {
515
- returnType: "return_type",
516
- chunkSize: "chunk_size",
517
- candidateSize: "candidate_size",
518
- minCharactersPerChunk: "min_characters_per_chunk",
519
- });
520
- });
521
-
522
- /**
523
- * @internal
524
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
525
- */
526
- export namespace AgenticChunkerStrategy$ {
527
- /** @deprecated use `AgenticChunkerStrategy$inboundSchema` instead. */
528
- export const inboundSchema = AgenticChunkerStrategy$inboundSchema;
529
- /** @deprecated use `AgenticChunkerStrategy$outboundSchema` instead. */
530
- export const outboundSchema = AgenticChunkerStrategy$outboundSchema;
531
- /** @deprecated use `AgenticChunkerStrategy$Outbound` instead. */
532
- export type Outbound = AgenticChunkerStrategy$Outbound;
533
- }
534
-
535
- export function agenticChunkerStrategyToJSON(
536
- agenticChunkerStrategy: AgenticChunkerStrategy,
537
- ): string {
538
- return JSON.stringify(
539
- AgenticChunkerStrategy$outboundSchema.parse(agenticChunkerStrategy),
540
- );
541
- }
542
-
543
- export function agenticChunkerStrategyFromJSON(
544
- jsonString: string,
545
- ): SafeParseResult<AgenticChunkerStrategy, SDKValidationError> {
546
- return safeParse(
547
- jsonString,
548
- (x) => AgenticChunkerStrategy$inboundSchema.parse(JSON.parse(x)),
549
- `Failed to parse 'AgenticChunkerStrategy' from JSON`,
550
- );
551
- }
552
-
553
- /** @internal */
554
- export const ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$inboundSchema:
555
- z.ZodNativeEnum<
556
- typeof ChunkTextChunkingRequestKnowledgeBasesRequestReturnType
557
- > = z.nativeEnum(ChunkTextChunkingRequestKnowledgeBasesRequestReturnType);
558
-
559
- /** @internal */
560
- export const ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$outboundSchema:
561
- z.ZodNativeEnum<
562
- typeof ChunkTextChunkingRequestKnowledgeBasesRequestReturnType
563
- > = ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$inboundSchema;
564
-
565
- /**
566
- * @internal
567
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
568
- */
569
- export namespace ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$ {
570
- /** @deprecated use `ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$inboundSchema` instead. */
571
- export const inboundSchema =
572
- ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$inboundSchema;
573
- /** @deprecated use `ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$outboundSchema` instead. */
574
- export const outboundSchema =
575
- ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$outboundSchema;
576
- }
577
-
578
- /** @internal */
579
- export const SDPMChunker$inboundSchema: z.ZodNativeEnum<typeof SDPMChunker> = z
580
- .nativeEnum(SDPMChunker);
581
-
582
- /** @internal */
583
- export const SDPMChunker$outboundSchema: z.ZodNativeEnum<typeof SDPMChunker> =
584
- SDPMChunker$inboundSchema;
585
-
586
- /**
587
- * @internal
588
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
589
- */
590
- export namespace SDPMChunker$ {
591
- /** @deprecated use `SDPMChunker$inboundSchema` instead. */
592
- export const inboundSchema = SDPMChunker$inboundSchema;
593
- /** @deprecated use `SDPMChunker$outboundSchema` instead. */
594
- export const outboundSchema = SDPMChunker$outboundSchema;
595
- }
596
-
597
- /** @internal */
598
- export const ChunkTextThreshold2$inboundSchema: z.ZodNativeEnum<
599
- typeof ChunkTextThreshold2
600
- > = z.nativeEnum(ChunkTextThreshold2);
601
-
602
- /** @internal */
603
- export const ChunkTextThreshold2$outboundSchema: z.ZodNativeEnum<
604
- typeof ChunkTextThreshold2
605
- > = ChunkTextThreshold2$inboundSchema;
606
-
607
- /**
608
- * @internal
609
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
610
- */
611
- export namespace ChunkTextThreshold2$ {
612
- /** @deprecated use `ChunkTextThreshold2$inboundSchema` instead. */
613
- export const inboundSchema = ChunkTextThreshold2$inboundSchema;
614
- /** @deprecated use `ChunkTextThreshold2$outboundSchema` instead. */
615
- export const outboundSchema = ChunkTextThreshold2$outboundSchema;
616
- }
617
-
618
- /** @internal */
619
- export const ChunkingRequestThreshold$inboundSchema: z.ZodType<
620
- ChunkingRequestThreshold,
621
- z.ZodTypeDef,
622
- unknown
623
- > = z.union([z.number(), ChunkTextThreshold2$inboundSchema]);
624
-
625
- /** @internal */
626
- export type ChunkingRequestThreshold$Outbound = number | string;
627
-
628
- /** @internal */
629
- export const ChunkingRequestThreshold$outboundSchema: z.ZodType<
630
- ChunkingRequestThreshold$Outbound,
631
- z.ZodTypeDef,
632
- ChunkingRequestThreshold
633
- > = z.union([z.number(), ChunkTextThreshold2$outboundSchema]);
634
-
635
- /**
636
- * @internal
637
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
638
- */
639
- export namespace ChunkingRequestThreshold$ {
640
- /** @deprecated use `ChunkingRequestThreshold$inboundSchema` instead. */
641
- export const inboundSchema = ChunkingRequestThreshold$inboundSchema;
642
- /** @deprecated use `ChunkingRequestThreshold$outboundSchema` instead. */
643
- export const outboundSchema = ChunkingRequestThreshold$outboundSchema;
644
- /** @deprecated use `ChunkingRequestThreshold$Outbound` instead. */
645
- export type Outbound = ChunkingRequestThreshold$Outbound;
646
- }
647
-
648
- export function chunkingRequestThresholdToJSON(
649
- chunkingRequestThreshold: ChunkingRequestThreshold,
650
- ): string {
651
- return JSON.stringify(
652
- ChunkingRequestThreshold$outboundSchema.parse(chunkingRequestThreshold),
653
- );
654
- }
655
-
656
- export function chunkingRequestThresholdFromJSON(
657
- jsonString: string,
658
- ): SafeParseResult<ChunkingRequestThreshold, SDKValidationError> {
659
- return safeParse(
660
- jsonString,
661
- (x) => ChunkingRequestThreshold$inboundSchema.parse(JSON.parse(x)),
662
- `Failed to parse 'ChunkingRequestThreshold' from JSON`,
663
- );
664
- }
665
-
666
- /** @internal */
667
- export const ChunkingRequestMode$inboundSchema: z.ZodNativeEnum<
668
- typeof ChunkingRequestMode
669
- > = z.nativeEnum(ChunkingRequestMode);
670
-
671
- /** @internal */
672
- export const ChunkingRequestMode$outboundSchema: z.ZodNativeEnum<
673
- typeof ChunkingRequestMode
674
- > = ChunkingRequestMode$inboundSchema;
675
-
676
- /**
677
- * @internal
678
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
679
- */
680
- export namespace ChunkingRequestMode$ {
681
- /** @deprecated use `ChunkingRequestMode$inboundSchema` instead. */
682
- export const inboundSchema = ChunkingRequestMode$inboundSchema;
683
- /** @deprecated use `ChunkingRequestMode$outboundSchema` instead. */
684
- export const outboundSchema = ChunkingRequestMode$outboundSchema;
685
- }
686
-
687
- /** @internal */
688
- export const SDPMChunkerStrategy$inboundSchema: z.ZodType<
689
- SDPMChunkerStrategy,
690
- z.ZodTypeDef,
691
- unknown
692
- > = z.object({
693
- text: z.string(),
694
- metadata: z.boolean().default(true),
695
- return_type:
696
- ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$inboundSchema
697
- .default("chunks"),
698
- strategy: SDPMChunker$inboundSchema,
699
- chunk_size: z.number().int().default(512),
700
- skip_window: z.number().int().default(1),
701
- threshold: z.union([z.number(), ChunkTextThreshold2$inboundSchema])
702
- .optional(),
703
- embedding_model: z.string(),
704
- mode: ChunkingRequestMode$inboundSchema.default("window"),
705
- }).transform((v) => {
706
- return remap$(v, {
707
- "return_type": "returnType",
708
- "chunk_size": "chunkSize",
709
- "skip_window": "skipWindow",
710
- "embedding_model": "embeddingModel",
711
- });
712
- });
713
-
714
- /** @internal */
715
- export type SDPMChunkerStrategy$Outbound = {
716
- text: string;
717
- metadata: boolean;
718
- return_type: string;
719
- strategy: string;
720
- chunk_size: number;
721
- skip_window: number;
722
- threshold?: number | string | undefined;
723
- embedding_model: string;
724
- mode: string;
725
- };
726
-
727
- /** @internal */
728
- export const SDPMChunkerStrategy$outboundSchema: z.ZodType<
729
- SDPMChunkerStrategy$Outbound,
730
- z.ZodTypeDef,
731
- SDPMChunkerStrategy
732
- > = z.object({
733
- text: z.string(),
734
- metadata: z.boolean().default(true),
735
- returnType:
736
- ChunkTextChunkingRequestKnowledgeBasesRequestReturnType$outboundSchema
737
- .default("chunks"),
738
- strategy: SDPMChunker$outboundSchema,
739
- chunkSize: z.number().int().default(512),
740
- skipWindow: z.number().int().default(1),
741
- threshold: z.union([z.number(), ChunkTextThreshold2$outboundSchema])
742
- .optional(),
743
- embeddingModel: z.string(),
744
- mode: ChunkingRequestMode$outboundSchema.default("window"),
745
- }).transform((v) => {
746
- return remap$(v, {
747
- returnType: "return_type",
748
- chunkSize: "chunk_size",
749
- skipWindow: "skip_window",
750
- embeddingModel: "embedding_model",
751
- });
752
- });
753
-
754
- /**
755
- * @internal
756
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
757
- */
758
- export namespace SDPMChunkerStrategy$ {
759
- /** @deprecated use `SDPMChunkerStrategy$inboundSchema` instead. */
760
- export const inboundSchema = SDPMChunkerStrategy$inboundSchema;
761
- /** @deprecated use `SDPMChunkerStrategy$outboundSchema` instead. */
762
- export const outboundSchema = SDPMChunkerStrategy$outboundSchema;
763
- /** @deprecated use `SDPMChunkerStrategy$Outbound` instead. */
764
- export type Outbound = SDPMChunkerStrategy$Outbound;
765
- }
766
-
767
- export function sdpmChunkerStrategyToJSON(
768
- sdpmChunkerStrategy: SDPMChunkerStrategy,
769
- ): string {
770
- return JSON.stringify(
771
- SDPMChunkerStrategy$outboundSchema.parse(sdpmChunkerStrategy),
772
- );
773
- }
774
-
775
- export function sdpmChunkerStrategyFromJSON(
776
- jsonString: string,
777
- ): SafeParseResult<SDPMChunkerStrategy, SDKValidationError> {
778
- return safeParse(
779
- jsonString,
780
- (x) => SDPMChunkerStrategy$inboundSchema.parse(JSON.parse(x)),
781
- `Failed to parse 'SDPMChunkerStrategy' from JSON`,
782
- );
783
- }
784
-
785
- /** @internal */
786
- export const ChunkTextChunkingRequestKnowledgeBasesReturnType$inboundSchema:
787
- z.ZodNativeEnum<typeof ChunkTextChunkingRequestKnowledgeBasesReturnType> = z
788
- .nativeEnum(ChunkTextChunkingRequestKnowledgeBasesReturnType);
789
-
790
- /** @internal */
791
- export const ChunkTextChunkingRequestKnowledgeBasesReturnType$outboundSchema:
792
- z.ZodNativeEnum<typeof ChunkTextChunkingRequestKnowledgeBasesReturnType> =
793
- ChunkTextChunkingRequestKnowledgeBasesReturnType$inboundSchema;
794
-
795
- /**
796
- * @internal
797
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
798
- */
799
- export namespace ChunkTextChunkingRequestKnowledgeBasesReturnType$ {
800
- /** @deprecated use `ChunkTextChunkingRequestKnowledgeBasesReturnType$inboundSchema` instead. */
801
- export const inboundSchema =
802
- ChunkTextChunkingRequestKnowledgeBasesReturnType$inboundSchema;
803
- /** @deprecated use `ChunkTextChunkingRequestKnowledgeBasesReturnType$outboundSchema` instead. */
804
- export const outboundSchema =
805
- ChunkTextChunkingRequestKnowledgeBasesReturnType$outboundSchema;
806
- }
807
-
808
- /** @internal */
809
- export const SemanticChunker$inboundSchema: z.ZodNativeEnum<
810
- typeof SemanticChunker
811
- > = z.nativeEnum(SemanticChunker);
812
-
813
- /** @internal */
814
- export const SemanticChunker$outboundSchema: z.ZodNativeEnum<
815
- typeof SemanticChunker
816
- > = SemanticChunker$inboundSchema;
817
-
818
- /**
819
- * @internal
820
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
821
- */
822
- export namespace SemanticChunker$ {
823
- /** @deprecated use `SemanticChunker$inboundSchema` instead. */
824
- export const inboundSchema = SemanticChunker$inboundSchema;
825
- /** @deprecated use `SemanticChunker$outboundSchema` instead. */
826
- export const outboundSchema = SemanticChunker$outboundSchema;
827
- }
828
-
829
- /** @internal */
830
- export const Threshold2$inboundSchema: z.ZodNativeEnum<typeof Threshold2> = z
831
- .nativeEnum(Threshold2);
832
-
833
- /** @internal */
834
- export const Threshold2$outboundSchema: z.ZodNativeEnum<typeof Threshold2> =
835
- Threshold2$inboundSchema;
836
-
837
- /**
838
- * @internal
839
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
840
- */
841
- export namespace Threshold2$ {
842
- /** @deprecated use `Threshold2$inboundSchema` instead. */
843
- export const inboundSchema = Threshold2$inboundSchema;
844
- /** @deprecated use `Threshold2$outboundSchema` instead. */
845
- export const outboundSchema = Threshold2$outboundSchema;
846
- }
847
-
848
- /** @internal */
849
- export const Threshold$inboundSchema: z.ZodType<
850
- Threshold,
851
- z.ZodTypeDef,
852
- unknown
853
- > = z.union([z.number(), Threshold2$inboundSchema]);
854
-
855
- /** @internal */
856
- export type Threshold$Outbound = number | string;
857
-
858
- /** @internal */
859
- export const Threshold$outboundSchema: z.ZodType<
860
- Threshold$Outbound,
861
- z.ZodTypeDef,
862
- Threshold
863
- > = z.union([z.number(), Threshold2$outboundSchema]);
864
-
865
- /**
866
- * @internal
867
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
868
- */
869
- export namespace Threshold$ {
870
- /** @deprecated use `Threshold$inboundSchema` instead. */
871
- export const inboundSchema = Threshold$inboundSchema;
872
- /** @deprecated use `Threshold$outboundSchema` instead. */
873
- export const outboundSchema = Threshold$outboundSchema;
874
- /** @deprecated use `Threshold$Outbound` instead. */
875
- export type Outbound = Threshold$Outbound;
876
- }
877
-
878
- export function thresholdToJSON(threshold: Threshold): string {
879
- return JSON.stringify(Threshold$outboundSchema.parse(threshold));
880
- }
881
-
882
- export function thresholdFromJSON(
883
- jsonString: string,
884
- ): SafeParseResult<Threshold, SDKValidationError> {
885
- return safeParse(
886
- jsonString,
887
- (x) => Threshold$inboundSchema.parse(JSON.parse(x)),
888
- `Failed to parse 'Threshold' from JSON`,
889
- );
890
- }
891
-
892
- /** @internal */
893
- export const Mode$inboundSchema: z.ZodNativeEnum<typeof Mode> = z.nativeEnum(
894
- Mode,
895
- );
896
-
897
- /** @internal */
898
- export const Mode$outboundSchema: z.ZodNativeEnum<typeof Mode> =
899
- Mode$inboundSchema;
900
-
901
- /**
902
- * @internal
903
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
904
- */
905
- export namespace Mode$ {
906
- /** @deprecated use `Mode$inboundSchema` instead. */
907
- export const inboundSchema = Mode$inboundSchema;
908
- /** @deprecated use `Mode$outboundSchema` instead. */
909
- export const outboundSchema = Mode$outboundSchema;
910
- }
911
-
912
- /** @internal */
913
- export const SemanticChunkerStrategy$inboundSchema: z.ZodType<
914
- SemanticChunkerStrategy,
915
- z.ZodTypeDef,
916
- unknown
917
- > = z.object({
918
- text: z.string(),
919
- metadata: z.boolean().default(true),
920
- return_type: ChunkTextChunkingRequestKnowledgeBasesReturnType$inboundSchema
921
- .default("chunks"),
922
- strategy: SemanticChunker$inboundSchema,
923
- chunk_size: z.number().int().default(512),
924
- threshold: z.union([z.number(), Threshold2$inboundSchema]).optional(),
925
- embedding_model: z.string(),
926
- mode: Mode$inboundSchema.default("window"),
927
- similarity_window: z.number().int().default(1),
928
- }).transform((v) => {
929
- return remap$(v, {
930
- "return_type": "returnType",
931
- "chunk_size": "chunkSize",
932
- "embedding_model": "embeddingModel",
933
- "similarity_window": "similarityWindow",
934
- });
935
- });
936
-
937
- /** @internal */
938
- export type SemanticChunkerStrategy$Outbound = {
939
- text: string;
940
- metadata: boolean;
941
- return_type: string;
942
- strategy: string;
943
- chunk_size: number;
944
- threshold?: number | string | undefined;
945
- embedding_model: string;
946
- mode: string;
947
- similarity_window: number;
948
- };
949
-
950
- /** @internal */
951
- export const SemanticChunkerStrategy$outboundSchema: z.ZodType<
952
- SemanticChunkerStrategy$Outbound,
953
- z.ZodTypeDef,
954
- SemanticChunkerStrategy
955
- > = z.object({
956
- text: z.string(),
957
- metadata: z.boolean().default(true),
958
- returnType: ChunkTextChunkingRequestKnowledgeBasesReturnType$outboundSchema
959
- .default("chunks"),
960
- strategy: SemanticChunker$outboundSchema,
961
- chunkSize: z.number().int().default(512),
962
- threshold: z.union([z.number(), Threshold2$outboundSchema]).optional(),
963
- embeddingModel: z.string(),
964
- mode: Mode$outboundSchema.default("window"),
965
- similarityWindow: z.number().int().default(1),
966
- }).transform((v) => {
967
- return remap$(v, {
968
- returnType: "return_type",
969
- chunkSize: "chunk_size",
970
- embeddingModel: "embedding_model",
971
- similarityWindow: "similarity_window",
972
- });
973
- });
974
-
975
- /**
976
- * @internal
977
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
978
- */
979
- export namespace SemanticChunkerStrategy$ {
980
- /** @deprecated use `SemanticChunkerStrategy$inboundSchema` instead. */
981
- export const inboundSchema = SemanticChunkerStrategy$inboundSchema;
982
- /** @deprecated use `SemanticChunkerStrategy$outboundSchema` instead. */
983
- export const outboundSchema = SemanticChunkerStrategy$outboundSchema;
984
- /** @deprecated use `SemanticChunkerStrategy$Outbound` instead. */
985
- export type Outbound = SemanticChunkerStrategy$Outbound;
986
- }
987
-
988
- export function semanticChunkerStrategyToJSON(
989
- semanticChunkerStrategy: SemanticChunkerStrategy,
990
- ): string {
991
- return JSON.stringify(
992
- SemanticChunkerStrategy$outboundSchema.parse(semanticChunkerStrategy),
993
- );
994
- }
995
-
996
- export function semanticChunkerStrategyFromJSON(
997
- jsonString: string,
998
- ): SafeParseResult<SemanticChunkerStrategy, SDKValidationError> {
999
- return safeParse(
1000
- jsonString,
1001
- (x) => SemanticChunkerStrategy$inboundSchema.parse(JSON.parse(x)),
1002
- `Failed to parse 'SemanticChunkerStrategy' from JSON`,
1003
- );
1004
- }
1005
-
1006
- /** @internal */
1007
- export const ChunkTextChunkingRequestReturnType$inboundSchema: z.ZodNativeEnum<
1008
- typeof ChunkTextChunkingRequestReturnType
1009
- > = z.nativeEnum(ChunkTextChunkingRequestReturnType);
1010
-
1011
- /** @internal */
1012
- export const ChunkTextChunkingRequestReturnType$outboundSchema: z.ZodNativeEnum<
1013
- typeof ChunkTextChunkingRequestReturnType
1014
- > = ChunkTextChunkingRequestReturnType$inboundSchema;
1015
-
1016
- /**
1017
- * @internal
1018
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1019
- */
1020
- export namespace ChunkTextChunkingRequestReturnType$ {
1021
- /** @deprecated use `ChunkTextChunkingRequestReturnType$inboundSchema` instead. */
1022
- export const inboundSchema = ChunkTextChunkingRequestReturnType$inboundSchema;
1023
- /** @deprecated use `ChunkTextChunkingRequestReturnType$outboundSchema` instead. */
1024
- export const outboundSchema =
1025
- ChunkTextChunkingRequestReturnType$outboundSchema;
1026
- }
1027
-
1028
- /** @internal */
1029
- export const RecursiveChunker$inboundSchema: z.ZodNativeEnum<
1030
- typeof RecursiveChunker
1031
- > = z.nativeEnum(RecursiveChunker);
1032
-
1033
- /** @internal */
1034
- export const RecursiveChunker$outboundSchema: z.ZodNativeEnum<
1035
- typeof RecursiveChunker
1036
- > = RecursiveChunker$inboundSchema;
1037
-
1038
- /**
1039
- * @internal
1040
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1041
- */
1042
- export namespace RecursiveChunker$ {
1043
- /** @deprecated use `RecursiveChunker$inboundSchema` instead. */
1044
- export const inboundSchema = RecursiveChunker$inboundSchema;
1045
- /** @deprecated use `RecursiveChunker$outboundSchema` instead. */
1046
- export const outboundSchema = RecursiveChunker$outboundSchema;
1047
- }
1048
-
1049
- /** @internal */
1050
- export const RecursiveChunkerStrategy$inboundSchema: z.ZodType<
1051
- RecursiveChunkerStrategy,
1052
- z.ZodTypeDef,
1053
- unknown
1054
- > = z.object({
1055
- text: z.string(),
1056
- metadata: z.boolean().default(true),
1057
- return_type: ChunkTextChunkingRequestReturnType$inboundSchema.default(
1058
- "chunks",
1059
- ),
1060
- strategy: RecursiveChunker$inboundSchema,
1061
- chunk_size: z.number().int().default(512),
1062
- separators: z.array(z.string()).optional(),
1063
- min_characters_per_chunk: z.number().int().default(24),
1064
- }).transform((v) => {
1065
- return remap$(v, {
1066
- "return_type": "returnType",
1067
- "chunk_size": "chunkSize",
1068
- "min_characters_per_chunk": "minCharactersPerChunk",
1069
- });
1070
- });
1071
-
1072
- /** @internal */
1073
- export type RecursiveChunkerStrategy$Outbound = {
1074
- text: string;
1075
- metadata: boolean;
1076
- return_type: string;
1077
- strategy: string;
1078
- chunk_size: number;
1079
- separators?: Array<string> | undefined;
1080
- min_characters_per_chunk: number;
1081
- };
1082
-
1083
- /** @internal */
1084
- export const RecursiveChunkerStrategy$outboundSchema: z.ZodType<
1085
- RecursiveChunkerStrategy$Outbound,
1086
- z.ZodTypeDef,
1087
- RecursiveChunkerStrategy
1088
- > = z.object({
1089
- text: z.string(),
1090
- metadata: z.boolean().default(true),
1091
- returnType: ChunkTextChunkingRequestReturnType$outboundSchema.default(
1092
- "chunks",
1093
- ),
1094
- strategy: RecursiveChunker$outboundSchema,
1095
- chunkSize: z.number().int().default(512),
1096
- separators: z.array(z.string()).optional(),
1097
- minCharactersPerChunk: z.number().int().default(24),
1098
- }).transform((v) => {
1099
- return remap$(v, {
1100
- returnType: "return_type",
1101
- chunkSize: "chunk_size",
1102
- minCharactersPerChunk: "min_characters_per_chunk",
1103
- });
1104
- });
1105
-
1106
- /**
1107
- * @internal
1108
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1109
- */
1110
- export namespace RecursiveChunkerStrategy$ {
1111
- /** @deprecated use `RecursiveChunkerStrategy$inboundSchema` instead. */
1112
- export const inboundSchema = RecursiveChunkerStrategy$inboundSchema;
1113
- /** @deprecated use `RecursiveChunkerStrategy$outboundSchema` instead. */
1114
- export const outboundSchema = RecursiveChunkerStrategy$outboundSchema;
1115
- /** @deprecated use `RecursiveChunkerStrategy$Outbound` instead. */
1116
- export type Outbound = RecursiveChunkerStrategy$Outbound;
1117
- }
1118
-
1119
- export function recursiveChunkerStrategyToJSON(
1120
- recursiveChunkerStrategy: RecursiveChunkerStrategy,
1121
- ): string {
1122
- return JSON.stringify(
1123
- RecursiveChunkerStrategy$outboundSchema.parse(recursiveChunkerStrategy),
1124
- );
1125
- }
1126
-
1127
- export function recursiveChunkerStrategyFromJSON(
1128
- jsonString: string,
1129
- ): SafeParseResult<RecursiveChunkerStrategy, SDKValidationError> {
1130
- return safeParse(
1131
- jsonString,
1132
- (x) => RecursiveChunkerStrategy$inboundSchema.parse(JSON.parse(x)),
1133
- `Failed to parse 'RecursiveChunkerStrategy' from JSON`,
1134
- );
1135
- }
1136
-
1137
- /** @internal */
1138
- export const ChunkingRequestReturnType$inboundSchema: z.ZodNativeEnum<
1139
- typeof ChunkingRequestReturnType
1140
- > = z.nativeEnum(ChunkingRequestReturnType);
1141
-
1142
- /** @internal */
1143
- export const ChunkingRequestReturnType$outboundSchema: z.ZodNativeEnum<
1144
- typeof ChunkingRequestReturnType
1145
- > = ChunkingRequestReturnType$inboundSchema;
1146
-
1147
- /**
1148
- * @internal
1149
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1150
- */
1151
- export namespace ChunkingRequestReturnType$ {
1152
- /** @deprecated use `ChunkingRequestReturnType$inboundSchema` instead. */
1153
- export const inboundSchema = ChunkingRequestReturnType$inboundSchema;
1154
- /** @deprecated use `ChunkingRequestReturnType$outboundSchema` instead. */
1155
- export const outboundSchema = ChunkingRequestReturnType$outboundSchema;
1156
- }
1157
-
1158
- /** @internal */
1159
- export const SentenceChunker$inboundSchema: z.ZodNativeEnum<
1160
- typeof SentenceChunker
1161
- > = z.nativeEnum(SentenceChunker);
1162
-
1163
- /** @internal */
1164
- export const SentenceChunker$outboundSchema: z.ZodNativeEnum<
1165
- typeof SentenceChunker
1166
- > = SentenceChunker$inboundSchema;
1167
-
1168
- /**
1169
- * @internal
1170
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1171
- */
1172
- export namespace SentenceChunker$ {
1173
- /** @deprecated use `SentenceChunker$inboundSchema` instead. */
1174
- export const inboundSchema = SentenceChunker$inboundSchema;
1175
- /** @deprecated use `SentenceChunker$outboundSchema` instead. */
1176
- export const outboundSchema = SentenceChunker$outboundSchema;
1177
- }
1178
-
1179
- /** @internal */
1180
- export const SentenceChunkerStrategy$inboundSchema: z.ZodType<
1181
- SentenceChunkerStrategy,
1182
- z.ZodTypeDef,
1183
- unknown
1184
- > = z.object({
1185
- text: z.string(),
1186
- metadata: z.boolean().default(true),
1187
- return_type: ChunkingRequestReturnType$inboundSchema.default("chunks"),
1188
- strategy: SentenceChunker$inboundSchema,
1189
- chunk_size: z.number().int().default(512),
1190
- chunk_overlap: z.number().int().default(0),
1191
- min_sentences_per_chunk: z.number().int().default(1),
1192
- }).transform((v) => {
1193
- return remap$(v, {
1194
- "return_type": "returnType",
1195
- "chunk_size": "chunkSize",
1196
- "chunk_overlap": "chunkOverlap",
1197
- "min_sentences_per_chunk": "minSentencesPerChunk",
1198
- });
1199
- });
1200
-
1201
- /** @internal */
1202
- export type SentenceChunkerStrategy$Outbound = {
1203
- text: string;
1204
- metadata: boolean;
1205
- return_type: string;
1206
- strategy: string;
1207
- chunk_size: number;
1208
- chunk_overlap: number;
1209
- min_sentences_per_chunk: number;
1210
- };
1211
-
1212
- /** @internal */
1213
- export const SentenceChunkerStrategy$outboundSchema: z.ZodType<
1214
- SentenceChunkerStrategy$Outbound,
1215
- z.ZodTypeDef,
1216
- SentenceChunkerStrategy
1217
- > = z.object({
1218
- text: z.string(),
1219
- metadata: z.boolean().default(true),
1220
- returnType: ChunkingRequestReturnType$outboundSchema.default("chunks"),
1221
- strategy: SentenceChunker$outboundSchema,
1222
- chunkSize: z.number().int().default(512),
1223
- chunkOverlap: z.number().int().default(0),
1224
- minSentencesPerChunk: z.number().int().default(1),
1225
- }).transform((v) => {
1226
- return remap$(v, {
1227
- returnType: "return_type",
1228
- chunkSize: "chunk_size",
1229
- chunkOverlap: "chunk_overlap",
1230
- minSentencesPerChunk: "min_sentences_per_chunk",
1231
- });
1232
- });
1233
-
1234
- /**
1235
- * @internal
1236
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1237
- */
1238
- export namespace SentenceChunkerStrategy$ {
1239
- /** @deprecated use `SentenceChunkerStrategy$inboundSchema` instead. */
1240
- export const inboundSchema = SentenceChunkerStrategy$inboundSchema;
1241
- /** @deprecated use `SentenceChunkerStrategy$outboundSchema` instead. */
1242
- export const outboundSchema = SentenceChunkerStrategy$outboundSchema;
1243
- /** @deprecated use `SentenceChunkerStrategy$Outbound` instead. */
1244
- export type Outbound = SentenceChunkerStrategy$Outbound;
1245
- }
1246
-
1247
- export function sentenceChunkerStrategyToJSON(
1248
- sentenceChunkerStrategy: SentenceChunkerStrategy,
1249
- ): string {
1250
- return JSON.stringify(
1251
- SentenceChunkerStrategy$outboundSchema.parse(sentenceChunkerStrategy),
1252
- );
1253
- }
1254
-
1255
- export function sentenceChunkerStrategyFromJSON(
1256
- jsonString: string,
1257
- ): SafeParseResult<SentenceChunkerStrategy, SDKValidationError> {
1258
- return safeParse(
1259
- jsonString,
1260
- (x) => SentenceChunkerStrategy$inboundSchema.parse(JSON.parse(x)),
1261
- `Failed to parse 'SentenceChunkerStrategy' from JSON`,
1262
- );
1263
- }
1264
-
1265
- /** @internal */
1266
- export const ReturnTypeT$inboundSchema: z.ZodNativeEnum<typeof ReturnTypeT> = z
1267
- .nativeEnum(ReturnTypeT);
1268
-
1269
- /** @internal */
1270
- export const ReturnTypeT$outboundSchema: z.ZodNativeEnum<typeof ReturnTypeT> =
1271
- ReturnTypeT$inboundSchema;
1272
-
1273
- /**
1274
- * @internal
1275
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1276
- */
1277
- export namespace ReturnTypeT$ {
1278
- /** @deprecated use `ReturnTypeT$inboundSchema` instead. */
1279
- export const inboundSchema = ReturnTypeT$inboundSchema;
1280
- /** @deprecated use `ReturnTypeT$outboundSchema` instead. */
1281
- export const outboundSchema = ReturnTypeT$outboundSchema;
1282
- }
1283
-
1284
- /** @internal */
1285
- export const TokenChunker$inboundSchema: z.ZodNativeEnum<typeof TokenChunker> =
1286
- z.nativeEnum(TokenChunker);
1287
-
1288
- /** @internal */
1289
- export const TokenChunker$outboundSchema: z.ZodNativeEnum<typeof TokenChunker> =
1290
- TokenChunker$inboundSchema;
1291
-
1292
- /**
1293
- * @internal
1294
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1295
- */
1296
- export namespace TokenChunker$ {
1297
- /** @deprecated use `TokenChunker$inboundSchema` instead. */
1298
- export const inboundSchema = TokenChunker$inboundSchema;
1299
- /** @deprecated use `TokenChunker$outboundSchema` instead. */
1300
- export const outboundSchema = TokenChunker$outboundSchema;
1301
- }
1302
-
1303
- /** @internal */
1304
- export const TokenChunkerStrategy$inboundSchema: z.ZodType<
1305
- TokenChunkerStrategy,
1306
- z.ZodTypeDef,
1307
- unknown
1308
- > = z.object({
1309
- text: z.string(),
1310
- metadata: z.boolean().default(true),
1311
- return_type: ReturnTypeT$inboundSchema.default("chunks"),
1312
- strategy: TokenChunker$inboundSchema,
1313
- chunk_size: z.number().int().default(512),
1314
- chunk_overlap: z.number().int().default(0),
1315
- }).transform((v) => {
1316
- return remap$(v, {
1317
- "return_type": "returnType",
1318
- "chunk_size": "chunkSize",
1319
- "chunk_overlap": "chunkOverlap",
1320
- });
1321
- });
1322
-
1323
- /** @internal */
1324
- export type TokenChunkerStrategy$Outbound = {
1325
- text: string;
1326
- metadata: boolean;
1327
- return_type: string;
1328
- strategy: string;
1329
- chunk_size: number;
1330
- chunk_overlap: number;
1331
- };
1332
-
1333
- /** @internal */
1334
- export const TokenChunkerStrategy$outboundSchema: z.ZodType<
1335
- TokenChunkerStrategy$Outbound,
1336
- z.ZodTypeDef,
1337
- TokenChunkerStrategy
1338
- > = z.object({
1339
- text: z.string(),
1340
- metadata: z.boolean().default(true),
1341
- returnType: ReturnTypeT$outboundSchema.default("chunks"),
1342
- strategy: TokenChunker$outboundSchema,
1343
- chunkSize: z.number().int().default(512),
1344
- chunkOverlap: z.number().int().default(0),
1345
- }).transform((v) => {
1346
- return remap$(v, {
1347
- returnType: "return_type",
1348
- chunkSize: "chunk_size",
1349
- chunkOverlap: "chunk_overlap",
1350
- });
1351
- });
1352
-
1353
- /**
1354
- * @internal
1355
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1356
- */
1357
- export namespace TokenChunkerStrategy$ {
1358
- /** @deprecated use `TokenChunkerStrategy$inboundSchema` instead. */
1359
- export const inboundSchema = TokenChunkerStrategy$inboundSchema;
1360
- /** @deprecated use `TokenChunkerStrategy$outboundSchema` instead. */
1361
- export const outboundSchema = TokenChunkerStrategy$outboundSchema;
1362
- /** @deprecated use `TokenChunkerStrategy$Outbound` instead. */
1363
- export type Outbound = TokenChunkerStrategy$Outbound;
1364
- }
1365
-
1366
- export function tokenChunkerStrategyToJSON(
1367
- tokenChunkerStrategy: TokenChunkerStrategy,
1368
- ): string {
1369
- return JSON.stringify(
1370
- TokenChunkerStrategy$outboundSchema.parse(tokenChunkerStrategy),
1371
- );
1372
- }
1373
-
1374
- export function tokenChunkerStrategyFromJSON(
1375
- jsonString: string,
1376
- ): SafeParseResult<TokenChunkerStrategy, SDKValidationError> {
1377
- return safeParse(
1378
- jsonString,
1379
- (x) => TokenChunkerStrategy$inboundSchema.parse(JSON.parse(x)),
1380
- `Failed to parse 'TokenChunkerStrategy' from JSON`,
1381
- );
1382
- }
1383
-
1384
- /** @internal */
1385
- export const ChunkTextChunkingRequest$inboundSchema: z.ZodType<
1386
- ChunkTextChunkingRequest,
1387
- z.ZodTypeDef,
1388
- unknown
1389
- > = z.union([
1390
- z.lazy(() => SemanticChunkerStrategy$inboundSchema),
1391
- z.lazy(() => SDPMChunkerStrategy$inboundSchema),
1392
- z.lazy(() => AgenticChunkerStrategy$inboundSchema),
1393
- z.lazy(() => TokenChunkerStrategy$inboundSchema),
1394
- z.lazy(() => SentenceChunkerStrategy$inboundSchema),
1395
- z.lazy(() => RecursiveChunkerStrategy$inboundSchema),
1396
- ]);
1397
-
1398
- /** @internal */
1399
- export type ChunkTextChunkingRequest$Outbound =
1400
- | SemanticChunkerStrategy$Outbound
1401
- | SDPMChunkerStrategy$Outbound
1402
- | AgenticChunkerStrategy$Outbound
1403
- | TokenChunkerStrategy$Outbound
1404
- | SentenceChunkerStrategy$Outbound
1405
- | RecursiveChunkerStrategy$Outbound;
1406
-
1407
- /** @internal */
1408
- export const ChunkTextChunkingRequest$outboundSchema: z.ZodType<
1409
- ChunkTextChunkingRequest$Outbound,
1410
- z.ZodTypeDef,
1411
- ChunkTextChunkingRequest
1412
- > = z.union([
1413
- z.lazy(() => SemanticChunkerStrategy$outboundSchema),
1414
- z.lazy(() => SDPMChunkerStrategy$outboundSchema),
1415
- z.lazy(() => AgenticChunkerStrategy$outboundSchema),
1416
- z.lazy(() => TokenChunkerStrategy$outboundSchema),
1417
- z.lazy(() => SentenceChunkerStrategy$outboundSchema),
1418
- z.lazy(() => RecursiveChunkerStrategy$outboundSchema),
1419
- ]);
1420
-
1421
- /**
1422
- * @internal
1423
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1424
- */
1425
- export namespace ChunkTextChunkingRequest$ {
1426
- /** @deprecated use `ChunkTextChunkingRequest$inboundSchema` instead. */
1427
- export const inboundSchema = ChunkTextChunkingRequest$inboundSchema;
1428
- /** @deprecated use `ChunkTextChunkingRequest$outboundSchema` instead. */
1429
- export const outboundSchema = ChunkTextChunkingRequest$outboundSchema;
1430
- /** @deprecated use `ChunkTextChunkingRequest$Outbound` instead. */
1431
- export type Outbound = ChunkTextChunkingRequest$Outbound;
1432
- }
1433
-
1434
- export function chunkTextChunkingRequestToJSON(
1435
- chunkTextChunkingRequest: ChunkTextChunkingRequest,
1436
- ): string {
1437
- return JSON.stringify(
1438
- ChunkTextChunkingRequest$outboundSchema.parse(chunkTextChunkingRequest),
1439
- );
1440
- }
1441
-
1442
- export function chunkTextChunkingRequestFromJSON(
1443
- jsonString: string,
1444
- ): SafeParseResult<ChunkTextChunkingRequest, SDKValidationError> {
1445
- return safeParse(
1446
- jsonString,
1447
- (x) => ChunkTextChunkingRequest$inboundSchema.parse(JSON.parse(x)),
1448
- `Failed to parse 'ChunkTextChunkingRequest' from JSON`,
1449
- );
1450
- }
1451
-
1452
- /** @internal */
1453
- export const ChunkTextMetadata$inboundSchema: z.ZodType<
1454
- ChunkTextMetadata,
1455
- z.ZodTypeDef,
1456
- unknown
1457
- > = z.object({
1458
- start_index: z.nullable(z.number()),
1459
- end_index: z.nullable(z.number()),
1460
- token_count: z.nullable(z.number()),
1461
- }).transform((v) => {
1462
- return remap$(v, {
1463
- "start_index": "startIndex",
1464
- "end_index": "endIndex",
1465
- "token_count": "tokenCount",
1466
- });
1467
- });
1468
-
1469
- /** @internal */
1470
- export type ChunkTextMetadata$Outbound = {
1471
- start_index: number | null;
1472
- end_index: number | null;
1473
- token_count: number | null;
1474
- };
1475
-
1476
- /** @internal */
1477
- export const ChunkTextMetadata$outboundSchema: z.ZodType<
1478
- ChunkTextMetadata$Outbound,
1479
- z.ZodTypeDef,
1480
- ChunkTextMetadata
1481
- > = z.object({
1482
- startIndex: z.nullable(z.number()),
1483
- endIndex: z.nullable(z.number()),
1484
- tokenCount: z.nullable(z.number()),
1485
- }).transform((v) => {
1486
- return remap$(v, {
1487
- startIndex: "start_index",
1488
- endIndex: "end_index",
1489
- tokenCount: "token_count",
1490
- });
1491
- });
1492
-
1493
- /**
1494
- * @internal
1495
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1496
- */
1497
- export namespace ChunkTextMetadata$ {
1498
- /** @deprecated use `ChunkTextMetadata$inboundSchema` instead. */
1499
- export const inboundSchema = ChunkTextMetadata$inboundSchema;
1500
- /** @deprecated use `ChunkTextMetadata$outboundSchema` instead. */
1501
- export const outboundSchema = ChunkTextMetadata$outboundSchema;
1502
- /** @deprecated use `ChunkTextMetadata$Outbound` instead. */
1503
- export type Outbound = ChunkTextMetadata$Outbound;
1504
- }
1505
-
1506
- export function chunkTextMetadataToJSON(
1507
- chunkTextMetadata: ChunkTextMetadata,
1508
- ): string {
1509
- return JSON.stringify(
1510
- ChunkTextMetadata$outboundSchema.parse(chunkTextMetadata),
1511
- );
1512
- }
1513
-
1514
- export function chunkTextMetadataFromJSON(
1515
- jsonString: string,
1516
- ): SafeParseResult<ChunkTextMetadata, SDKValidationError> {
1517
- return safeParse(
1518
- jsonString,
1519
- (x) => ChunkTextMetadata$inboundSchema.parse(JSON.parse(x)),
1520
- `Failed to parse 'ChunkTextMetadata' from JSON`,
1521
- );
1522
- }
1523
-
1524
- /** @internal */
1525
- export const Chunks$inboundSchema: z.ZodType<Chunks, z.ZodTypeDef, unknown> = z
1526
- .object({
1527
- text: z.string(),
1528
- index: z.number(),
1529
- metadata: z.lazy(() => ChunkTextMetadata$inboundSchema).optional(),
1530
- });
1531
-
1532
- /** @internal */
1533
- export type Chunks$Outbound = {
1534
- text: string;
1535
- index: number;
1536
- metadata?: ChunkTextMetadata$Outbound | undefined;
1537
- };
1538
-
1539
- /** @internal */
1540
- export const Chunks$outboundSchema: z.ZodType<
1541
- Chunks$Outbound,
1542
- z.ZodTypeDef,
1543
- Chunks
1544
- > = z.object({
1545
- text: z.string(),
1546
- index: z.number(),
1547
- metadata: z.lazy(() => ChunkTextMetadata$outboundSchema).optional(),
1548
- });
1549
-
1550
- /**
1551
- * @internal
1552
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1553
- */
1554
- export namespace Chunks$ {
1555
- /** @deprecated use `Chunks$inboundSchema` instead. */
1556
- export const inboundSchema = Chunks$inboundSchema;
1557
- /** @deprecated use `Chunks$outboundSchema` instead. */
1558
- export const outboundSchema = Chunks$outboundSchema;
1559
- /** @deprecated use `Chunks$Outbound` instead. */
1560
- export type Outbound = Chunks$Outbound;
1561
- }
1562
-
1563
- export function chunksToJSON(chunks: Chunks): string {
1564
- return JSON.stringify(Chunks$outboundSchema.parse(chunks));
1565
- }
1566
-
1567
- export function chunksFromJSON(
1568
- jsonString: string,
1569
- ): SafeParseResult<Chunks, SDKValidationError> {
1570
- return safeParse(
1571
- jsonString,
1572
- (x) => Chunks$inboundSchema.parse(JSON.parse(x)),
1573
- `Failed to parse 'Chunks' from JSON`,
1574
- );
1575
- }
1576
-
1577
- /** @internal */
1578
- export const ChunkTextResponseBody$inboundSchema: z.ZodType<
1579
- ChunkTextResponseBody,
1580
- z.ZodTypeDef,
1581
- unknown
1582
- > = z.object({
1583
- chunks: z.array(z.lazy(() => Chunks$inboundSchema)),
1584
- });
1585
-
1586
- /** @internal */
1587
- export type ChunkTextResponseBody$Outbound = {
1588
- chunks: Array<Chunks$Outbound>;
1589
- };
1590
-
1591
- /** @internal */
1592
- export const ChunkTextResponseBody$outboundSchema: z.ZodType<
1593
- ChunkTextResponseBody$Outbound,
1594
- z.ZodTypeDef,
1595
- ChunkTextResponseBody
1596
- > = z.object({
1597
- chunks: z.array(z.lazy(() => Chunks$outboundSchema)),
1598
- });
1599
-
1600
- /**
1601
- * @internal
1602
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
1603
- */
1604
- export namespace ChunkTextResponseBody$ {
1605
- /** @deprecated use `ChunkTextResponseBody$inboundSchema` instead. */
1606
- export const inboundSchema = ChunkTextResponseBody$inboundSchema;
1607
- /** @deprecated use `ChunkTextResponseBody$outboundSchema` instead. */
1608
- export const outboundSchema = ChunkTextResponseBody$outboundSchema;
1609
- /** @deprecated use `ChunkTextResponseBody$Outbound` instead. */
1610
- export type Outbound = ChunkTextResponseBody$Outbound;
1611
- }
1612
-
1613
- export function chunkTextResponseBodyToJSON(
1614
- chunkTextResponseBody: ChunkTextResponseBody,
1615
- ): string {
1616
- return JSON.stringify(
1617
- ChunkTextResponseBody$outboundSchema.parse(chunkTextResponseBody),
1618
- );
1619
- }
1620
-
1621
- export function chunkTextResponseBodyFromJSON(
1622
- jsonString: string,
1623
- ): SafeParseResult<ChunkTextResponseBody, SDKValidationError> {
1624
- return safeParse(
1625
- jsonString,
1626
- (x) => ChunkTextResponseBody$inboundSchema.parse(JSON.parse(x)),
1627
- `Failed to parse 'ChunkTextResponseBody' from JSON`,
1628
- );
1629
- }