@databricks/sdk-vectorsearch 0.1.0-dev.4 → 0.1.0-dev.6
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 +28 -0
- package/dist/v1/client.d.ts +3 -3
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +101 -85
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +1 -1
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/model.d.ts +72 -35
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +77 -57
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +30 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +33 -16
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +2 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +9 -5
- package/src/v1/client.ts +0 -807
- package/src/v1/index.ts +0 -72
- package/src/v1/model.ts +0 -1482
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -180
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @databricks/sdk-vectorsearch
|
|
2
|
+
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
>
|
|
5
|
+
> ## PREVIEW - NOT FOR PRODUCTION USE
|
|
6
|
+
>
|
|
7
|
+
> **This SDK is in preview and is subject to change without notice.**
|
|
8
|
+
>
|
|
9
|
+
> - **Do NOT use in production environments**
|
|
10
|
+
> - **Breaking changes may occur at any time**
|
|
11
|
+
> - **APIs are experimental and unstable**
|
|
12
|
+
> - **Use for development and testing only**
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @databricks/sdk-vectorsearch
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {VectorSearchClient} from '@databricks/sdk-vectorsearch/v1';
|
|
24
|
+
|
|
25
|
+
const client = new VectorSearchClient({});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For a full getting-started guide, see the [root README](../../README.md).
|
package/dist/v1/client.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import type { ClientOptions } from '@databricks/sdk-options/client';
|
|
|
3
3
|
import type { LroOptions } from '@databricks/sdk-options/lro';
|
|
4
4
|
import type { CreateEndpointRequest, CreateVectorIndexRequest, DeleteDataVectorIndexRequest, DeleteDataVectorIndexResponse, DeleteEndpointRequest, DeleteEndpointResponse, DeleteVectorIndexRequest, DeleteVectorIndexResponse, Endpoint, GetEndpointRequest, GetVectorIndexRequest, ListEndpointRequest, ListEndpointResponse, ListVectorIndexRequest, ListVectorIndexResponse, MiniVectorIndex, PatchEndpointBudgetPolicyRequest, PatchEndpointBudgetPolicyResponse, PatchEndpointRequest, QueryVectorIndexNextPageRequest, QueryVectorIndexRequest, QueryVectorIndexResponse, RetrieveUserVisibleMetricsRequest, RetrieveUserVisibleMetricsResponse, ScanVectorIndexRequest, ScanVectorIndexResponse, SyncVectorIndexRequest, SyncVectorIndexResponse, UpdateEndpointCustomTagsRequest, UpdateEndpointCustomTagsResponse, UpsertDataVectorIndexRequest, UpsertDataVectorIndexResponse, VectorIndex } from './model';
|
|
5
5
|
export declare class VectorSearchClient {
|
|
6
|
-
private readonly
|
|
7
|
-
private readonly workspaceId;
|
|
8
|
-
private readonly httpClient;
|
|
6
|
+
private readonly options;
|
|
9
7
|
private readonly logger;
|
|
10
8
|
private readonly userAgent;
|
|
9
|
+
private config;
|
|
11
10
|
constructor(options: ClientOptions);
|
|
11
|
+
private resolveConfig;
|
|
12
12
|
/** Create a new endpoint. */
|
|
13
13
|
private createEndpoint;
|
|
14
14
|
createEndpointWaiter(req: CreateEndpointRequest, options?: CallOptions): Promise<CreateEndpointWaiter>;
|
package/dist/v1/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAa5D,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,gCAAgC,EAChC,iCAAiC,EACjC,oBAAoB,EACpB,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,EACxB,iCAAiC,EACjC,kCAAkC,EAClC,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,EAC7B,WAAW,EACZ,MAAM,SAAS,CAAC;AAoCjB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAa5D,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,QAAQ,EACR,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W,GACpB,OAAO,CAAC,kCAAkC,CAAC;IAgC9C,oHAAoH;IAC9G,eAAe,CACnB,GAAG,EAAE,sBAAsB,EAC3B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,uBAAuB,CAAC;IA0BnC,uEAAuE;IACjE,eAAe,CACnB,GAAG,EAAE,sBAAsB,EAC3B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,uBAAuB,CAAC;IA0BnC,6CAA6C;IACvC,wBAAwB,CAC5B,GAAG,EAAE,+BAA+B,EACpC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,gCAAgC,CAAC;IAgC5C,mEAAmE;IAC7D,qBAAqB,CACzB,GAAG,EAAE,4BAA4B,EACjC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,6BAA6B,CAAC;CA4B1C;AAED,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;gBADJ,MAAM,EAAE,kBAAkB,EAClC,IAAI,EAAE,MAAM;IAGvB;;;;OAIG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAoCnD,iEAAiE;IAC3D,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CAqBpD"}
|
package/dist/v1/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
|
|
3
3
|
import { createDefault } from '@databricks/sdk-core/clientinfo';
|
|
4
4
|
import { NoOpLogger } from '@databricks/sdk-core/logger';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveClientConfig } from './transport';
|
|
6
6
|
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, executeWait, StillRunningError, } from './utils';
|
|
7
7
|
import pkgJson from '../../package.json' with { type: 'json' };
|
|
8
8
|
import { EndpointStatus_State, marshalCreateEndpointRequestSchema, marshalCreateVectorIndexRequestSchema, marshalPatchEndpointBudgetPolicyRequestSchema, marshalPatchEndpointRequestSchema, marshalQueryVectorIndexNextPageRequestSchema, marshalQueryVectorIndexRequestSchema, marshalRetrieveUserVisibleMetricsRequestSchema, marshalScanVectorIndexRequestSchema, marshalSyncVectorIndexRequestSchema, marshalUpdateEndpointCustomTagsRequestSchema, marshalUpsertDataVectorIndexRequestSchema, unmarshalDeleteDataVectorIndexResponseSchema, unmarshalDeleteEndpointResponseSchema, unmarshalDeleteVectorIndexResponseSchema, unmarshalEndpointSchema, unmarshalListEndpointResponseSchema, unmarshalListVectorIndexResponseSchema, unmarshalPatchEndpointBudgetPolicyResponseSchema, unmarshalQueryVectorIndexResponseSchema, unmarshalRetrieveUserVisibleMetricsResponseSchema, unmarshalScanVectorIndexResponseSchema, unmarshalSyncVectorIndexResponseSchema, unmarshalUpdateEndpointCustomTagsResponseSchema, unmarshalUpsertDataVectorIndexResponseSchema, unmarshalVectorIndexSchema, } from './model';
|
|
@@ -12,46 +12,45 @@ const PACKAGE_SEGMENT = {
|
|
|
12
12
|
value: pkgJson.version,
|
|
13
13
|
};
|
|
14
14
|
export class VectorSearchClient {
|
|
15
|
-
|
|
16
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
17
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
18
|
-
// request.
|
|
19
|
-
workspaceId;
|
|
20
|
-
httpClient;
|
|
15
|
+
options;
|
|
21
16
|
logger;
|
|
22
17
|
// User-Agent header value. Composed once at construction from
|
|
23
18
|
// createDefault() merged with this package's identity and the active
|
|
24
19
|
// credential's name.
|
|
25
20
|
userAgent;
|
|
21
|
+
// Memoized configuration. The profile is resolved once, lazily, on the first
|
|
22
|
+
// request, then reused; host, workspaceId/accountId, and credentials are
|
|
23
|
+
// filled from it when not set explicitly on the options.
|
|
24
|
+
config;
|
|
26
25
|
constructor(options) {
|
|
27
|
-
|
|
28
|
-
throw new Error('Host is required.');
|
|
29
|
-
}
|
|
30
|
-
this.host = options.host.replace(/\/$/, '');
|
|
31
|
-
this.workspaceId = options.workspaceId;
|
|
26
|
+
this.options = options;
|
|
32
27
|
this.logger = options.logger ?? new NoOpLogger();
|
|
33
28
|
const info = createDefault()
|
|
34
29
|
.with(PACKAGE_SEGMENT)
|
|
35
30
|
.with({ key: 'sdk-js-auth', value: AUTH_VERSION })
|
|
36
31
|
.with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
|
|
37
32
|
this.userAgent = info.toString();
|
|
38
|
-
|
|
33
|
+
}
|
|
34
|
+
resolveConfig() {
|
|
35
|
+
this.config ??= resolveClientConfig(this.options);
|
|
36
|
+
return this.config;
|
|
39
37
|
}
|
|
40
38
|
/** Create a new endpoint. */
|
|
41
39
|
async createEndpoint(req, options) {
|
|
42
|
-
const
|
|
40
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
41
|
+
const url = `${host}/api/2.0/vector-search/endpoints`;
|
|
43
42
|
const body = marshalRequest(req, marshalCreateEndpointRequestSchema);
|
|
44
43
|
let resp;
|
|
45
44
|
const call = async (callSignal) => {
|
|
46
45
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
47
|
-
if (
|
|
48
|
-
headers.set('X-Databricks-Org-Id',
|
|
46
|
+
if (workspaceId !== undefined) {
|
|
47
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
49
48
|
}
|
|
50
49
|
headers.set('User-Agent', this.userAgent);
|
|
51
50
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
52
51
|
const respBody = await executeHttpCall({
|
|
53
52
|
request: httpReq,
|
|
54
|
-
httpClient
|
|
53
|
+
httpClient,
|
|
55
54
|
logger: this.logger,
|
|
56
55
|
});
|
|
57
56
|
resp = parseResponse(respBody, unmarshalEndpointSchema);
|
|
@@ -71,19 +70,20 @@ export class VectorSearchClient {
|
|
|
71
70
|
}
|
|
72
71
|
/** Create a new index. */
|
|
73
72
|
async createVectorIndex(req, options) {
|
|
74
|
-
const
|
|
73
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
74
|
+
const url = `${host}/api/2.0/vector-search/indexes`;
|
|
75
75
|
const body = marshalRequest(req, marshalCreateVectorIndexRequestSchema);
|
|
76
76
|
let resp;
|
|
77
77
|
const call = async (callSignal) => {
|
|
78
78
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
79
|
-
if (
|
|
80
|
-
headers.set('X-Databricks-Org-Id',
|
|
79
|
+
if (workspaceId !== undefined) {
|
|
80
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
81
81
|
}
|
|
82
82
|
headers.set('User-Agent', this.userAgent);
|
|
83
83
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
84
84
|
const respBody = await executeHttpCall({
|
|
85
85
|
request: httpReq,
|
|
86
|
-
httpClient
|
|
86
|
+
httpClient,
|
|
87
87
|
logger: this.logger,
|
|
88
88
|
});
|
|
89
89
|
resp = parseResponse(respBody, unmarshalVectorIndexSchema);
|
|
@@ -96,7 +96,8 @@ export class VectorSearchClient {
|
|
|
96
96
|
}
|
|
97
97
|
/** Handles the deletion of data from a specified vector index. */
|
|
98
98
|
async deleteDataVectorIndex(req, options) {
|
|
99
|
-
const
|
|
99
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
100
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}/delete-data`;
|
|
100
101
|
const params = new URLSearchParams();
|
|
101
102
|
if (req.primaryKeys !== undefined) {
|
|
102
103
|
params.append('primary_keys', String(req.primaryKeys));
|
|
@@ -106,14 +107,14 @@ export class VectorSearchClient {
|
|
|
106
107
|
let resp;
|
|
107
108
|
const call = async (callSignal) => {
|
|
108
109
|
const headers = new Headers();
|
|
109
|
-
if (
|
|
110
|
-
headers.set('X-Databricks-Org-Id',
|
|
110
|
+
if (workspaceId !== undefined) {
|
|
111
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
111
112
|
}
|
|
112
113
|
headers.set('User-Agent', this.userAgent);
|
|
113
114
|
const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
|
|
114
115
|
const respBody = await executeHttpCall({
|
|
115
116
|
request: httpReq,
|
|
116
|
-
httpClient
|
|
117
|
+
httpClient,
|
|
117
118
|
logger: this.logger,
|
|
118
119
|
});
|
|
119
120
|
resp = parseResponse(respBody, unmarshalDeleteDataVectorIndexResponseSchema);
|
|
@@ -126,18 +127,19 @@ export class VectorSearchClient {
|
|
|
126
127
|
}
|
|
127
128
|
/** Delete an AI Search endpoint. */
|
|
128
129
|
async deleteEndpoint(req, options) {
|
|
129
|
-
const
|
|
130
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
131
|
+
const url = `${host}/api/2.0/vector-search/endpoints/${req.name ?? ''}`;
|
|
130
132
|
let resp;
|
|
131
133
|
const call = async (callSignal) => {
|
|
132
134
|
const headers = new Headers();
|
|
133
|
-
if (
|
|
134
|
-
headers.set('X-Databricks-Org-Id',
|
|
135
|
+
if (workspaceId !== undefined) {
|
|
136
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
135
137
|
}
|
|
136
138
|
headers.set('User-Agent', this.userAgent);
|
|
137
139
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
138
140
|
const respBody = await executeHttpCall({
|
|
139
141
|
request: httpReq,
|
|
140
|
-
httpClient
|
|
142
|
+
httpClient,
|
|
141
143
|
logger: this.logger,
|
|
142
144
|
});
|
|
143
145
|
resp = parseResponse(respBody, unmarshalDeleteEndpointResponseSchema);
|
|
@@ -150,18 +152,19 @@ export class VectorSearchClient {
|
|
|
150
152
|
}
|
|
151
153
|
/** Delete an index. */
|
|
152
154
|
async deleteVectorIndex(req, options) {
|
|
153
|
-
const
|
|
155
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
156
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}`;
|
|
154
157
|
let resp;
|
|
155
158
|
const call = async (callSignal) => {
|
|
156
159
|
const headers = new Headers();
|
|
157
|
-
if (
|
|
158
|
-
headers.set('X-Databricks-Org-Id',
|
|
160
|
+
if (workspaceId !== undefined) {
|
|
161
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
159
162
|
}
|
|
160
163
|
headers.set('User-Agent', this.userAgent);
|
|
161
164
|
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
162
165
|
const respBody = await executeHttpCall({
|
|
163
166
|
request: httpReq,
|
|
164
|
-
httpClient
|
|
167
|
+
httpClient,
|
|
165
168
|
logger: this.logger,
|
|
166
169
|
});
|
|
167
170
|
resp = parseResponse(respBody, unmarshalDeleteVectorIndexResponseSchema);
|
|
@@ -174,18 +177,19 @@ export class VectorSearchClient {
|
|
|
174
177
|
}
|
|
175
178
|
/** Get details for a single AI Search endpoint. */
|
|
176
179
|
async getEndpoint(req, options) {
|
|
177
|
-
const
|
|
180
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
181
|
+
const url = `${host}/api/2.0/vector-search/endpoints/${req.name ?? ''}`;
|
|
178
182
|
let resp;
|
|
179
183
|
const call = async (callSignal) => {
|
|
180
184
|
const headers = new Headers();
|
|
181
|
-
if (
|
|
182
|
-
headers.set('X-Databricks-Org-Id',
|
|
185
|
+
if (workspaceId !== undefined) {
|
|
186
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
183
187
|
}
|
|
184
188
|
headers.set('User-Agent', this.userAgent);
|
|
185
189
|
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
186
190
|
const respBody = await executeHttpCall({
|
|
187
191
|
request: httpReq,
|
|
188
|
-
httpClient
|
|
192
|
+
httpClient,
|
|
189
193
|
logger: this.logger,
|
|
190
194
|
});
|
|
191
195
|
resp = parseResponse(respBody, unmarshalEndpointSchema);
|
|
@@ -198,7 +202,8 @@ export class VectorSearchClient {
|
|
|
198
202
|
}
|
|
199
203
|
/** Get an index. */
|
|
200
204
|
async getVectorIndex(req, options) {
|
|
201
|
-
const
|
|
205
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
206
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}`;
|
|
202
207
|
const params = new URLSearchParams();
|
|
203
208
|
if (req.ensureRerankerCompatible !== undefined) {
|
|
204
209
|
params.append('ensure_reranker_compatible', String(req.ensureRerankerCompatible));
|
|
@@ -208,14 +213,14 @@ export class VectorSearchClient {
|
|
|
208
213
|
let resp;
|
|
209
214
|
const call = async (callSignal) => {
|
|
210
215
|
const headers = new Headers();
|
|
211
|
-
if (
|
|
212
|
-
headers.set('X-Databricks-Org-Id',
|
|
216
|
+
if (workspaceId !== undefined) {
|
|
217
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
213
218
|
}
|
|
214
219
|
headers.set('User-Agent', this.userAgent);
|
|
215
220
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
216
221
|
const respBody = await executeHttpCall({
|
|
217
222
|
request: httpReq,
|
|
218
|
-
httpClient
|
|
223
|
+
httpClient,
|
|
219
224
|
logger: this.logger,
|
|
220
225
|
});
|
|
221
226
|
resp = parseResponse(respBody, unmarshalVectorIndexSchema);
|
|
@@ -228,7 +233,8 @@ export class VectorSearchClient {
|
|
|
228
233
|
}
|
|
229
234
|
/** List all AI Search endpoints in the workspace. */
|
|
230
235
|
async listEndpoint(req, options) {
|
|
231
|
-
const
|
|
236
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
237
|
+
const url = `${host}/api/2.0/vector-search/endpoints`;
|
|
232
238
|
const params = new URLSearchParams();
|
|
233
239
|
if (req.pageToken !== undefined) {
|
|
234
240
|
params.append('page_token', req.pageToken);
|
|
@@ -238,14 +244,14 @@ export class VectorSearchClient {
|
|
|
238
244
|
let resp;
|
|
239
245
|
const call = async (callSignal) => {
|
|
240
246
|
const headers = new Headers();
|
|
241
|
-
if (
|
|
242
|
-
headers.set('X-Databricks-Org-Id',
|
|
247
|
+
if (workspaceId !== undefined) {
|
|
248
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
243
249
|
}
|
|
244
250
|
headers.set('User-Agent', this.userAgent);
|
|
245
251
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
246
252
|
const respBody = await executeHttpCall({
|
|
247
253
|
request: httpReq,
|
|
248
|
-
httpClient
|
|
254
|
+
httpClient,
|
|
249
255
|
logger: this.logger,
|
|
250
256
|
});
|
|
251
257
|
resp = parseResponse(respBody, unmarshalListEndpointResponseSchema);
|
|
@@ -271,7 +277,8 @@ export class VectorSearchClient {
|
|
|
271
277
|
}
|
|
272
278
|
/** List all indexes in the given endpoint. */
|
|
273
279
|
async listVectorIndex(req, options) {
|
|
274
|
-
const
|
|
280
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
281
|
+
const url = `${host}/api/2.0/vector-search/indexes`;
|
|
275
282
|
const params = new URLSearchParams();
|
|
276
283
|
if (req.endpointName !== undefined) {
|
|
277
284
|
params.append('endpoint_name', req.endpointName);
|
|
@@ -284,14 +291,14 @@ export class VectorSearchClient {
|
|
|
284
291
|
let resp;
|
|
285
292
|
const call = async (callSignal) => {
|
|
286
293
|
const headers = new Headers();
|
|
287
|
-
if (
|
|
288
|
-
headers.set('X-Databricks-Org-Id',
|
|
294
|
+
if (workspaceId !== undefined) {
|
|
295
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
289
296
|
}
|
|
290
297
|
headers.set('User-Agent', this.userAgent);
|
|
291
298
|
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
292
299
|
const respBody = await executeHttpCall({
|
|
293
300
|
request: httpReq,
|
|
294
|
-
httpClient
|
|
301
|
+
httpClient,
|
|
295
302
|
logger: this.logger,
|
|
296
303
|
});
|
|
297
304
|
resp = parseResponse(respBody, unmarshalListVectorIndexResponseSchema);
|
|
@@ -317,19 +324,20 @@ export class VectorSearchClient {
|
|
|
317
324
|
}
|
|
318
325
|
/** Update an endpoint */
|
|
319
326
|
async patchEndpoint(req, options) {
|
|
320
|
-
const
|
|
327
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
328
|
+
const url = `${host}/api/2.0/vector-search/endpoints/${req.name ?? ''}`;
|
|
321
329
|
const body = marshalRequest(req, marshalPatchEndpointRequestSchema);
|
|
322
330
|
let resp;
|
|
323
331
|
const call = async (callSignal) => {
|
|
324
332
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
325
|
-
if (
|
|
326
|
-
headers.set('X-Databricks-Org-Id',
|
|
333
|
+
if (workspaceId !== undefined) {
|
|
334
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
327
335
|
}
|
|
328
336
|
headers.set('User-Agent', this.userAgent);
|
|
329
337
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
330
338
|
const respBody = await executeHttpCall({
|
|
331
339
|
request: httpReq,
|
|
332
|
-
httpClient
|
|
340
|
+
httpClient,
|
|
333
341
|
logger: this.logger,
|
|
334
342
|
});
|
|
335
343
|
resp = parseResponse(respBody, unmarshalEndpointSchema);
|
|
@@ -342,19 +350,20 @@ export class VectorSearchClient {
|
|
|
342
350
|
}
|
|
343
351
|
/** Update the budget policy of an endpoint */
|
|
344
352
|
async patchEndpointBudgetPolicy(req, options) {
|
|
345
|
-
const
|
|
353
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
354
|
+
const url = `${host}/api/2.0/vector-search/endpoints/${req.name ?? ''}/budget-policy`;
|
|
346
355
|
const body = marshalRequest(req, marshalPatchEndpointBudgetPolicyRequestSchema);
|
|
347
356
|
let resp;
|
|
348
357
|
const call = async (callSignal) => {
|
|
349
358
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
350
|
-
if (
|
|
351
|
-
headers.set('X-Databricks-Org-Id',
|
|
359
|
+
if (workspaceId !== undefined) {
|
|
360
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
352
361
|
}
|
|
353
362
|
headers.set('User-Agent', this.userAgent);
|
|
354
363
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
355
364
|
const respBody = await executeHttpCall({
|
|
356
365
|
request: httpReq,
|
|
357
|
-
httpClient
|
|
366
|
+
httpClient,
|
|
358
367
|
logger: this.logger,
|
|
359
368
|
});
|
|
360
369
|
resp = parseResponse(respBody, unmarshalPatchEndpointBudgetPolicyResponseSchema);
|
|
@@ -367,19 +376,20 @@ export class VectorSearchClient {
|
|
|
367
376
|
}
|
|
368
377
|
/** Query the specified vector index. */
|
|
369
378
|
async queryVectorIndex(req, options) {
|
|
370
|
-
const
|
|
379
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
380
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}/query`;
|
|
371
381
|
const body = marshalRequest(req, marshalQueryVectorIndexRequestSchema);
|
|
372
382
|
let resp;
|
|
373
383
|
const call = async (callSignal) => {
|
|
374
384
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
375
|
-
if (
|
|
376
|
-
headers.set('X-Databricks-Org-Id',
|
|
385
|
+
if (workspaceId !== undefined) {
|
|
386
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
377
387
|
}
|
|
378
388
|
headers.set('User-Agent', this.userAgent);
|
|
379
389
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
380
390
|
const respBody = await executeHttpCall({
|
|
381
391
|
request: httpReq,
|
|
382
|
-
httpClient
|
|
392
|
+
httpClient,
|
|
383
393
|
logger: this.logger,
|
|
384
394
|
});
|
|
385
395
|
resp = parseResponse(respBody, unmarshalQueryVectorIndexResponseSchema);
|
|
@@ -392,19 +402,20 @@ export class VectorSearchClient {
|
|
|
392
402
|
}
|
|
393
403
|
/** Use `next_page_token` returned from previous `QueryVectorIndex` or `QueryVectorIndexNextPage` request to fetch next page of results. */
|
|
394
404
|
async queryVectorIndexNextPage(req, options) {
|
|
395
|
-
const
|
|
405
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
406
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}/query-next-page`;
|
|
396
407
|
const body = marshalRequest(req, marshalQueryVectorIndexNextPageRequestSchema);
|
|
397
408
|
let resp;
|
|
398
409
|
const call = async (callSignal) => {
|
|
399
410
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
400
|
-
if (
|
|
401
|
-
headers.set('X-Databricks-Org-Id',
|
|
411
|
+
if (workspaceId !== undefined) {
|
|
412
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
402
413
|
}
|
|
403
414
|
headers.set('User-Agent', this.userAgent);
|
|
404
415
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
405
416
|
const respBody = await executeHttpCall({
|
|
406
417
|
request: httpReq,
|
|
407
|
-
httpClient
|
|
418
|
+
httpClient,
|
|
408
419
|
logger: this.logger,
|
|
409
420
|
});
|
|
410
421
|
resp = parseResponse(respBody, unmarshalQueryVectorIndexResponseSchema);
|
|
@@ -417,19 +428,20 @@ export class VectorSearchClient {
|
|
|
417
428
|
}
|
|
418
429
|
/** Retrieve user-visible metrics for an endpoint */
|
|
419
430
|
async retrieveUserVisibleMetrics(req, options) {
|
|
420
|
-
const
|
|
431
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
432
|
+
const url = `${host}/api/2.0/vector-search/endpoints/${req.name ?? ''}/metrics`;
|
|
421
433
|
const body = marshalRequest(req, marshalRetrieveUserVisibleMetricsRequestSchema);
|
|
422
434
|
let resp;
|
|
423
435
|
const call = async (callSignal) => {
|
|
424
436
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
425
|
-
if (
|
|
426
|
-
headers.set('X-Databricks-Org-Id',
|
|
437
|
+
if (workspaceId !== undefined) {
|
|
438
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
427
439
|
}
|
|
428
440
|
headers.set('User-Agent', this.userAgent);
|
|
429
441
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
430
442
|
const respBody = await executeHttpCall({
|
|
431
443
|
request: httpReq,
|
|
432
|
-
httpClient
|
|
444
|
+
httpClient,
|
|
433
445
|
logger: this.logger,
|
|
434
446
|
});
|
|
435
447
|
resp = parseResponse(respBody, unmarshalRetrieveUserVisibleMetricsResponseSchema);
|
|
@@ -442,19 +454,20 @@ export class VectorSearchClient {
|
|
|
442
454
|
}
|
|
443
455
|
/** Scan the specified vector index and return the first `num_results` entries after the exclusive `primary_key`. */
|
|
444
456
|
async scanVectorIndex(req, options) {
|
|
445
|
-
const
|
|
457
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
458
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}/scan`;
|
|
446
459
|
const body = marshalRequest(req, marshalScanVectorIndexRequestSchema);
|
|
447
460
|
let resp;
|
|
448
461
|
const call = async (callSignal) => {
|
|
449
462
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
450
|
-
if (
|
|
451
|
-
headers.set('X-Databricks-Org-Id',
|
|
463
|
+
if (workspaceId !== undefined) {
|
|
464
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
452
465
|
}
|
|
453
466
|
headers.set('User-Agent', this.userAgent);
|
|
454
467
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
455
468
|
const respBody = await executeHttpCall({
|
|
456
469
|
request: httpReq,
|
|
457
|
-
httpClient
|
|
470
|
+
httpClient,
|
|
458
471
|
logger: this.logger,
|
|
459
472
|
});
|
|
460
473
|
resp = parseResponse(respBody, unmarshalScanVectorIndexResponseSchema);
|
|
@@ -467,19 +480,20 @@ export class VectorSearchClient {
|
|
|
467
480
|
}
|
|
468
481
|
/** Triggers a synchronization process for a specified vector index. */
|
|
469
482
|
async syncVectorIndex(req, options) {
|
|
470
|
-
const
|
|
483
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
484
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}/sync`;
|
|
471
485
|
const body = marshalRequest(req, marshalSyncVectorIndexRequestSchema);
|
|
472
486
|
let resp;
|
|
473
487
|
const call = async (callSignal) => {
|
|
474
488
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
475
|
-
if (
|
|
476
|
-
headers.set('X-Databricks-Org-Id',
|
|
489
|
+
if (workspaceId !== undefined) {
|
|
490
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
477
491
|
}
|
|
478
492
|
headers.set('User-Agent', this.userAgent);
|
|
479
493
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
480
494
|
const respBody = await executeHttpCall({
|
|
481
495
|
request: httpReq,
|
|
482
|
-
httpClient
|
|
496
|
+
httpClient,
|
|
483
497
|
logger: this.logger,
|
|
484
498
|
});
|
|
485
499
|
resp = parseResponse(respBody, unmarshalSyncVectorIndexResponseSchema);
|
|
@@ -492,19 +506,20 @@ export class VectorSearchClient {
|
|
|
492
506
|
}
|
|
493
507
|
/** Update the custom tags of an endpoint. */
|
|
494
508
|
async updateEndpointCustomTags(req, options) {
|
|
495
|
-
const
|
|
509
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
510
|
+
const url = `${host}/api/2.0/vector-search/endpoints/${req.name ?? ''}/tags`;
|
|
496
511
|
const body = marshalRequest(req, marshalUpdateEndpointCustomTagsRequestSchema);
|
|
497
512
|
let resp;
|
|
498
513
|
const call = async (callSignal) => {
|
|
499
514
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
500
|
-
if (
|
|
501
|
-
headers.set('X-Databricks-Org-Id',
|
|
515
|
+
if (workspaceId !== undefined) {
|
|
516
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
502
517
|
}
|
|
503
518
|
headers.set('User-Agent', this.userAgent);
|
|
504
519
|
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
505
520
|
const respBody = await executeHttpCall({
|
|
506
521
|
request: httpReq,
|
|
507
|
-
httpClient
|
|
522
|
+
httpClient,
|
|
508
523
|
logger: this.logger,
|
|
509
524
|
});
|
|
510
525
|
resp = parseResponse(respBody, unmarshalUpdateEndpointCustomTagsResponseSchema);
|
|
@@ -517,19 +532,20 @@ export class VectorSearchClient {
|
|
|
517
532
|
}
|
|
518
533
|
/** Handles the upserting of data into a specified vector index. */
|
|
519
534
|
async upsertDataVectorIndex(req, options) {
|
|
520
|
-
const
|
|
535
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
536
|
+
const url = `${host}/api/2.0/vector-search/indexes/${req.name ?? ''}/upsert-data`;
|
|
521
537
|
const body = marshalRequest(req, marshalUpsertDataVectorIndexRequestSchema);
|
|
522
538
|
let resp;
|
|
523
539
|
const call = async (callSignal) => {
|
|
524
540
|
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
525
|
-
if (
|
|
526
|
-
headers.set('X-Databricks-Org-Id',
|
|
541
|
+
if (workspaceId !== undefined) {
|
|
542
|
+
headers.set('X-Databricks-Org-Id', workspaceId);
|
|
527
543
|
}
|
|
528
544
|
headers.set('User-Agent', this.userAgent);
|
|
529
545
|
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
530
546
|
const respBody = await executeHttpCall({
|
|
531
547
|
request: httpReq,
|
|
532
|
-
httpClient
|
|
548
|
+
httpClient,
|
|
533
549
|
logger: this.logger,
|
|
534
550
|
});
|
|
535
551
|
resp = parseResponse(respBody, unmarshalUpsertDataVectorIndexResponseSchema);
|