@orq-ai/node 4.15.0-rc.7 → 4.15.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -28
- package/funcs/knowledgePreviewChunks.d.ts +18 -0
- package/funcs/knowledgePreviewChunks.d.ts.map +1 -0
- package/funcs/knowledgePreviewChunks.js +122 -0
- package/funcs/knowledgePreviewChunks.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/chunkingconfiguration.d.ts +263 -4
- package/models/components/chunkingconfiguration.d.ts.map +1 -1
- package/models/components/chunkingconfiguration.js +144 -1
- package/models/components/chunkingconfiguration.js.map +1 -1
- package/models/components/datasourcesservicepreviewchunksrequest.d.ts +15 -0
- package/models/components/datasourcesservicepreviewchunksrequest.d.ts.map +1 -0
- package/models/components/datasourcesservicepreviewchunksrequest.js +57 -0
- package/models/components/datasourcesservicepreviewchunksrequest.js.map +1 -0
- package/models/components/datasourcesservicepreviewchunksresponse.d.ts +13 -0
- package/models/components/datasourcesservicepreviewchunksresponse.d.ts.map +1 -0
- package/models/components/datasourcesservicepreviewchunksresponse.js +53 -0
- package/models/components/datasourcesservicepreviewchunksresponse.js.map +1 -0
- package/models/components/getuploadfileurlresponse.d.ts +4 -0
- package/models/components/getuploadfileurlresponse.d.ts.map +1 -1
- package/models/components/getuploadfileurlresponse.js +1 -0
- package/models/components/getuploadfileurlresponse.js.map +1 -1
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/piiredactionconfig.d.ts +7 -9
- package/models/components/piiredactionconfig.d.ts.map +1 -1
- package/models/components/piiredactionconfig.js.map +1 -1
- package/models/components/previewchunk.d.ts +11 -0
- package/models/components/previewchunk.d.ts.map +1 -0
- package/models/components/previewchunk.js +56 -0
- package/models/components/previewchunk.js.map +1 -0
- package/models/components/previewchunksmetadata.d.ts +15 -0
- package/models/components/previewchunksmetadata.d.ts.map +1 -0
- package/models/components/previewchunksmetadata.js +65 -0
- package/models/components/previewchunksmetadata.js.map +1 -0
- package/models/components/reasoningpart.js +1 -1
- package/models/components/upsertchunk.d.ts +5 -0
- package/models/components/upsertchunk.d.ts.map +1 -1
- package/models/components/upsertchunk.js +6 -0
- package/models/components/upsertchunk.js.map +1 -1
- package/models/components/value.d.ts +4 -0
- package/models/components/value.d.ts.map +1 -1
- package/models/components/value.js +4 -0
- package/models/components/value.js.map +1 -1
- package/models/operations/createdataset.js +1 -1
- package/models/operations/createdatasetitem.js +5 -5
- package/models/operations/createtool.js +4 -4
- package/models/operations/getalltools.js +4 -4
- package/models/operations/getv2humanevalsets.js +2 -2
- package/models/operations/getv2humanevalsetsid.js +2 -2
- package/models/operations/index.d.ts +1 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/listdatasetdatapoints.js +5 -5
- package/models/operations/listdatasets.js +1 -1
- package/models/operations/patchv2humanevalsetsid.js +2 -2
- package/models/operations/postv2feedbackevaluation.js +4 -4
- package/models/operations/postv2humanevalsets.js +2 -2
- package/models/operations/previewdatasourcechunks.d.ts +15 -0
- package/models/operations/previewdatasourcechunks.d.ts.map +1 -0
- package/models/operations/previewdatasourcechunks.js +57 -0
- package/models/operations/previewdatasourcechunks.js.map +1 -0
- package/models/operations/retrievedatapoint.js +5 -5
- package/models/operations/retrievedataset.js +1 -1
- package/models/operations/retrievetool.js +4 -4
- package/models/operations/runagent.js +1 -1
- package/models/operations/streamrunagent.js +1 -1
- package/models/operations/updatedatapoint.js +5 -5
- package/models/operations/updatedataset.js +1 -1
- package/models/operations/updatetool.js +4 -4
- package/package.json +3 -3
- package/sdk/knowledge.d.ts +7 -0
- package/sdk/knowledge.d.ts.map +1 -1
- package/sdk/knowledge.js +10 -0
- package/sdk/knowledge.js.map +1 -1
- package/src/funcs/knowledgePreviewChunks.ts +179 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/chunkingconfiguration.ts +432 -4
- package/src/models/components/datasourcesservicepreviewchunksrequest.ts +48 -0
- package/src/models/components/datasourcesservicepreviewchunksresponse.ts +44 -0
- package/src/models/components/getuploadfileurlresponse.ts +5 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/piiredactionconfig.ts +7 -9
- package/src/models/components/previewchunk.ts +38 -0
- package/src/models/components/previewchunksmetadata.ts +51 -0
- package/src/models/components/reasoningpart.ts +1 -1
- package/src/models/components/upsertchunk.ts +11 -0
- package/src/models/components/value.ts +4 -0
- package/src/models/operations/createdataset.ts +1 -1
- package/src/models/operations/createdatasetitem.ts +5 -5
- package/src/models/operations/createtool.ts +4 -4
- package/src/models/operations/getalltools.ts +4 -4
- package/src/models/operations/getv2humanevalsets.ts +2 -2
- package/src/models/operations/getv2humanevalsetsid.ts +2 -2
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listdatasetdatapoints.ts +5 -5
- package/src/models/operations/listdatasets.ts +1 -1
- package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
- package/src/models/operations/postv2feedbackevaluation.ts +4 -4
- package/src/models/operations/postv2humanevalsets.ts +2 -2
- package/src/models/operations/previewdatasourcechunks.ts +47 -0
- package/src/models/operations/retrievedatapoint.ts +5 -5
- package/src/models/operations/retrievedataset.ts +1 -1
- package/src/models/operations/retrievetool.ts +4 -4
- package/src/models/operations/runagent.ts +1 -1
- package/src/models/operations/streamrunagent.ts +1 -1
- package/src/models/operations/updatedatapoint.ts +5 -5
- package/src/models/operations/updatedataset.ts +1 -1
- package/src/models/operations/updatetool.ts +4 -4
- package/src/sdk/knowledge.ts +18 -0
|
@@ -4,9 +4,195 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Asks a model to choose the boundaries. Slowest and most expensive, best on documents with irregular structure. Makes paid model calls.
|
|
11
|
+
*/
|
|
12
|
+
export type Nine = {
|
|
13
|
+
type: "agentic";
|
|
14
|
+
/**
|
|
15
|
+
* Maximum number of tokens per chunk.
|
|
16
|
+
*/
|
|
17
|
+
chunkSize?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Model that chooses the chunk boundaries.
|
|
20
|
+
*/
|
|
21
|
+
model?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Size of candidate splits offered to the model.
|
|
24
|
+
*/
|
|
25
|
+
candidateSize?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Minimum number of characters each chunk must contain.
|
|
28
|
+
*/
|
|
29
|
+
minCharactersPerChunk?: number | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Custom system prompt for the boundary model.
|
|
32
|
+
*/
|
|
33
|
+
systemPrompt?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Embeds the document before splitting it recursively, so each chunk is embedded with the surrounding document in context. Makes paid embedding calls.
|
|
38
|
+
*/
|
|
39
|
+
export type Eight = {
|
|
40
|
+
type: "late";
|
|
41
|
+
/**
|
|
42
|
+
* Maximum number of tokens per chunk.
|
|
43
|
+
*/
|
|
44
|
+
chunkSize?: number | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Separator hierarchy to split on, tried in order. Defaults to paragraph, line, space, then character.
|
|
47
|
+
*/
|
|
48
|
+
separators?: Array<string> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Minimum number of characters each chunk must contain.
|
|
51
|
+
*/
|
|
52
|
+
minCharactersPerChunk?: number | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Embedding model used to embed the document before it is split.
|
|
55
|
+
*/
|
|
56
|
+
embeddingModel?: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Number of dimensions for the embedding output, when the model supports it.
|
|
59
|
+
*/
|
|
60
|
+
dimensions?: number | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Comparison mode.
|
|
65
|
+
*/
|
|
66
|
+
export const ChunkingConfigurationMode = {
|
|
67
|
+
Window: "window",
|
|
68
|
+
Sentence: "sentence",
|
|
69
|
+
} as const;
|
|
70
|
+
/**
|
|
71
|
+
* Comparison mode.
|
|
72
|
+
*/
|
|
73
|
+
export type ChunkingConfigurationMode = ClosedEnum<
|
|
74
|
+
typeof ChunkingConfigurationMode
|
|
75
|
+
>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Embeds the text and breaks where meaning shifts, so related passages stay together. Makes paid embedding calls.
|
|
79
|
+
*/
|
|
80
|
+
export type Seven = {
|
|
81
|
+
type: "semantic";
|
|
82
|
+
/**
|
|
83
|
+
* Maximum number of tokens per chunk.
|
|
84
|
+
*/
|
|
85
|
+
chunkSize?: number | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Embedding model used to detect semantic boundaries.
|
|
88
|
+
*/
|
|
89
|
+
embeddingModel?: string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Number of dimensions for the embedding output, when the model supports it.
|
|
92
|
+
*/
|
|
93
|
+
dimensions?: number | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Similarity threshold from 0 through 1, or "auto".
|
|
96
|
+
*/
|
|
97
|
+
threshold?: string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Comparison mode.
|
|
100
|
+
*/
|
|
101
|
+
mode?: ChunkingConfigurationMode | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Window size for similarity comparison.
|
|
104
|
+
*/
|
|
105
|
+
similarityWindow?: number | undefined;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Splits on delimiters or a regular expression without tokenizing. Fastest option; chunk sizes vary with where delimiters fall.
|
|
110
|
+
*/
|
|
111
|
+
export type Six = {
|
|
112
|
+
type: "fast";
|
|
113
|
+
/**
|
|
114
|
+
* Target chunk size in bytes.
|
|
115
|
+
*/
|
|
116
|
+
targetSize?: number | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Single-byte characters to split on.
|
|
119
|
+
*/
|
|
120
|
+
delimiters?: string | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Multi-byte split pattern. Takes precedence over delimiters when set.
|
|
123
|
+
*/
|
|
124
|
+
pattern?: string | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Attach the delimiter to the start of the next chunk instead of the end of the previous one.
|
|
127
|
+
*/
|
|
128
|
+
prefix?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Split at the start of a run of consecutive delimiters rather than at each one.
|
|
131
|
+
*/
|
|
132
|
+
consecutive?: boolean | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Search forward for a delimiter when searching backward finds none.
|
|
135
|
+
*/
|
|
136
|
+
forwardFallback?: boolean | undefined;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Splits on a separator hierarchy, falling back through paragraph, line, sentence, and word boundaries until chunks fit. Respects document structure.
|
|
141
|
+
*/
|
|
142
|
+
export type Five = {
|
|
143
|
+
type: "recursive";
|
|
144
|
+
/**
|
|
145
|
+
* Maximum number of tokens per chunk.
|
|
146
|
+
*/
|
|
147
|
+
chunkSize?: number | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Separator hierarchy to split on, tried in order. Defaults to paragraph, line, space, then character.
|
|
150
|
+
*/
|
|
151
|
+
separators?: Array<string> | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Minimum number of characters each chunk must contain.
|
|
154
|
+
*/
|
|
155
|
+
minCharactersPerChunk?: number | undefined;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Groups whole sentences up to the chunk size, so chunks never cut a sentence in half.
|
|
160
|
+
*/
|
|
161
|
+
export type Four = {
|
|
162
|
+
type: "sentence";
|
|
163
|
+
/**
|
|
164
|
+
* Maximum number of tokens per chunk.
|
|
165
|
+
*/
|
|
166
|
+
chunkSize?: number | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Number of tokens to overlap between consecutive chunks. Helps preserve continuity across chunk boundaries.
|
|
169
|
+
*/
|
|
170
|
+
chunkOverlap?: number | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Minimum number of sentences each chunk must contain.
|
|
173
|
+
*/
|
|
174
|
+
minSentencesPerChunk?: number | undefined;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Splits text into fixed-size token windows with optional overlap. Predictable chunk sizes, no regard for sentence or paragraph boundaries.
|
|
179
|
+
*/
|
|
180
|
+
export type Three = {
|
|
181
|
+
type: "token";
|
|
182
|
+
/**
|
|
183
|
+
* Maximum number of tokens per chunk.
|
|
184
|
+
*/
|
|
185
|
+
chunkSize?: number | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Number of tokens to overlap between consecutive chunks. Helps preserve continuity across chunk boundaries.
|
|
188
|
+
*/
|
|
189
|
+
chunkOverlap?: number | undefined;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Provides advanced settings for customizing chunking behavior, enabling fine-grained control to better meet specific data processing needs. Deprecated: use one of the named chunking strategies instead.
|
|
194
|
+
*
|
|
195
|
+
* @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
10
196
|
*/
|
|
11
197
|
export type ChunkingConfiguration2 = {
|
|
12
198
|
type: "advanced";
|
|
@@ -21,7 +207,9 @@ export type ChunkingConfiguration2 = {
|
|
|
21
207
|
};
|
|
22
208
|
|
|
23
209
|
/**
|
|
24
|
-
* Optimized chunking strategy focusing on speed and avoiding duplication of content chunks.
|
|
210
|
+
* Optimized chunking strategy focusing on speed and avoiding duplication of content chunks. Deprecated: use one of the named chunking strategies instead.
|
|
211
|
+
*
|
|
212
|
+
* @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
25
213
|
*/
|
|
26
214
|
export type ChunkingConfiguration1 = {
|
|
27
215
|
type: "default";
|
|
@@ -32,7 +220,233 @@ export type ChunkingConfiguration1 = {
|
|
|
32
220
|
*/
|
|
33
221
|
export type ChunkingConfiguration =
|
|
34
222
|
| ChunkingConfiguration1
|
|
35
|
-
| ChunkingConfiguration2
|
|
223
|
+
| ChunkingConfiguration2
|
|
224
|
+
| Three
|
|
225
|
+
| Four
|
|
226
|
+
| Five
|
|
227
|
+
| Six
|
|
228
|
+
| Seven
|
|
229
|
+
| Eight
|
|
230
|
+
| Nine;
|
|
231
|
+
|
|
232
|
+
/** @internal */
|
|
233
|
+
export type Nine$Outbound = {
|
|
234
|
+
type: "agentic";
|
|
235
|
+
chunk_size: number;
|
|
236
|
+
model: string;
|
|
237
|
+
candidate_size: number;
|
|
238
|
+
min_characters_per_chunk: number;
|
|
239
|
+
system_prompt?: string | undefined;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/** @internal */
|
|
243
|
+
export const Nine$outboundSchema: z.ZodType<Nine$Outbound, z.ZodTypeDef, Nine> =
|
|
244
|
+
z.object({
|
|
245
|
+
type: z.literal("agentic"),
|
|
246
|
+
chunkSize: z.number().int().default(1024),
|
|
247
|
+
model: z.string().default("openai/gpt-4o"),
|
|
248
|
+
candidateSize: z.number().int().default(128),
|
|
249
|
+
minCharactersPerChunk: z.number().int().default(24),
|
|
250
|
+
systemPrompt: z.string().optional(),
|
|
251
|
+
}).transform((v) => {
|
|
252
|
+
return remap$(v, {
|
|
253
|
+
chunkSize: "chunk_size",
|
|
254
|
+
candidateSize: "candidate_size",
|
|
255
|
+
minCharactersPerChunk: "min_characters_per_chunk",
|
|
256
|
+
systemPrompt: "system_prompt",
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
export function nineToJSON(nine: Nine): string {
|
|
261
|
+
return JSON.stringify(Nine$outboundSchema.parse(nine));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** @internal */
|
|
265
|
+
export type Eight$Outbound = {
|
|
266
|
+
type: "late";
|
|
267
|
+
chunk_size: number;
|
|
268
|
+
separators?: Array<string> | undefined;
|
|
269
|
+
min_characters_per_chunk: number;
|
|
270
|
+
embedding_model?: string | undefined;
|
|
271
|
+
dimensions?: number | undefined;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/** @internal */
|
|
275
|
+
export const Eight$outboundSchema: z.ZodType<
|
|
276
|
+
Eight$Outbound,
|
|
277
|
+
z.ZodTypeDef,
|
|
278
|
+
Eight
|
|
279
|
+
> = z.object({
|
|
280
|
+
type: z.literal("late"),
|
|
281
|
+
chunkSize: z.number().int().default(512),
|
|
282
|
+
separators: z.array(z.string()).optional(),
|
|
283
|
+
minCharactersPerChunk: z.number().int().default(24),
|
|
284
|
+
embeddingModel: z.string().optional(),
|
|
285
|
+
dimensions: z.number().int().optional(),
|
|
286
|
+
}).transform((v) => {
|
|
287
|
+
return remap$(v, {
|
|
288
|
+
chunkSize: "chunk_size",
|
|
289
|
+
minCharactersPerChunk: "min_characters_per_chunk",
|
|
290
|
+
embeddingModel: "embedding_model",
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
export function eightToJSON(eight: Eight): string {
|
|
295
|
+
return JSON.stringify(Eight$outboundSchema.parse(eight));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** @internal */
|
|
299
|
+
export const ChunkingConfigurationMode$outboundSchema: z.ZodNativeEnum<
|
|
300
|
+
typeof ChunkingConfigurationMode
|
|
301
|
+
> = z.nativeEnum(ChunkingConfigurationMode);
|
|
302
|
+
|
|
303
|
+
/** @internal */
|
|
304
|
+
export type Seven$Outbound = {
|
|
305
|
+
type: "semantic";
|
|
306
|
+
chunk_size: number;
|
|
307
|
+
embedding_model?: string | undefined;
|
|
308
|
+
dimensions?: number | undefined;
|
|
309
|
+
threshold: string;
|
|
310
|
+
mode: string;
|
|
311
|
+
similarity_window: number;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
/** @internal */
|
|
315
|
+
export const Seven$outboundSchema: z.ZodType<
|
|
316
|
+
Seven$Outbound,
|
|
317
|
+
z.ZodTypeDef,
|
|
318
|
+
Seven
|
|
319
|
+
> = z.object({
|
|
320
|
+
type: z.literal("semantic"),
|
|
321
|
+
chunkSize: z.number().int().default(512),
|
|
322
|
+
embeddingModel: z.string().optional(),
|
|
323
|
+
dimensions: z.number().int().optional(),
|
|
324
|
+
threshold: z.string().default("auto"),
|
|
325
|
+
mode: ChunkingConfigurationMode$outboundSchema.default("window"),
|
|
326
|
+
similarityWindow: z.number().int().default(1),
|
|
327
|
+
}).transform((v) => {
|
|
328
|
+
return remap$(v, {
|
|
329
|
+
chunkSize: "chunk_size",
|
|
330
|
+
embeddingModel: "embedding_model",
|
|
331
|
+
similarityWindow: "similarity_window",
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
export function sevenToJSON(seven: Seven): string {
|
|
336
|
+
return JSON.stringify(Seven$outboundSchema.parse(seven));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** @internal */
|
|
340
|
+
export type Six$Outbound = {
|
|
341
|
+
type: "fast";
|
|
342
|
+
target_size: number;
|
|
343
|
+
delimiters: string;
|
|
344
|
+
pattern?: string | undefined;
|
|
345
|
+
prefix: boolean;
|
|
346
|
+
consecutive: boolean;
|
|
347
|
+
forward_fallback: boolean;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
/** @internal */
|
|
351
|
+
export const Six$outboundSchema: z.ZodType<Six$Outbound, z.ZodTypeDef, Six> = z
|
|
352
|
+
.object({
|
|
353
|
+
type: z.literal("fast"),
|
|
354
|
+
targetSize: z.number().int().default(4096),
|
|
355
|
+
delimiters: z.string().default("\n.?"),
|
|
356
|
+
pattern: z.string().optional(),
|
|
357
|
+
prefix: z.boolean().default(false),
|
|
358
|
+
consecutive: z.boolean().default(false),
|
|
359
|
+
forwardFallback: z.boolean().default(false),
|
|
360
|
+
}).transform((v) => {
|
|
361
|
+
return remap$(v, {
|
|
362
|
+
targetSize: "target_size",
|
|
363
|
+
forwardFallback: "forward_fallback",
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
export function sixToJSON(six: Six): string {
|
|
368
|
+
return JSON.stringify(Six$outboundSchema.parse(six));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** @internal */
|
|
372
|
+
export type Five$Outbound = {
|
|
373
|
+
type: "recursive";
|
|
374
|
+
chunk_size: number;
|
|
375
|
+
separators?: Array<string> | undefined;
|
|
376
|
+
min_characters_per_chunk: number;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
/** @internal */
|
|
380
|
+
export const Five$outboundSchema: z.ZodType<Five$Outbound, z.ZodTypeDef, Five> =
|
|
381
|
+
z.object({
|
|
382
|
+
type: z.literal("recursive"),
|
|
383
|
+
chunkSize: z.number().int().default(512),
|
|
384
|
+
separators: z.array(z.string()).optional(),
|
|
385
|
+
minCharactersPerChunk: z.number().int().default(24),
|
|
386
|
+
}).transform((v) => {
|
|
387
|
+
return remap$(v, {
|
|
388
|
+
chunkSize: "chunk_size",
|
|
389
|
+
minCharactersPerChunk: "min_characters_per_chunk",
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
export function fiveToJSON(five: Five): string {
|
|
394
|
+
return JSON.stringify(Five$outboundSchema.parse(five));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** @internal */
|
|
398
|
+
export type Four$Outbound = {
|
|
399
|
+
type: "sentence";
|
|
400
|
+
chunk_size: number;
|
|
401
|
+
chunk_overlap: number;
|
|
402
|
+
min_sentences_per_chunk: number;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
/** @internal */
|
|
406
|
+
export const Four$outboundSchema: z.ZodType<Four$Outbound, z.ZodTypeDef, Four> =
|
|
407
|
+
z.object({
|
|
408
|
+
type: z.literal("sentence"),
|
|
409
|
+
chunkSize: z.number().int().default(512),
|
|
410
|
+
chunkOverlap: z.number().int().default(0),
|
|
411
|
+
minSentencesPerChunk: z.number().int().default(1),
|
|
412
|
+
}).transform((v) => {
|
|
413
|
+
return remap$(v, {
|
|
414
|
+
chunkSize: "chunk_size",
|
|
415
|
+
chunkOverlap: "chunk_overlap",
|
|
416
|
+
minSentencesPerChunk: "min_sentences_per_chunk",
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
export function fourToJSON(four: Four): string {
|
|
421
|
+
return JSON.stringify(Four$outboundSchema.parse(four));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** @internal */
|
|
425
|
+
export type Three$Outbound = {
|
|
426
|
+
type: "token";
|
|
427
|
+
chunk_size: number;
|
|
428
|
+
chunk_overlap: number;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
/** @internal */
|
|
432
|
+
export const Three$outboundSchema: z.ZodType<
|
|
433
|
+
Three$Outbound,
|
|
434
|
+
z.ZodTypeDef,
|
|
435
|
+
Three
|
|
436
|
+
> = z.object({
|
|
437
|
+
type: z.literal("token"),
|
|
438
|
+
chunkSize: z.number().int().default(512),
|
|
439
|
+
chunkOverlap: z.number().int().default(0),
|
|
440
|
+
}).transform((v) => {
|
|
441
|
+
return remap$(v, {
|
|
442
|
+
chunkSize: "chunk_size",
|
|
443
|
+
chunkOverlap: "chunk_overlap",
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
export function threeToJSON(three: Three): string {
|
|
448
|
+
return JSON.stringify(Three$outboundSchema.parse(three));
|
|
449
|
+
}
|
|
36
450
|
|
|
37
451
|
/** @internal */
|
|
38
452
|
export type ChunkingConfiguration2$Outbound = {
|
|
@@ -90,7 +504,14 @@ export function chunkingConfiguration1ToJSON(
|
|
|
90
504
|
/** @internal */
|
|
91
505
|
export type ChunkingConfiguration$Outbound =
|
|
92
506
|
| ChunkingConfiguration1$Outbound
|
|
93
|
-
| ChunkingConfiguration2$Outbound
|
|
507
|
+
| ChunkingConfiguration2$Outbound
|
|
508
|
+
| Three$Outbound
|
|
509
|
+
| Four$Outbound
|
|
510
|
+
| Five$Outbound
|
|
511
|
+
| Six$Outbound
|
|
512
|
+
| Seven$Outbound
|
|
513
|
+
| Eight$Outbound
|
|
514
|
+
| Nine$Outbound;
|
|
94
515
|
|
|
95
516
|
/** @internal */
|
|
96
517
|
export const ChunkingConfiguration$outboundSchema: z.ZodType<
|
|
@@ -100,6 +521,13 @@ export const ChunkingConfiguration$outboundSchema: z.ZodType<
|
|
|
100
521
|
> = z.union([
|
|
101
522
|
z.lazy(() => ChunkingConfiguration1$outboundSchema),
|
|
102
523
|
z.lazy(() => ChunkingConfiguration2$outboundSchema),
|
|
524
|
+
z.lazy(() => Three$outboundSchema),
|
|
525
|
+
z.lazy(() => Four$outboundSchema),
|
|
526
|
+
z.lazy(() => Five$outboundSchema),
|
|
527
|
+
z.lazy(() => Six$outboundSchema),
|
|
528
|
+
z.lazy(() => Seven$outboundSchema),
|
|
529
|
+
z.lazy(() => Eight$outboundSchema),
|
|
530
|
+
z.lazy(() => Nine$outboundSchema),
|
|
103
531
|
]);
|
|
104
532
|
|
|
105
533
|
export function chunkingConfigurationToJSON(
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import {
|
|
8
|
+
DatasourceChunkingOptions,
|
|
9
|
+
DatasourceChunkingOptions$Outbound,
|
|
10
|
+
DatasourceChunkingOptions$outboundSchema,
|
|
11
|
+
} from "./datasourcechunkingoptions.js";
|
|
12
|
+
|
|
13
|
+
export type DatasourcesServicePreviewChunksRequest = {
|
|
14
|
+
fileId: string;
|
|
15
|
+
chunkingOptions?: DatasourceChunkingOptions | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export type DatasourcesServicePreviewChunksRequest$Outbound = {
|
|
20
|
+
file_id: string;
|
|
21
|
+
chunking_options?: DatasourceChunkingOptions$Outbound | undefined;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const DatasourcesServicePreviewChunksRequest$outboundSchema: z.ZodType<
|
|
26
|
+
DatasourcesServicePreviewChunksRequest$Outbound,
|
|
27
|
+
z.ZodTypeDef,
|
|
28
|
+
DatasourcesServicePreviewChunksRequest
|
|
29
|
+
> = z.object({
|
|
30
|
+
fileId: z.string(),
|
|
31
|
+
chunkingOptions: DatasourceChunkingOptions$outboundSchema.optional(),
|
|
32
|
+
}).transform((v) => {
|
|
33
|
+
return remap$(v, {
|
|
34
|
+
fileId: "file_id",
|
|
35
|
+
chunkingOptions: "chunking_options",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export function datasourcesServicePreviewChunksRequestToJSON(
|
|
40
|
+
datasourcesServicePreviewChunksRequest:
|
|
41
|
+
DatasourcesServicePreviewChunksRequest,
|
|
42
|
+
): string {
|
|
43
|
+
return JSON.stringify(
|
|
44
|
+
DatasourcesServicePreviewChunksRequest$outboundSchema.parse(
|
|
45
|
+
datasourcesServicePreviewChunksRequest,
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import { PreviewChunk, PreviewChunk$inboundSchema } from "./previewchunk.js";
|
|
10
|
+
import {
|
|
11
|
+
PreviewChunksMetadata,
|
|
12
|
+
PreviewChunksMetadata$inboundSchema,
|
|
13
|
+
} from "./previewchunksmetadata.js";
|
|
14
|
+
|
|
15
|
+
export type DatasourcesServicePreviewChunksResponse = {
|
|
16
|
+
chunks: Array<PreviewChunk>;
|
|
17
|
+
metadata: PreviewChunksMetadata;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const DatasourcesServicePreviewChunksResponse$inboundSchema: z.ZodType<
|
|
22
|
+
DatasourcesServicePreviewChunksResponse,
|
|
23
|
+
z.ZodTypeDef,
|
|
24
|
+
unknown
|
|
25
|
+
> = z.object({
|
|
26
|
+
chunks: z.array(PreviewChunk$inboundSchema),
|
|
27
|
+
metadata: PreviewChunksMetadata$inboundSchema,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function datasourcesServicePreviewChunksResponseFromJSON(
|
|
31
|
+
jsonString: string,
|
|
32
|
+
): SafeParseResult<
|
|
33
|
+
DatasourcesServicePreviewChunksResponse,
|
|
34
|
+
SDKValidationError
|
|
35
|
+
> {
|
|
36
|
+
return safeParse(
|
|
37
|
+
jsonString,
|
|
38
|
+
(x) =>
|
|
39
|
+
DatasourcesServicePreviewChunksResponse$inboundSchema.parse(
|
|
40
|
+
JSON.parse(x),
|
|
41
|
+
),
|
|
42
|
+
`Failed to parse 'DatasourcesServicePreviewChunksResponse' from JSON`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
export type GetUploadFileUrlResponse = {
|
|
15
15
|
objectName: string;
|
|
16
16
|
postPolicy: UploadPostPolicy;
|
|
17
|
+
/**
|
|
18
|
+
* Identifier of the file record registered for this upload
|
|
19
|
+
*/
|
|
20
|
+
fileId: string;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
/** @internal */
|
|
@@ -24,6 +28,7 @@ export const GetUploadFileUrlResponse$inboundSchema: z.ZodType<
|
|
|
24
28
|
> = z.object({
|
|
25
29
|
objectName: z.string(),
|
|
26
30
|
postPolicy: UploadPostPolicy$inboundSchema,
|
|
31
|
+
fileId: z.string(),
|
|
27
32
|
});
|
|
28
33
|
|
|
29
34
|
export function getUploadFileUrlResponseFromJSON(
|
|
@@ -140,6 +140,8 @@ export * from "./datasourcechunkingoptions.js";
|
|
|
140
140
|
export * from "./datasourcesservicecreaterequest.js";
|
|
141
141
|
export * from "./datasourcesservicegetprocessingstatusresponse.js";
|
|
142
142
|
export * from "./datasourcesservicelistresponse.js";
|
|
143
|
+
export * from "./datasourcesservicepreviewchunksrequest.js";
|
|
144
|
+
export * from "./datasourcesservicepreviewchunksresponse.js";
|
|
143
145
|
export * from "./datasourcesserviceupdaterequest.js";
|
|
144
146
|
export * from "./deletealertresponse.js";
|
|
145
147
|
export * from "./deleteannotationqueueresponse.js";
|
|
@@ -373,6 +375,8 @@ export * from "./piiredactionpluginen.js";
|
|
|
373
375
|
export * from "./piiredactionpluginnl.js";
|
|
374
376
|
export * from "./policy.js";
|
|
375
377
|
export * from "./policyretryconfig.js";
|
|
378
|
+
export * from "./previewchunk.js";
|
|
379
|
+
export * from "./previewchunksmetadata.js";
|
|
376
380
|
export * from "./price.js";
|
|
377
381
|
export * from "./pricing.js";
|
|
378
382
|
export * from "./pricingvariant.js";
|
|
@@ -9,18 +9,16 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* PiiRedactionConfig mirrors the workspace-default PII redaction plugin
|
|
12
|
+
* PiiRedactionConfig mirrors the workspace-default PII redaction plugin
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* own defaults for unset fields.
|
|
15
|
+
* configuration. Every field is optional; the gateway applies its own
|
|
16
|
+
* defaults for unset fields.
|
|
18
17
|
*
|
|
19
|
-
* The stored value is validated on write
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* validated there.
|
|
18
|
+
* The stored value is validated on write using the same rules the gateway
|
|
19
|
+
* applies to live requests. Without that, an invalid workspace default
|
|
20
|
+
* would 400 every gateway call for the workspace, since the default plugin
|
|
21
|
+
* is injected into each request and validated there.
|
|
24
22
|
*/
|
|
25
23
|
export type PiiRedactionConfig = {
|
|
26
24
|
/**
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type PreviewChunk = {
|
|
12
|
+
text: string;
|
|
13
|
+
pageNumber?: number | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const PreviewChunk$inboundSchema: z.ZodType<
|
|
18
|
+
PreviewChunk,
|
|
19
|
+
z.ZodTypeDef,
|
|
20
|
+
unknown
|
|
21
|
+
> = z.object({
|
|
22
|
+
text: z.string(),
|
|
23
|
+
page_number: z.number().int().optional(),
|
|
24
|
+
}).transform((v) => {
|
|
25
|
+
return remap$(v, {
|
|
26
|
+
"page_number": "pageNumber",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function previewChunkFromJSON(
|
|
31
|
+
jsonString: string,
|
|
32
|
+
): SafeParseResult<PreviewChunk, SDKValidationError> {
|
|
33
|
+
return safeParse(
|
|
34
|
+
jsonString,
|
|
35
|
+
(x) => PreviewChunk$inboundSchema.parse(JSON.parse(x)),
|
|
36
|
+
`Failed to parse 'PreviewChunk' from JSON`,
|
|
37
|
+
);
|
|
38
|
+
}
|