@databricks/sdk-vectorsearch 0.1.0-dev.4 → 0.1.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/v1/model.ts DELETED
@@ -1,1482 +0,0 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
-
3
- import type {Temporal} from '@js-temporal/polyfill';
4
- import type {JsonValue} from '@databricks/sdk-core/wkt';
5
- import {z} from 'zod';
6
-
7
- const jsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>
8
- z.union([
9
- z.null(),
10
- z.number(),
11
- z.string(),
12
- z.boolean(),
13
- z.record(z.string(), jsonValueSchema),
14
- z.array(jsonValueSchema),
15
- ])
16
- );
17
-
18
- /** Type of endpoint. */
19
- export enum EndpointType {
20
- STORAGE_OPTIMIZED = 'STORAGE_OPTIMIZED',
21
- STANDARD = 'STANDARD',
22
- }
23
-
24
- /**
25
- * The subtype of the AI Search index, determining the indexing and retrieval strategy.
26
- * - `VECTOR`: Not supported. Use `HYBRID` instead.
27
- * - `FULL_TEXT`: An index that uses full-text search without vector embeddings.
28
- * - `HYBRID`: An index that uses vector embeddings for similarity search and hybrid search.
29
- */
30
- export enum IndexSubtype {
31
- VECTOR = 'VECTOR',
32
- FULL_TEXT = 'FULL_TEXT',
33
- HYBRID = 'HYBRID',
34
- }
35
-
36
- /**
37
- * Pipeline execution mode.
38
- * - `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing after successfully refreshing the source table in the pipeline once, ensuring the table is updated based on the data available when the update started.
39
- * - `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline processes new data as it arrives in the source table to keep vector index fresh.
40
- */
41
- export enum PipelineType {
42
- TRIGGERED = 'TRIGGERED',
43
- CONTINUOUS = 'CONTINUOUS',
44
- }
45
-
46
- export enum ScalingChangeState {
47
- SCALING_CHANGE_UNSPECIFIED = 'SCALING_CHANGE_UNSPECIFIED',
48
- SCALING_CHANGE_APPLIED = 'SCALING_CHANGE_APPLIED',
49
- SCALING_CHANGE_IN_PROGRESS = 'SCALING_CHANGE_IN_PROGRESS',
50
- }
51
-
52
- export enum UpsertDeleteDataStatus {
53
- SUCCESS = 'SUCCESS',
54
- PARTIAL_SUCCESS = 'PARTIAL_SUCCESS',
55
- FAILURE = 'FAILURE',
56
- }
57
-
58
- /**
59
- * There are 2 types of AI Search indexes:
60
- * - `DELTA_SYNC`: An index that automatically syncs with a source Delta Table, automatically and incrementally updating the index as the underlying data in the Delta Table changes.
61
- * - `DIRECT_ACCESS`: An index that supports direct read and write of vectors and metadata through our REST and SDK APIs. With this model, the user manages index updates.
62
- */
63
- export enum VectorIndexType {
64
- DELTA_SYNC = 'DELTA_SYNC',
65
- DIRECT_ACCESS = 'DIRECT_ACCESS',
66
- }
67
-
68
- /** Current state of the endpoint */
69
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name.
70
- export enum EndpointStatus_State {
71
- PROVISIONING = 'PROVISIONING',
72
- ONLINE = 'ONLINE',
73
- OFFLINE = 'OFFLINE',
74
- /**
75
- * After the endpoint is ready, it can be in one of the following states:
76
- * - RED_STATE: The endpoint is unhealthy and needs to be investigated.
77
- * - YELLOW_STATE: The endpoint is healthy but needs to be monitored.
78
- * - ONLINE: The endpoint is healthy and ready to serve traffic.
79
- */
80
- RED_STATE = 'RED_STATE',
81
- YELLOW_STATE = 'YELLOW_STATE',
82
- /**
83
- * The endpoint is being deleted or has been deleted. Associated resources
84
- * are being cleaned up; once cleanup completes the endpoint will no longer
85
- * be retrievable.
86
- */
87
- DELETED = 'DELETED',
88
- }
89
-
90
- export interface ColumnInfo {
91
- /** Name of the column. */
92
- name?: string | undefined;
93
- /** Data type of the column (e.g., "string", "int", "array<float>") */
94
- typeText?: string | undefined;
95
- }
96
-
97
- export interface CreateEndpointRequest {
98
- /** Name of the AI Search endpoint */
99
- name?: string | undefined;
100
- /** Type of endpoint */
101
- endpointType?: EndpointType | undefined;
102
- /** The budget policy id to be applied */
103
- budgetPolicyId?: string | undefined;
104
- /** The usage policy id to be applied once we've migrated to usage policies */
105
- usagePolicyId?: string | undefined;
106
- /**
107
- * Target QPS for the endpoint. Mutually exclusive with num_replicas.
108
- * The actual replica count is calculated at index creation/sync time based on this value.
109
- * Best-effort target; the system does not guarantee this QPS will be achieved.
110
- */
111
- targetQps?: bigint | undefined;
112
- }
113
-
114
- export interface CreateVectorIndexRequest {
115
- /** Name of the index */
116
- name?: string | undefined;
117
- /** Name of the endpoint to be used for serving the index */
118
- endpointName?: string | undefined;
119
- /** Primary key of the index */
120
- primaryKey?: string | undefined;
121
- indexType?: VectorIndexType | undefined;
122
- indexSpec?:
123
- | {
124
- $case: 'directAccessIndexSpec';
125
- /** Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`. */
126
- directAccessIndexSpec: DirectAccessVectorIndexSpec;
127
- }
128
- | {
129
- $case: 'deltaSyncIndexSpec';
130
- /** Specification for Delta Sync Index. Required if `index_type` is `DELTA_SYNC`. */
131
- deltaSyncIndexSpec: DeltaSyncVectorIndexSpecRequest;
132
- }
133
- | undefined;
134
- /** The subtype of the index. Use `HYBRID` or `FULL_TEXT`. `VECTOR` is not supported. */
135
- indexSubtype?: IndexSubtype | undefined;
136
- }
137
-
138
- export interface CustomTag {
139
- /** Key field for an AI Search endpoint tag. */
140
- key?: string | undefined;
141
- /** [Optional] Value field for an AI Search endpoint tag. */
142
- value?: string | undefined;
143
- }
144
-
145
- /** Request payload for deleting data from a vector index. */
146
- export interface DeleteDataVectorIndexRequest {
147
- /** Name of the vector index where data is to be deleted. Must be a Direct Vector Access Index. */
148
- name?: string | undefined;
149
- /** List of primary keys for the data to be deleted. */
150
- primaryKeys?: string[] | undefined;
151
- }
152
-
153
- export interface DeleteDataVectorIndexResponse {
154
- /** Status of the delete operation. */
155
- status?: UpsertDeleteDataStatus | undefined;
156
- /** Result of the upsert or delete operation. */
157
- result?: UpsertDeleteDataResult | undefined;
158
- }
159
-
160
- export interface DeleteEndpointRequest {
161
- /** Name of the AI Search endpoint */
162
- name?: string | undefined;
163
- }
164
-
165
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
166
- export interface DeleteEndpointResponse {}
167
-
168
- export interface DeleteVectorIndexRequest {
169
- /** Name of the index */
170
- name?: string | undefined;
171
- }
172
-
173
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
174
- export interface DeleteVectorIndexResponse {}
175
-
176
- export interface DeltaSyncVectorIndexSpec {
177
- /** The name of the source table. */
178
- sourceTable?: string | undefined;
179
- /** The columns that contain the embedding source. */
180
- embeddingSourceColumns?: EmbeddingSourceColumn[] | undefined;
181
- /** The columns that contain the embedding vectors. */
182
- embeddingVectorColumns?: EmbeddingVectorColumn[] | undefined;
183
- /**
184
- * Pipeline execution mode.
185
- * - `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing after successfully refreshing the source table in the pipeline once, ensuring the table is updated based on the data available when the update started.
186
- * - `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline processes new data as it arrives in the source table to keep vector index fresh.
187
- */
188
- pipelineType?: PipelineType | undefined;
189
- /** The ID of the pipeline that is used to sync the index. */
190
- pipelineId?: string | undefined;
191
- /** [Optional] Name of the Delta table to sync the vector index contents and computed embeddings to. */
192
- embeddingWritebackTable?: string | undefined;
193
- /**
194
- * [Optional] Select the columns to sync with the vector index. If you leave this field blank, all columns
195
- * from the source table are synced with the index. The primary key column and embedding source column or
196
- * embedding vector column are always synced.
197
- */
198
- columnsToSync?: string[] | undefined;
199
- /**
200
- * [Optional] Alias for columns_to_sync. Select the columns to include in the vector index.
201
- * If you leave this field blank, all columns from the source table are included.
202
- * The primary key column and embedding source column or embedding vector column are always included.
203
- * Only one of columns_to_sync or columns_to_index may be specified.
204
- */
205
- columnsToIndex?: string[] | undefined;
206
- }
207
-
208
- export interface DeltaSyncVectorIndexSpecRequest {
209
- /** The name of the source table. */
210
- sourceTable?: string | undefined;
211
- /** The columns that contain the embedding source. */
212
- embeddingSourceColumns?: EmbeddingSourceColumn[] | undefined;
213
- /** The columns that contain the embedding vectors. */
214
- embeddingVectorColumns?: EmbeddingVectorColumn[] | undefined;
215
- /**
216
- * Pipeline execution mode.
217
- * - `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing after successfully refreshing the source table in the pipeline once, ensuring the table is updated based on the data available when the update started.
218
- * - `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline processes new data as it arrives in the source table to keep vector index fresh.
219
- */
220
- pipelineType?: PipelineType | undefined;
221
- /** The ID of the pipeline that is used to sync the index. */
222
- pipelineId?: string | undefined;
223
- /** [Optional] Name of the Delta table to sync the vector index contents and computed embeddings to. */
224
- embeddingWritebackTable?: string | undefined;
225
- /**
226
- * [Optional] Select the columns to sync with the vector index. If you leave this field blank, all columns
227
- * from the source table are synced with the index. The primary key column and embedding source column or
228
- * embedding vector column are always synced.
229
- */
230
- columnsToSync?: string[] | undefined;
231
- /**
232
- * [Optional] Alias for columns_to_sync. Select the columns to include in the vector index.
233
- * If you leave this field blank, all columns from the source table are included.
234
- * The primary key column and embedding source column or embedding vector column are always included.
235
- * Only one of columns_to_sync or columns_to_index may be specified.
236
- */
237
- columnsToIndex?: string[] | undefined;
238
- }
239
-
240
- export interface DirectAccessVectorIndexSpec {
241
- /** The columns that contain the embedding vectors. The format should be array[double]. */
242
- embeddingVectorColumns?: EmbeddingVectorColumn[] | undefined;
243
- /**
244
- * The schema of the index in JSON format.
245
- * Supported types are `integer`, `long`, `float`, `double`, `boolean`, `string`, `date`, `timestamp`.
246
- * Supported types for vector column: `array<float>`, `array<double>`,`.
247
- */
248
- schemaJson?: string | undefined;
249
- /** The columns that contain the embedding source. The format should be array[double]. */
250
- embeddingSourceColumns?: EmbeddingSourceColumn[] | undefined;
251
- }
252
-
253
- export interface EmbeddingSourceColumn {
254
- /** Name of the column */
255
- name?: string | undefined;
256
- /** TODO: clean up ai gateway related code. It's deprecated on ModelServing side. */
257
- embeddingConfig?:
258
- | {
259
- $case: 'embeddingModelEndpointName';
260
- /** Name of the embedding model endpoint, used by default for both ingestion and querying. */
261
- embeddingModelEndpointName: string;
262
- }
263
- | undefined;
264
- /** Name of the embedding model endpoint which, if specified, is used for querying (not ingestion). */
265
- modelEndpointNameForQuery?: string | undefined;
266
- }
267
-
268
- export interface EmbeddingVectorColumn {
269
- /** Name of the column */
270
- name?: string | undefined;
271
- /** Dimension of the embedding vector */
272
- embeddingDimension?: number | undefined;
273
- }
274
-
275
- export interface Endpoint {
276
- /** Name of the AI Search endpoint */
277
- name?: string | undefined;
278
- /** Creator of the endpoint */
279
- creator?: string | undefined;
280
- /** Timestamp of endpoint creation */
281
- creationTimestamp?: bigint | undefined;
282
- /** Timestamp of last update to the endpoint */
283
- lastUpdatedTimestamp?: bigint | undefined;
284
- /** Type of endpoint */
285
- endpointType?: EndpointType | undefined;
286
- /** User who last updated the endpoint */
287
- lastUpdatedUser?: string | undefined;
288
- /** Unique identifier of the endpoint */
289
- id?: string | undefined;
290
- /** Current status of the endpoint */
291
- endpointStatus?: EndpointStatus | undefined;
292
- /** Number of indexes on the endpoint */
293
- numIndexes?: number | undefined;
294
- /** The user-selected budget policy id for the endpoint. */
295
- budgetPolicyId?: string | undefined;
296
- /** The budget policy id applied to the endpoint */
297
- effectiveBudgetPolicyId?: string | undefined;
298
- /** The custom tags assigned to the endpoint */
299
- customTags?: CustomTag[] | undefined;
300
- /** Scaling information for the endpoint */
301
- scalingInfo?: EndpointScalingInfo | undefined;
302
- }
303
-
304
- export interface EndpointScalingInfo {
305
- /** The current state of the scaling change request. */
306
- state?: ScalingChangeState | undefined;
307
- /**
308
- * The requested QPS target for the endpoint. Best-effort; the system does not
309
- * guarantee this QPS will be achieved.
310
- */
311
- requestedTargetQps?: bigint | undefined;
312
- }
313
-
314
- /** Status information of an endpoint */
315
- export interface EndpointStatus {
316
- /** Current state of the endpoint */
317
- state?: EndpointStatus_State | undefined;
318
- /** Additional status message */
319
- message?: string | undefined;
320
- }
321
-
322
- export interface GetEndpointRequest {
323
- /** Name of the endpoint */
324
- name?: string | undefined;
325
- }
326
-
327
- export interface GetVectorIndexRequest {
328
- /** Name of the index */
329
- name?: string | undefined;
330
- /**
331
- * If true, the URL returned for the index is guaranteed to be compatible with the reranker.
332
- * Currently this means we return the CP URL regardless of how the index is being accessed.
333
- * If not set or set to false, the URL may still be compatible with the reranker depending on
334
- * what URL we return.
335
- */
336
- ensureRerankerCompatible?: boolean | undefined;
337
- }
338
-
339
- export interface ListEndpointRequest {
340
- /** Token for pagination */
341
- pageToken?: string | undefined;
342
- }
343
-
344
- export interface ListEndpointResponse {
345
- /** An array of Endpoint objects */
346
- endpoints?: Endpoint[] | undefined;
347
- /** A token that can be used to get the next page of results. If not present, there are no more results to show. */
348
- nextPageToken?: string | undefined;
349
- }
350
-
351
- export interface ListValue {
352
- /** Repeated field of dynamically typed values. */
353
- values?: Value[] | undefined;
354
- }
355
-
356
- export interface ListVectorIndexRequest {
357
- /** Name of the endpoint */
358
- endpointName?: string | undefined;
359
- /** Token for pagination */
360
- pageToken?: string | undefined;
361
- }
362
-
363
- export interface ListVectorIndexResponse {
364
- vectorIndexes?: MiniVectorIndex[] | undefined;
365
- /** A token that can be used to get the next page of results. If not present, there are no more results to show. */
366
- nextPageToken?: string | undefined;
367
- }
368
-
369
- /** Key-value pair. */
370
- export interface MapStringValueEntry {
371
- /** Column name. */
372
- key?: string | undefined;
373
- /** Column value, nullable. */
374
- value?: Value | undefined;
375
- }
376
-
377
- /** Metric specification */
378
- export interface Metric {
379
- /** Metric name */
380
- name?: string | undefined;
381
- /** Metric labels */
382
- labels?: MetricLabel[] | undefined;
383
- /** Percentile for the metric */
384
- percentile?: number | undefined;
385
- }
386
-
387
- /** Label for a metric */
388
- export interface MetricLabel {
389
- /** Label name */
390
- name?: string | undefined;
391
- /** Label value */
392
- value?: string | undefined;
393
- }
394
-
395
- /** Single metric value at a specific timestamp */
396
- export interface MetricValue {
397
- /** Timestamp of the metric value (milliseconds since epoch) */
398
- timestamp?: bigint | undefined;
399
- /** Metric value */
400
- value?: number | undefined;
401
- }
402
-
403
- /** Collection of metric values for a specific metric */
404
- export interface MetricValues {
405
- /** Metric specification */
406
- metric?: Metric | undefined;
407
- /** Time series of metric values */
408
- values?: MetricValue[] | undefined;
409
- }
410
-
411
- export interface MiniVectorIndex {
412
- /** Name of the index */
413
- name?: string | undefined;
414
- /** Name of the endpoint associated with the index */
415
- endpointName?: string | undefined;
416
- /** Primary key of the index */
417
- primaryKey?: string | undefined;
418
- indexType?: VectorIndexType | undefined;
419
- indexSpec?:
420
- | {
421
- $case: 'directAccessIndexSpec';
422
- directAccessIndexSpec: DirectAccessVectorIndexSpec;
423
- }
424
- | {
425
- $case: 'deltaSyncIndexSpec';
426
- deltaSyncIndexSpec: DeltaSyncVectorIndexSpec;
427
- }
428
- | undefined;
429
- status?: VectorIndexStatus | undefined;
430
- /** The user who created the index. */
431
- creator?: string | undefined;
432
- /** The subtype of the index. */
433
- indexSubtype?: IndexSubtype | undefined;
434
- }
435
-
436
- export interface PatchEndpointBudgetPolicyRequest {
437
- /** Name of the AI Search endpoint */
438
- name?: string | undefined;
439
- /** The budget policy id to be applied */
440
- budgetPolicyId?: string | undefined;
441
- }
442
-
443
- export interface PatchEndpointBudgetPolicyResponse {
444
- budgetPolicyId?: string | undefined;
445
- /** The budget policy applied to the AI Search endpoint. */
446
- effectiveBudgetPolicyId?: string | undefined;
447
- }
448
-
449
- export interface PatchEndpointRequest {
450
- /** Name of the AI Search endpoint */
451
- name?: string | undefined;
452
- /**
453
- * Target QPS for the endpoint. Best-effort; the system does not guarantee this QPS
454
- * will be achieved.
455
- */
456
- targetQps?: bigint | undefined;
457
- }
458
-
459
- /** Request payload for getting next page of results. */
460
- export interface QueryVectorIndexNextPageRequest {
461
- /** Name of the vector index to query. */
462
- name?: string | undefined;
463
- /** Name of the endpoint. */
464
- endpointName?: string | undefined;
465
- /** Page token returned from previous `QueryVectorIndex` or `QueryVectorIndexNextPage` API. */
466
- pageToken?: string | undefined;
467
- }
468
-
469
- export interface QueryVectorIndexRequest {
470
- /** Name of the vector index to query. */
471
- name?: string | undefined;
472
- /** Number of results to return. Defaults to 10. */
473
- numResults?: number | undefined;
474
- /** List of column names to include in the response. */
475
- columns?: string[] | undefined;
476
- /**
477
- * JSON string representing query filters.
478
- *
479
- * Example filters:
480
- *
481
- * - `{"id <": 5}`: Filter for id less than 5.
482
- * - `{"id >": 5}`: Filter for id greater than 5.
483
- * - `{"id <=": 5}`: Filter for id less than equal to 5.
484
- * - `{"id >=": 5}`: Filter for id greater than equal to 5.
485
- * - `{"id": 5}`: Filter for id equal to 5.
486
- */
487
- filtersJson?: string | undefined;
488
- /** Query vector. Required for Direct Vector Access Index and Delta Sync Index using self-managed vectors. */
489
- queryVector?: number[] | undefined;
490
- /** Query text. Required for Delta Sync Index using model endpoint. */
491
- queryText?: string | undefined;
492
- /** Threshold for the approximate nearest neighbor search. Defaults to 0.0. */
493
- scoreThreshold?: number | undefined;
494
- /** The query type to use. Choices are `ANN` and `HYBRID` and `FULL_TEXT`. Defaults to `ANN`. */
495
- queryType?: string | undefined;
496
- /** Column names used to retrieve data to send to the reranker. */
497
- columnsToRerank?: string[] | undefined;
498
- /**
499
- * If set, the top 50 results are reranked with the Databricks Reranker model before returning the `num_results` results to the user.
500
- * The setting `columns_to_rerank` selects which columns are used for reranking. For each datapoint, the columns selected are concatenated before
501
- * being sent to the reranking model. See https://docs.databricks.com/aws/en/vector-search/query-vector-search#rerank for more information.
502
- */
503
- reranker?: RerankerConfig | undefined;
504
- }
505
-
506
- export interface QueryVectorIndexResponse {
507
- /** Metadata about the result set. */
508
- manifest?: ResultManifest | undefined;
509
- /** Data returned in the query result. */
510
- result?: ResultData | undefined;
511
- /**
512
- * [Optional] Token that can be used in `QueryVectorIndexNextPage` API to get next page of results.
513
- * If more than 1000 results satisfy the query, they are returned in groups of 1000.
514
- * Empty value means no more results. The maximum number of results that can be returned is 10,000.
515
- */
516
- nextPageToken?: string | undefined;
517
- }
518
-
519
- export interface RerankerConfig {
520
- /**
521
- * Reranker identifier:
522
- * - When model_type=BASE/UNSPECIFIED: must be "databricks_reranker".
523
- * - When model_type=FINETUNED: the Model Serving endpoint name hosting a finetuned reranker.
524
- */
525
- model?: string | undefined;
526
- /** Parameters that control how the reranker processes the query results. */
527
- parameters?: RerankerConfig_RerankerParameters | undefined;
528
- }
529
-
530
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
531
- export interface RerankerConfig_RerankerParameters {
532
- columnsToRerank?: string[] | undefined;
533
- }
534
-
535
- /** Data returned in the query result. */
536
- export interface ResultData {
537
- /** Number of rows in the result set. */
538
- rowCount?: number | undefined;
539
- /** Data rows returned in the query. */
540
- dataArray?: JsonValue[][] | undefined;
541
- }
542
-
543
- /** Metadata about the result set. */
544
- export interface ResultManifest {
545
- /** Number of columns in the result set. */
546
- columnCount?: number | undefined;
547
- /** Information about each column in the result set. */
548
- columns?: ColumnInfo[] | undefined;
549
- }
550
-
551
- /** Request to retrieve user-visible metrics */
552
- export interface RetrieveUserVisibleMetricsRequest {
553
- /** AI Search endpoint name */
554
- name?: string | undefined;
555
- /** Start time for metrics query */
556
- startTime?: Temporal.Instant | undefined;
557
- /** End time for metrics query */
558
- endTime?: Temporal.Instant | undefined;
559
- /** Granularity in seconds */
560
- granularityInSeconds?: number | undefined;
561
- /** List of metrics to retrieve */
562
- metrics?: Metric[] | undefined;
563
- /** Token for pagination */
564
- pageToken?: string | undefined;
565
- }
566
-
567
- /** Response containing user-visible metrics */
568
- export interface RetrieveUserVisibleMetricsResponse {
569
- /** Collection of metric values */
570
- metricValues?: MetricValues[] | undefined;
571
- /** A token that can be used to get the next page of results. If not present, there are no more results to show. */
572
- nextPageToken?: string | undefined;
573
- }
574
-
575
- export interface ScanVectorIndexRequest {
576
- /** Name of the vector index to scan. */
577
- name?: string | undefined;
578
- /** Number of results to return. Defaults to 10. */
579
- numResults?: number | undefined;
580
- /** Primary key of the last entry returned in the previous scan. */
581
- lastPrimaryKey?: string | undefined;
582
- }
583
-
584
- /** Response to a scan vector index request. */
585
- export interface ScanVectorIndexResponse {
586
- /** List of data entries */
587
- data?: Struct[] | undefined;
588
- /** Primary key of the last entry. */
589
- lastPrimaryKey?: string | undefined;
590
- }
591
-
592
- export interface Struct {
593
- /** Data entry, corresponding to a row in a vector index. */
594
- fields?: MapStringValueEntry[] | undefined;
595
- }
596
-
597
- export interface SyncVectorIndexRequest {
598
- /** Name of the vector index to synchronize. Must be a Delta Sync Index. */
599
- name?: string | undefined;
600
- }
601
-
602
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
603
- export interface SyncVectorIndexResponse {}
604
-
605
- export interface UpdateEndpointCustomTagsRequest {
606
- /** Name of the AI Search endpoint */
607
- name?: string | undefined;
608
- /** The new custom tags for the AI Search endpoint */
609
- customTags?: CustomTag[] | undefined;
610
- }
611
-
612
- export interface UpdateEndpointCustomTagsResponse {
613
- /** The name of the AI Search endpoint whose custom tags were updated. */
614
- name?: string | undefined;
615
- /** All the custom tags that are applied to the AI Search endpoint. */
616
- customTags?: CustomTag[] | undefined;
617
- }
618
-
619
- export interface UpsertDataVectorIndexRequest {
620
- /** Name of the vector index where data is to be upserted. Must be a Direct Vector Access Index. */
621
- name?: string | undefined;
622
- /** JSON string representing the data to be upserted. */
623
- inputsJson?: string | undefined;
624
- }
625
-
626
- export interface UpsertDataVectorIndexResponse {
627
- /** Status of the upsert operation. */
628
- status?: UpsertDeleteDataStatus | undefined;
629
- /** Result of the upsert or delete operation. */
630
- result?: UpsertDeleteDataResult | undefined;
631
- }
632
-
633
- export interface UpsertDeleteDataResult {
634
- /** Count of successfully processed rows. */
635
- successRowCount?: bigint | undefined;
636
- /** List of primary keys for rows that failed to process. */
637
- failedPrimaryKeys?: string[] | undefined;
638
- }
639
-
640
- export interface Value {
641
- /** (--The kind of value.--) */
642
- kind?:
643
- | {$case: 'numberValue'; numberValue: number}
644
- | {$case: 'stringValue'; stringValue: string}
645
- | {$case: 'boolValue'; boolValue: boolean}
646
- | {$case: 'structValue'; structValue: Struct}
647
- | {$case: 'listValue'; listValue: ListValue}
648
- | undefined;
649
- }
650
-
651
- export interface VectorIndex {
652
- /** Name of the index */
653
- name?: string | undefined;
654
- /** Name of the endpoint associated with the index */
655
- endpointName?: string | undefined;
656
- /** Primary key of the index */
657
- primaryKey?: string | undefined;
658
- indexType?: VectorIndexType | undefined;
659
- indexSpec?:
660
- | {
661
- $case: 'directAccessIndexSpec';
662
- directAccessIndexSpec: DirectAccessVectorIndexSpec;
663
- }
664
- | {
665
- $case: 'deltaSyncIndexSpec';
666
- deltaSyncIndexSpec: DeltaSyncVectorIndexSpec;
667
- }
668
- | undefined;
669
- status?: VectorIndexStatus | undefined;
670
- /** The user who created the index. */
671
- creator?: string | undefined;
672
- /** The subtype of the index. */
673
- indexSubtype?: IndexSubtype | undefined;
674
- }
675
-
676
- export interface VectorIndexStatus {
677
- /** Message associated with the index status */
678
- message?: string | undefined;
679
- /** Number of rows indexed */
680
- indexedRowCount?: bigint | undefined;
681
- /** Whether the index is ready for search */
682
- ready?: boolean | undefined;
683
- /** Index API Url to be used to perform operations on the index */
684
- indexUrl?: string | undefined;
685
- }
686
-
687
- export const unmarshalColumnInfoSchema: z.ZodType<ColumnInfo> = z
688
- .object({
689
- name: z.string().optional(),
690
- type_text: z.string().optional(),
691
- })
692
- .transform(d => ({
693
- name: d.name,
694
- typeText: d.type_text,
695
- }));
696
-
697
- export const unmarshalCustomTagSchema: z.ZodType<CustomTag> = z
698
- .object({
699
- key: z.string().optional(),
700
- value: z.string().optional(),
701
- })
702
- .transform(d => ({
703
- key: d.key,
704
- value: d.value,
705
- }));
706
-
707
- export const unmarshalDeleteDataVectorIndexResponseSchema: z.ZodType<DeleteDataVectorIndexResponse> =
708
- z
709
- .object({
710
- status: z.enum(UpsertDeleteDataStatus).optional(),
711
- result: z.lazy(() => unmarshalUpsertDeleteDataResultSchema).optional(),
712
- })
713
- .transform(d => ({
714
- status: d.status,
715
- result: d.result,
716
- }));
717
-
718
- export const unmarshalDeleteEndpointResponseSchema: z.ZodType<DeleteEndpointResponse> =
719
- z.object({});
720
-
721
- export const unmarshalDeleteVectorIndexResponseSchema: z.ZodType<DeleteVectorIndexResponse> =
722
- z.object({});
723
-
724
- export const unmarshalDeltaSyncVectorIndexSpecSchema: z.ZodType<DeltaSyncVectorIndexSpec> =
725
- z
726
- .object({
727
- source_table: z.string().optional(),
728
- embedding_source_columns: z
729
- .array(z.lazy(() => unmarshalEmbeddingSourceColumnSchema))
730
- .optional(),
731
- embedding_vector_columns: z
732
- .array(z.lazy(() => unmarshalEmbeddingVectorColumnSchema))
733
- .optional(),
734
- pipeline_type: z.enum(PipelineType).optional(),
735
- pipeline_id: z.string().optional(),
736
- embedding_writeback_table: z.string().optional(),
737
- columns_to_sync: z.array(z.string()).optional(),
738
- columns_to_index: z.array(z.string()).optional(),
739
- })
740
- .transform(d => ({
741
- sourceTable: d.source_table,
742
- embeddingSourceColumns: d.embedding_source_columns,
743
- embeddingVectorColumns: d.embedding_vector_columns,
744
- pipelineType: d.pipeline_type,
745
- pipelineId: d.pipeline_id,
746
- embeddingWritebackTable: d.embedding_writeback_table,
747
- columnsToSync: d.columns_to_sync,
748
- columnsToIndex: d.columns_to_index,
749
- }));
750
-
751
- export const unmarshalDirectAccessVectorIndexSpecSchema: z.ZodType<DirectAccessVectorIndexSpec> =
752
- z
753
- .object({
754
- embedding_vector_columns: z
755
- .array(z.lazy(() => unmarshalEmbeddingVectorColumnSchema))
756
- .optional(),
757
- schema_json: z.string().optional(),
758
- embedding_source_columns: z
759
- .array(z.lazy(() => unmarshalEmbeddingSourceColumnSchema))
760
- .optional(),
761
- })
762
- .transform(d => ({
763
- embeddingVectorColumns: d.embedding_vector_columns,
764
- schemaJson: d.schema_json,
765
- embeddingSourceColumns: d.embedding_source_columns,
766
- }));
767
-
768
- export const unmarshalEmbeddingSourceColumnSchema: z.ZodType<EmbeddingSourceColumn> =
769
- z
770
- .object({
771
- name: z.string().optional(),
772
- embedding_model_endpoint_name: z.string().optional(),
773
- model_endpoint_name_for_query: z.string().optional(),
774
- })
775
- .transform(d => ({
776
- name: d.name,
777
- embeddingConfig:
778
- d.embedding_model_endpoint_name !== undefined
779
- ? {
780
- $case: 'embeddingModelEndpointName' as const,
781
- embeddingModelEndpointName: d.embedding_model_endpoint_name,
782
- }
783
- : undefined,
784
- modelEndpointNameForQuery: d.model_endpoint_name_for_query,
785
- }));
786
-
787
- export const unmarshalEmbeddingVectorColumnSchema: z.ZodType<EmbeddingVectorColumn> =
788
- z
789
- .object({
790
- name: z.string().optional(),
791
- embedding_dimension: z.number().optional(),
792
- })
793
- .transform(d => ({
794
- name: d.name,
795
- embeddingDimension: d.embedding_dimension,
796
- }));
797
-
798
- export const unmarshalEndpointSchema: z.ZodType<Endpoint> = z
799
- .object({
800
- name: z.string().optional(),
801
- creator: z.string().optional(),
802
- creation_timestamp: z
803
- .union([z.number(), z.bigint()])
804
- .transform(v => BigInt(v))
805
- .optional(),
806
- last_updated_timestamp: z
807
- .union([z.number(), z.bigint()])
808
- .transform(v => BigInt(v))
809
- .optional(),
810
- endpoint_type: z.enum(EndpointType).optional(),
811
- last_updated_user: z.string().optional(),
812
- id: z.string().optional(),
813
- endpoint_status: z.lazy(() => unmarshalEndpointStatusSchema).optional(),
814
- num_indexes: z.number().optional(),
815
- budget_policy_id: z.string().optional(),
816
- effective_budget_policy_id: z.string().optional(),
817
- custom_tags: z.array(z.lazy(() => unmarshalCustomTagSchema)).optional(),
818
- scaling_info: z.lazy(() => unmarshalEndpointScalingInfoSchema).optional(),
819
- })
820
- .transform(d => ({
821
- name: d.name,
822
- creator: d.creator,
823
- creationTimestamp: d.creation_timestamp,
824
- lastUpdatedTimestamp: d.last_updated_timestamp,
825
- endpointType: d.endpoint_type,
826
- lastUpdatedUser: d.last_updated_user,
827
- id: d.id,
828
- endpointStatus: d.endpoint_status,
829
- numIndexes: d.num_indexes,
830
- budgetPolicyId: d.budget_policy_id,
831
- effectiveBudgetPolicyId: d.effective_budget_policy_id,
832
- customTags: d.custom_tags,
833
- scalingInfo: d.scaling_info,
834
- }));
835
-
836
- export const unmarshalEndpointScalingInfoSchema: z.ZodType<EndpointScalingInfo> =
837
- z
838
- .object({
839
- state: z.enum(ScalingChangeState).optional(),
840
- requested_target_qps: z
841
- .union([z.number(), z.bigint()])
842
- .transform(v => BigInt(v))
843
- .optional(),
844
- })
845
- .transform(d => ({
846
- state: d.state,
847
- requestedTargetQps: d.requested_target_qps,
848
- }));
849
-
850
- export const unmarshalEndpointStatusSchema: z.ZodType<EndpointStatus> = z
851
- .object({
852
- state: z.enum(EndpointStatus_State).optional(),
853
- message: z.string().optional(),
854
- })
855
- .transform(d => ({
856
- state: d.state,
857
- message: d.message,
858
- }));
859
-
860
- export const unmarshalListEndpointResponseSchema: z.ZodType<ListEndpointResponse> =
861
- z
862
- .object({
863
- endpoints: z.array(z.lazy(() => unmarshalEndpointSchema)).optional(),
864
- next_page_token: z.string().optional(),
865
- })
866
- .transform(d => ({
867
- endpoints: d.endpoints,
868
- nextPageToken: d.next_page_token,
869
- }));
870
-
871
- export const unmarshalListValueSchema: z.ZodType<ListValue> = z
872
- .object({
873
- values: z.array(z.lazy(() => unmarshalValueSchema)).optional(),
874
- })
875
- .transform(d => ({
876
- values: d.values,
877
- }));
878
-
879
- export const unmarshalListVectorIndexResponseSchema: z.ZodType<ListVectorIndexResponse> =
880
- z
881
- .object({
882
- vector_indexes: z
883
- .array(z.lazy(() => unmarshalMiniVectorIndexSchema))
884
- .optional(),
885
- next_page_token: z.string().optional(),
886
- })
887
- .transform(d => ({
888
- vectorIndexes: d.vector_indexes,
889
- nextPageToken: d.next_page_token,
890
- }));
891
-
892
- export const unmarshalMapStringValueEntrySchema: z.ZodType<MapStringValueEntry> =
893
- z
894
- .object({
895
- key: z.string().optional(),
896
- value: z.lazy(() => unmarshalValueSchema).optional(),
897
- })
898
- .transform(d => ({
899
- key: d.key,
900
- value: d.value,
901
- }));
902
-
903
- export const unmarshalMetricSchema: z.ZodType<Metric> = z
904
- .object({
905
- name: z.string().optional(),
906
- labels: z.array(z.lazy(() => unmarshalMetricLabelSchema)).optional(),
907
- percentile: z.number().optional(),
908
- })
909
- .transform(d => ({
910
- name: d.name,
911
- labels: d.labels,
912
- percentile: d.percentile,
913
- }));
914
-
915
- export const unmarshalMetricLabelSchema: z.ZodType<MetricLabel> = z
916
- .object({
917
- name: z.string().optional(),
918
- value: z.string().optional(),
919
- })
920
- .transform(d => ({
921
- name: d.name,
922
- value: d.value,
923
- }));
924
-
925
- export const unmarshalMetricValueSchema: z.ZodType<MetricValue> = z
926
- .object({
927
- timestamp: z
928
- .union([z.number(), z.bigint()])
929
- .transform(v => BigInt(v))
930
- .optional(),
931
- value: z.number().optional(),
932
- })
933
- .transform(d => ({
934
- timestamp: d.timestamp,
935
- value: d.value,
936
- }));
937
-
938
- export const unmarshalMetricValuesSchema: z.ZodType<MetricValues> = z
939
- .object({
940
- metric: z.lazy(() => unmarshalMetricSchema).optional(),
941
- values: z.array(z.lazy(() => unmarshalMetricValueSchema)).optional(),
942
- })
943
- .transform(d => ({
944
- metric: d.metric,
945
- values: d.values,
946
- }));
947
-
948
- export const unmarshalMiniVectorIndexSchema: z.ZodType<MiniVectorIndex> = z
949
- .object({
950
- name: z.string().optional(),
951
- endpoint_name: z.string().optional(),
952
- primary_key: z.string().optional(),
953
- index_type: z.enum(VectorIndexType).optional(),
954
- direct_access_index_spec: z
955
- .lazy(() => unmarshalDirectAccessVectorIndexSpecSchema)
956
- .optional(),
957
- delta_sync_index_spec: z
958
- .lazy(() => unmarshalDeltaSyncVectorIndexSpecSchema)
959
- .optional(),
960
- status: z.lazy(() => unmarshalVectorIndexStatusSchema).optional(),
961
- creator: z.string().optional(),
962
- index_subtype: z.enum(IndexSubtype).optional(),
963
- })
964
- .transform(d => ({
965
- name: d.name,
966
- endpointName: d.endpoint_name,
967
- primaryKey: d.primary_key,
968
- indexType: d.index_type,
969
- indexSpec:
970
- d.direct_access_index_spec !== undefined
971
- ? {
972
- $case: 'directAccessIndexSpec' as const,
973
- directAccessIndexSpec: d.direct_access_index_spec,
974
- }
975
- : d.delta_sync_index_spec !== undefined
976
- ? {
977
- $case: 'deltaSyncIndexSpec' as const,
978
- deltaSyncIndexSpec: d.delta_sync_index_spec,
979
- }
980
- : undefined,
981
- status: d.status,
982
- creator: d.creator,
983
- indexSubtype: d.index_subtype,
984
- }));
985
-
986
- export const unmarshalPatchEndpointBudgetPolicyResponseSchema: z.ZodType<PatchEndpointBudgetPolicyResponse> =
987
- z
988
- .object({
989
- budget_policy_id: z.string().optional(),
990
- effective_budget_policy_id: z.string().optional(),
991
- })
992
- .transform(d => ({
993
- budgetPolicyId: d.budget_policy_id,
994
- effectiveBudgetPolicyId: d.effective_budget_policy_id,
995
- }));
996
-
997
- export const unmarshalQueryVectorIndexResponseSchema: z.ZodType<QueryVectorIndexResponse> =
998
- z
999
- .object({
1000
- manifest: z.lazy(() => unmarshalResultManifestSchema).optional(),
1001
- result: z.lazy(() => unmarshalResultDataSchema).optional(),
1002
- next_page_token: z.string().optional(),
1003
- })
1004
- .transform(d => ({
1005
- manifest: d.manifest,
1006
- result: d.result,
1007
- nextPageToken: d.next_page_token,
1008
- }));
1009
-
1010
- export const unmarshalResultDataSchema: z.ZodType<ResultData> = z
1011
- .object({
1012
- row_count: z.number().optional(),
1013
- data_array: z.array(z.array(jsonValueSchema)).optional(),
1014
- })
1015
- .transform(d => ({
1016
- rowCount: d.row_count,
1017
- dataArray: d.data_array,
1018
- }));
1019
-
1020
- export const unmarshalResultManifestSchema: z.ZodType<ResultManifest> = z
1021
- .object({
1022
- column_count: z.number().optional(),
1023
- columns: z.array(z.lazy(() => unmarshalColumnInfoSchema)).optional(),
1024
- })
1025
- .transform(d => ({
1026
- columnCount: d.column_count,
1027
- columns: d.columns,
1028
- }));
1029
-
1030
- export const unmarshalRetrieveUserVisibleMetricsResponseSchema: z.ZodType<RetrieveUserVisibleMetricsResponse> =
1031
- z
1032
- .object({
1033
- metric_values: z
1034
- .array(z.lazy(() => unmarshalMetricValuesSchema))
1035
- .optional(),
1036
- next_page_token: z.string().optional(),
1037
- })
1038
- .transform(d => ({
1039
- metricValues: d.metric_values,
1040
- nextPageToken: d.next_page_token,
1041
- }));
1042
-
1043
- export const unmarshalScanVectorIndexResponseSchema: z.ZodType<ScanVectorIndexResponse> =
1044
- z
1045
- .object({
1046
- data: z.array(z.lazy(() => unmarshalStructSchema)).optional(),
1047
- last_primary_key: z.string().optional(),
1048
- })
1049
- .transform(d => ({
1050
- data: d.data,
1051
- lastPrimaryKey: d.last_primary_key,
1052
- }));
1053
-
1054
- export const unmarshalStructSchema: z.ZodType<Struct> = z
1055
- .object({
1056
- fields: z
1057
- .array(z.lazy(() => unmarshalMapStringValueEntrySchema))
1058
- .optional(),
1059
- })
1060
- .transform(d => ({
1061
- fields: d.fields,
1062
- }));
1063
-
1064
- export const unmarshalSyncVectorIndexResponseSchema: z.ZodType<SyncVectorIndexResponse> =
1065
- z.object({});
1066
-
1067
- export const unmarshalUpdateEndpointCustomTagsResponseSchema: z.ZodType<UpdateEndpointCustomTagsResponse> =
1068
- z
1069
- .object({
1070
- name: z.string().optional(),
1071
- custom_tags: z.array(z.lazy(() => unmarshalCustomTagSchema)).optional(),
1072
- })
1073
- .transform(d => ({
1074
- name: d.name,
1075
- customTags: d.custom_tags,
1076
- }));
1077
-
1078
- export const unmarshalUpsertDataVectorIndexResponseSchema: z.ZodType<UpsertDataVectorIndexResponse> =
1079
- z
1080
- .object({
1081
- status: z.enum(UpsertDeleteDataStatus).optional(),
1082
- result: z.lazy(() => unmarshalUpsertDeleteDataResultSchema).optional(),
1083
- })
1084
- .transform(d => ({
1085
- status: d.status,
1086
- result: d.result,
1087
- }));
1088
-
1089
- export const unmarshalUpsertDeleteDataResultSchema: z.ZodType<UpsertDeleteDataResult> =
1090
- z
1091
- .object({
1092
- success_row_count: z
1093
- .union([z.number(), z.bigint()])
1094
- .transform(v => BigInt(v))
1095
- .optional(),
1096
- failed_primary_keys: z.array(z.string()).optional(),
1097
- })
1098
- .transform(d => ({
1099
- successRowCount: d.success_row_count,
1100
- failedPrimaryKeys: d.failed_primary_keys,
1101
- }));
1102
-
1103
- export const unmarshalValueSchema: z.ZodType<Value> = z
1104
- .object({
1105
- number_value: z.number().optional(),
1106
- string_value: z.string().optional(),
1107
- bool_value: z.boolean().optional(),
1108
- struct_value: z.lazy(() => unmarshalStructSchema).optional(),
1109
- list_value: z.lazy(() => unmarshalListValueSchema).optional(),
1110
- })
1111
- .transform(d => ({
1112
- kind:
1113
- d.number_value !== undefined
1114
- ? {$case: 'numberValue' as const, numberValue: d.number_value}
1115
- : d.string_value !== undefined
1116
- ? {$case: 'stringValue' as const, stringValue: d.string_value}
1117
- : d.bool_value !== undefined
1118
- ? {$case: 'boolValue' as const, boolValue: d.bool_value}
1119
- : d.struct_value !== undefined
1120
- ? {$case: 'structValue' as const, structValue: d.struct_value}
1121
- : d.list_value !== undefined
1122
- ? {$case: 'listValue' as const, listValue: d.list_value}
1123
- : undefined,
1124
- }));
1125
-
1126
- export const unmarshalVectorIndexSchema: z.ZodType<VectorIndex> = z
1127
- .object({
1128
- name: z.string().optional(),
1129
- endpoint_name: z.string().optional(),
1130
- primary_key: z.string().optional(),
1131
- index_type: z.enum(VectorIndexType).optional(),
1132
- direct_access_index_spec: z
1133
- .lazy(() => unmarshalDirectAccessVectorIndexSpecSchema)
1134
- .optional(),
1135
- delta_sync_index_spec: z
1136
- .lazy(() => unmarshalDeltaSyncVectorIndexSpecSchema)
1137
- .optional(),
1138
- status: z.lazy(() => unmarshalVectorIndexStatusSchema).optional(),
1139
- creator: z.string().optional(),
1140
- index_subtype: z.enum(IndexSubtype).optional(),
1141
- })
1142
- .transform(d => ({
1143
- name: d.name,
1144
- endpointName: d.endpoint_name,
1145
- primaryKey: d.primary_key,
1146
- indexType: d.index_type,
1147
- indexSpec:
1148
- d.direct_access_index_spec !== undefined
1149
- ? {
1150
- $case: 'directAccessIndexSpec' as const,
1151
- directAccessIndexSpec: d.direct_access_index_spec,
1152
- }
1153
- : d.delta_sync_index_spec !== undefined
1154
- ? {
1155
- $case: 'deltaSyncIndexSpec' as const,
1156
- deltaSyncIndexSpec: d.delta_sync_index_spec,
1157
- }
1158
- : undefined,
1159
- status: d.status,
1160
- creator: d.creator,
1161
- indexSubtype: d.index_subtype,
1162
- }));
1163
-
1164
- export const unmarshalVectorIndexStatusSchema: z.ZodType<VectorIndexStatus> = z
1165
- .object({
1166
- message: z.string().optional(),
1167
- indexed_row_count: z
1168
- .union([z.number(), z.bigint()])
1169
- .transform(v => BigInt(v))
1170
- .optional(),
1171
- ready: z.boolean().optional(),
1172
- index_url: z.string().optional(),
1173
- })
1174
- .transform(d => ({
1175
- message: d.message,
1176
- indexedRowCount: d.indexed_row_count,
1177
- ready: d.ready,
1178
- indexUrl: d.index_url,
1179
- }));
1180
-
1181
- export const marshalCreateEndpointRequestSchema: z.ZodType = z
1182
- .object({
1183
- name: z.string().optional(),
1184
- endpointType: z.enum(EndpointType).optional(),
1185
- budgetPolicyId: z.string().optional(),
1186
- usagePolicyId: z.string().optional(),
1187
- targetQps: z.bigint().optional(),
1188
- })
1189
- .transform(d => ({
1190
- name: d.name,
1191
- endpoint_type: d.endpointType,
1192
- budget_policy_id: d.budgetPolicyId,
1193
- usage_policy_id: d.usagePolicyId,
1194
- target_qps: d.targetQps,
1195
- }));
1196
-
1197
- export const marshalCreateVectorIndexRequestSchema: z.ZodType = z
1198
- .object({
1199
- name: z.string().optional(),
1200
- endpointName: z.string().optional(),
1201
- primaryKey: z.string().optional(),
1202
- indexType: z.enum(VectorIndexType).optional(),
1203
- indexSpec: z
1204
- .discriminatedUnion('$case', [
1205
- z.object({
1206
- $case: z.literal('directAccessIndexSpec'),
1207
- directAccessIndexSpec: z.lazy(
1208
- () => marshalDirectAccessVectorIndexSpecSchema
1209
- ),
1210
- }),
1211
- z.object({
1212
- $case: z.literal('deltaSyncIndexSpec'),
1213
- deltaSyncIndexSpec: z.lazy(
1214
- () => marshalDeltaSyncVectorIndexSpecRequestSchema
1215
- ),
1216
- }),
1217
- ])
1218
- .optional(),
1219
- indexSubtype: z.enum(IndexSubtype).optional(),
1220
- })
1221
- .transform(d => ({
1222
- name: d.name,
1223
- endpoint_name: d.endpointName,
1224
- primary_key: d.primaryKey,
1225
- index_type: d.indexType,
1226
- ...(d.indexSpec?.$case === 'directAccessIndexSpec' && {
1227
- direct_access_index_spec: d.indexSpec.directAccessIndexSpec,
1228
- }),
1229
- ...(d.indexSpec?.$case === 'deltaSyncIndexSpec' && {
1230
- delta_sync_index_spec: d.indexSpec.deltaSyncIndexSpec,
1231
- }),
1232
- index_subtype: d.indexSubtype,
1233
- }));
1234
-
1235
- export const marshalCustomTagSchema: z.ZodType = z
1236
- .object({
1237
- key: z.string().optional(),
1238
- value: z.string().optional(),
1239
- })
1240
- .transform(d => ({
1241
- key: d.key,
1242
- value: d.value,
1243
- }));
1244
-
1245
- export const marshalDeltaSyncVectorIndexSpecRequestSchema: z.ZodType = z
1246
- .object({
1247
- sourceTable: z.string().optional(),
1248
- embeddingSourceColumns: z
1249
- .array(z.lazy(() => marshalEmbeddingSourceColumnSchema))
1250
- .optional(),
1251
- embeddingVectorColumns: z
1252
- .array(z.lazy(() => marshalEmbeddingVectorColumnSchema))
1253
- .optional(),
1254
- pipelineType: z.enum(PipelineType).optional(),
1255
- pipelineId: z.string().optional(),
1256
- embeddingWritebackTable: z.string().optional(),
1257
- columnsToSync: z.array(z.string()).optional(),
1258
- columnsToIndex: z.array(z.string()).optional(),
1259
- })
1260
- .transform(d => ({
1261
- source_table: d.sourceTable,
1262
- embedding_source_columns: d.embeddingSourceColumns,
1263
- embedding_vector_columns: d.embeddingVectorColumns,
1264
- pipeline_type: d.pipelineType,
1265
- pipeline_id: d.pipelineId,
1266
- embedding_writeback_table: d.embeddingWritebackTable,
1267
- columns_to_sync: d.columnsToSync,
1268
- columns_to_index: d.columnsToIndex,
1269
- }));
1270
-
1271
- export const marshalDirectAccessVectorIndexSpecSchema: z.ZodType = z
1272
- .object({
1273
- embeddingVectorColumns: z
1274
- .array(z.lazy(() => marshalEmbeddingVectorColumnSchema))
1275
- .optional(),
1276
- schemaJson: z.string().optional(),
1277
- embeddingSourceColumns: z
1278
- .array(z.lazy(() => marshalEmbeddingSourceColumnSchema))
1279
- .optional(),
1280
- })
1281
- .transform(d => ({
1282
- embedding_vector_columns: d.embeddingVectorColumns,
1283
- schema_json: d.schemaJson,
1284
- embedding_source_columns: d.embeddingSourceColumns,
1285
- }));
1286
-
1287
- export const marshalEmbeddingSourceColumnSchema: z.ZodType = z
1288
- .object({
1289
- name: z.string().optional(),
1290
- embeddingConfig: z
1291
- .discriminatedUnion('$case', [
1292
- z.object({
1293
- $case: z.literal('embeddingModelEndpointName'),
1294
- embeddingModelEndpointName: z.string(),
1295
- }),
1296
- ])
1297
- .optional(),
1298
- modelEndpointNameForQuery: z.string().optional(),
1299
- })
1300
- .transform(d => ({
1301
- name: d.name,
1302
- ...(d.embeddingConfig?.$case === 'embeddingModelEndpointName' && {
1303
- embedding_model_endpoint_name:
1304
- d.embeddingConfig.embeddingModelEndpointName,
1305
- }),
1306
- model_endpoint_name_for_query: d.modelEndpointNameForQuery,
1307
- }));
1308
-
1309
- export const marshalEmbeddingVectorColumnSchema: z.ZodType = z
1310
- .object({
1311
- name: z.string().optional(),
1312
- embeddingDimension: z.number().optional(),
1313
- })
1314
- .transform(d => ({
1315
- name: d.name,
1316
- embedding_dimension: d.embeddingDimension,
1317
- }));
1318
-
1319
- export const marshalMetricSchema: z.ZodType = z
1320
- .object({
1321
- name: z.string().optional(),
1322
- labels: z.array(z.lazy(() => marshalMetricLabelSchema)).optional(),
1323
- percentile: z.number().optional(),
1324
- })
1325
- .transform(d => ({
1326
- name: d.name,
1327
- labels: d.labels,
1328
- percentile: d.percentile,
1329
- }));
1330
-
1331
- export const marshalMetricLabelSchema: z.ZodType = z
1332
- .object({
1333
- name: z.string().optional(),
1334
- value: z.string().optional(),
1335
- })
1336
- .transform(d => ({
1337
- name: d.name,
1338
- value: d.value,
1339
- }));
1340
-
1341
- export const marshalPatchEndpointBudgetPolicyRequestSchema: z.ZodType = z
1342
- .object({
1343
- name: z.string().optional(),
1344
- budgetPolicyId: z.string().optional(),
1345
- })
1346
- .transform(d => ({
1347
- name: d.name,
1348
- budget_policy_id: d.budgetPolicyId,
1349
- }));
1350
-
1351
- export const marshalPatchEndpointRequestSchema: z.ZodType = z
1352
- .object({
1353
- name: z.string().optional(),
1354
- targetQps: z.bigint().optional(),
1355
- })
1356
- .transform(d => ({
1357
- name: d.name,
1358
- target_qps: d.targetQps,
1359
- }));
1360
-
1361
- export const marshalQueryVectorIndexNextPageRequestSchema: z.ZodType = z
1362
- .object({
1363
- name: z.string().optional(),
1364
- endpointName: z.string().optional(),
1365
- pageToken: z.string().optional(),
1366
- })
1367
- .transform(d => ({
1368
- name: d.name,
1369
- endpoint_name: d.endpointName,
1370
- page_token: d.pageToken,
1371
- }));
1372
-
1373
- export const marshalQueryVectorIndexRequestSchema: z.ZodType = z
1374
- .object({
1375
- name: z.string().optional(),
1376
- numResults: z.number().optional(),
1377
- columns: z.array(z.string()).optional(),
1378
- filtersJson: z.string().optional(),
1379
- queryVector: z.array(z.number()).optional(),
1380
- queryText: z.string().optional(),
1381
- scoreThreshold: z.number().optional(),
1382
- queryType: z.string().optional(),
1383
- columnsToRerank: z.array(z.string()).optional(),
1384
- reranker: z.lazy(() => marshalRerankerConfigSchema).optional(),
1385
- })
1386
- .transform(d => ({
1387
- name: d.name,
1388
- num_results: d.numResults,
1389
- columns: d.columns,
1390
- filters_json: d.filtersJson,
1391
- query_vector: d.queryVector,
1392
- query_text: d.queryText,
1393
- score_threshold: d.scoreThreshold,
1394
- query_type: d.queryType,
1395
- columns_to_rerank: d.columnsToRerank,
1396
- reranker: d.reranker,
1397
- }));
1398
-
1399
- export const marshalRerankerConfigSchema: z.ZodType = z
1400
- .object({
1401
- model: z.string().optional(),
1402
- parameters: z
1403
- .lazy(() => marshalRerankerConfig_RerankerParametersSchema)
1404
- .optional(),
1405
- })
1406
- .transform(d => ({
1407
- model: d.model,
1408
- parameters: d.parameters,
1409
- }));
1410
-
1411
- // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
1412
- export const marshalRerankerConfig_RerankerParametersSchema: z.ZodType = z
1413
- .object({
1414
- columnsToRerank: z.array(z.string()).optional(),
1415
- })
1416
- .transform(d => ({
1417
- columns_to_rerank: d.columnsToRerank,
1418
- }));
1419
-
1420
- export const marshalRetrieveUserVisibleMetricsRequestSchema: z.ZodType = z
1421
- .object({
1422
- name: z.string().optional(),
1423
- startTime: z
1424
- .any()
1425
- .transform((d: Temporal.Instant) => d.toString())
1426
- .optional(),
1427
- endTime: z
1428
- .any()
1429
- .transform((d: Temporal.Instant) => d.toString())
1430
- .optional(),
1431
- granularityInSeconds: z.number().optional(),
1432
- metrics: z.array(z.lazy(() => marshalMetricSchema)).optional(),
1433
- pageToken: z.string().optional(),
1434
- })
1435
- .transform(d => ({
1436
- name: d.name,
1437
- start_time: d.startTime,
1438
- end_time: d.endTime,
1439
- granularity_in_seconds: d.granularityInSeconds,
1440
- metrics: d.metrics,
1441
- page_token: d.pageToken,
1442
- }));
1443
-
1444
- export const marshalScanVectorIndexRequestSchema: z.ZodType = z
1445
- .object({
1446
- name: z.string().optional(),
1447
- numResults: z.number().optional(),
1448
- lastPrimaryKey: z.string().optional(),
1449
- })
1450
- .transform(d => ({
1451
- name: d.name,
1452
- num_results: d.numResults,
1453
- last_primary_key: d.lastPrimaryKey,
1454
- }));
1455
-
1456
- export const marshalSyncVectorIndexRequestSchema: z.ZodType = z
1457
- .object({
1458
- name: z.string().optional(),
1459
- })
1460
- .transform(d => ({
1461
- name: d.name,
1462
- }));
1463
-
1464
- export const marshalUpdateEndpointCustomTagsRequestSchema: z.ZodType = z
1465
- .object({
1466
- name: z.string().optional(),
1467
- customTags: z.array(z.lazy(() => marshalCustomTagSchema)).optional(),
1468
- })
1469
- .transform(d => ({
1470
- name: d.name,
1471
- custom_tags: d.customTags,
1472
- }));
1473
-
1474
- export const marshalUpsertDataVectorIndexRequestSchema: z.ZodType = z
1475
- .object({
1476
- name: z.string().optional(),
1477
- inputsJson: z.string().optional(),
1478
- })
1479
- .transform(d => ({
1480
- name: d.name,
1481
- inputs_json: d.inputsJson,
1482
- }));