@databricks/sdk-modelservingquery 0.1.0-dev.2 → 0.1.0-dev.4
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/dist/v1/model.d.ts +19 -16
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +23 -23
- package/dist/v1/model.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 +6 -6
- package/src/v1/client.ts +0 -87
- package/src/v1/index.ts +0 -21
- package/src/v1/model.ts +0 -345
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/dist/v1/model.d.ts
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import type { JsonValue } from '@databricks/sdk-core/wkt';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
/** The role of the message. One of [system, user, assistant]. */
|
|
4
|
-
export declare
|
|
5
|
-
CHAT_MESSAGE_ROLE_UNSPECIFIED
|
|
6
|
-
SYSTEM
|
|
7
|
-
USER
|
|
8
|
-
ASSISTANT
|
|
9
|
-
}
|
|
4
|
+
export declare const ChatMessageRole: {
|
|
5
|
+
readonly CHAT_MESSAGE_ROLE_UNSPECIFIED: "CHAT_MESSAGE_ROLE_UNSPECIFIED";
|
|
6
|
+
readonly SYSTEM: "system";
|
|
7
|
+
readonly USER: "user";
|
|
8
|
+
readonly ASSISTANT: "assistant";
|
|
9
|
+
};
|
|
10
|
+
export type ChatMessageRole = (typeof ChatMessageRole)[keyof typeof ChatMessageRole] | (string & {});
|
|
10
11
|
/** This will always be 'embedding'. */
|
|
11
|
-
export declare
|
|
12
|
-
EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED
|
|
13
|
-
EMBEDDING
|
|
14
|
-
}
|
|
12
|
+
export declare const EmbeddingsV1ResponseEmbeddingElementObject: {
|
|
13
|
+
readonly EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED: "EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED";
|
|
14
|
+
readonly EMBEDDING: "embedding";
|
|
15
|
+
};
|
|
16
|
+
export type EmbeddingsV1ResponseEmbeddingElementObject = (typeof EmbeddingsV1ResponseEmbeddingElementObject)[keyof typeof EmbeddingsV1ResponseEmbeddingElementObject] | (string & {});
|
|
15
17
|
/**
|
|
16
18
|
* The type of object returned by the __external/foundation model__ serving endpoint, one of
|
|
17
19
|
* [text_completion, chat.completion, list (of embeddings)].
|
|
18
20
|
*/
|
|
19
|
-
export declare
|
|
20
|
-
QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED
|
|
21
|
-
TEXT_COMPLETION
|
|
22
|
-
CHAT_COMPLETION
|
|
23
|
-
LIST
|
|
24
|
-
}
|
|
21
|
+
export declare const QueryEndpointResponseObject: {
|
|
22
|
+
readonly QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED: "QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED";
|
|
23
|
+
readonly TEXT_COMPLETION: "text_completion";
|
|
24
|
+
readonly CHAT_COMPLETION: "chat.completion";
|
|
25
|
+
readonly LIST: "list";
|
|
26
|
+
};
|
|
27
|
+
export type QueryEndpointResponseObject = (typeof QueryEndpointResponseObject)[keyof typeof QueryEndpointResponseObject] | (string & {});
|
|
25
28
|
export interface ChatMessage {
|
|
26
29
|
/** The role of the message. One of [system, user, assistant]. */
|
|
27
30
|
role?: ChatMessageRole | undefined;
|
package/dist/v1/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAat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C;AAED,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,eAAO,MAAM,0BAA0B,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAQzD,CAAC;AAEN,eAAO,MAAM,mDAAmD,EAAE,CAAC,CAAC,OAAO,CAAC,oCAAoC,CAWzG,CAAC;AAER,eAAO,MAAM,wCAAwC,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAWnF,CAAC;AAER,eAAO,MAAM,oCAAoC,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAkC3E,CAAC;AAER,eAAO,MAAM,sCAAsC,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAe/E,CAAC;AAER,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,OAQpC,CAAC;AAEN,eAAO,MAAM,gCAAgC,EAAE,CAAC,CAAC,OAU5C,CAAC;AAEN,eAAO,MAAM,sCAAsC,EAAE,CAAC,CAAC,OAoClD,CAAC"}
|
package/dist/v1/model.js
CHANGED
|
@@ -9,33 +9,33 @@ const jsonValueSchema = z.lazy(() => z.union([
|
|
|
9
9
|
z.array(jsonValueSchema),
|
|
10
10
|
]));
|
|
11
11
|
/** The role of the message. One of [system, user, assistant]. */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
|
|
13
|
+
export const ChatMessageRole = {
|
|
14
|
+
CHAT_MESSAGE_ROLE_UNSPECIFIED: 'CHAT_MESSAGE_ROLE_UNSPECIFIED',
|
|
15
|
+
SYSTEM: 'system',
|
|
16
|
+
USER: 'user',
|
|
17
|
+
ASSISTANT: 'assistant',
|
|
18
|
+
};
|
|
19
19
|
/** This will always be 'embedding'. */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
|
|
21
|
+
export const EmbeddingsV1ResponseEmbeddingElementObject = {
|
|
22
|
+
EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED: 'EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED',
|
|
23
|
+
EMBEDDING: 'embedding',
|
|
24
|
+
};
|
|
25
25
|
/**
|
|
26
26
|
* The type of object returned by the __external/foundation model__ serving endpoint, one of
|
|
27
27
|
* [text_completion, chat.completion, list (of embeddings)].
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- Enum-style const object.
|
|
30
|
+
export const QueryEndpointResponseObject = {
|
|
31
|
+
QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED: 'QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED',
|
|
32
|
+
TEXT_COMPLETION: 'text_completion',
|
|
33
|
+
CHAT_COMPLETION: 'chat.completion',
|
|
34
|
+
LIST: 'list',
|
|
35
|
+
};
|
|
36
36
|
export const unmarshalChatMessageSchema = z
|
|
37
37
|
.object({
|
|
38
|
-
role: z.
|
|
38
|
+
role: z.string().optional(),
|
|
39
39
|
content: z.string().optional(),
|
|
40
40
|
})
|
|
41
41
|
.transform(d => ({
|
|
@@ -46,7 +46,7 @@ export const unmarshalEmbeddingsV1ResponseEmbeddingElementSchema = z
|
|
|
46
46
|
.object({
|
|
47
47
|
embedding: z.array(z.number()).optional(),
|
|
48
48
|
index: z.number().optional(),
|
|
49
|
-
object: z.
|
|
49
|
+
object: z.string().optional(),
|
|
50
50
|
})
|
|
51
51
|
.transform(d => ({
|
|
52
52
|
embedding: d.embedding,
|
|
@@ -79,7 +79,7 @@ export const unmarshalQueryEndpointResponseSchema = z
|
|
|
79
79
|
.union([z.number(), z.bigint()])
|
|
80
80
|
.transform(v => BigInt(v))
|
|
81
81
|
.optional(),
|
|
82
|
-
object: z.
|
|
82
|
+
object: z.string().optional(),
|
|
83
83
|
predictions: z.array(jsonValueSchema).optional(),
|
|
84
84
|
outputs: z.array(jsonValueSchema).optional(),
|
|
85
85
|
'served-model-name': z.string().optional(),
|
|
@@ -113,7 +113,7 @@ export const unmarshalV1ResponseChoiceElementSchema = z
|
|
|
113
113
|
}));
|
|
114
114
|
export const marshalChatMessageSchema = z
|
|
115
115
|
.object({
|
|
116
|
-
role: z.
|
|
116
|
+
role: z.string().optional(),
|
|
117
117
|
content: z.string().optional(),
|
|
118
118
|
})
|
|
119
119
|
.transform(d => ({
|
package/dist/v1/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,eAAe,GAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACxD,CAAC,CAAC,KAAK,CAAC;IACN,CAAC,CAAC,IAAI,EAAE;IACR,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC;IACrC,CAAC,CAAC,KAAK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AAO3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC,CASf;AA2BD,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,UAAU,CAAC,CA2BrB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,GACzC,WAAW,CASb;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAK1E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAEvE;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,eAAe,GACtB,IAAI,CAuBN"}
|
package/dist/v1/utils.js
CHANGED
|
@@ -79,7 +79,8 @@ export function buildHttpRequest(method, url, headers, signal, body) {
|
|
|
79
79
|
}
|
|
80
80
|
export function parseResponse(body, schema) {
|
|
81
81
|
const text = new TextDecoder().decode(body);
|
|
82
|
-
|
|
82
|
+
// 204 responses return an empty body; treat as `{}`.
|
|
83
|
+
const parsed = text === '' ? {} : jsonBigint.parse(text);
|
|
83
84
|
return schema.parse(parsed);
|
|
84
85
|
}
|
|
85
86
|
export function marshalRequest(data, schema) {
|
package/dist/v1/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AAQvD,OAAO,OAAO,MAAM,aAAa,CAAC;AAGlC,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,MAAM,UAAU,GAAG,OAAO,CAAC,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAC;AAQpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAA6C,EAC7C,OAAqB;IAErB,MAAM,IAAI,GAAY;QACpB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;QACjE,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,IAAI;YACxC,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC;QACF,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,IAAI,EAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;KAClE,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,IAAuC;IAEvC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,SAAS,CAAC;QACR,MAAM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AAK,QAAQ,EAAE,CAAC;QACrC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YAC1E,kBAAkB,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;SAAM,IACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/sdk-modelservingquery",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./v1": {
|
|
8
8
|
"types": "./dist/v1/index.d.ts",
|
|
9
|
-
"import": "./dist/v1/index.js"
|
|
9
|
+
"import": "./dist/v1/index.js",
|
|
10
|
+
"default": "./dist/v1/index.js"
|
|
10
11
|
}
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
13
14
|
"dist",
|
|
14
|
-
"src",
|
|
15
15
|
"LICENSE"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"author": "Databricks",
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@databricks/sdk-auth": ">=0.1.0-dev.
|
|
32
|
-
"@databricks/sdk-core": ">=0.1.0-dev.
|
|
33
|
-
"@databricks/sdk-options": ">=0.1.0-dev.
|
|
31
|
+
"@databricks/sdk-auth": ">=0.1.0-dev.5 <1.0.0",
|
|
32
|
+
"@databricks/sdk-core": ">=0.1.0-dev.6 <1.0.0",
|
|
33
|
+
"@databricks/sdk-options": ">=0.1.0-dev.5 <1.0.0",
|
|
34
34
|
"@js-temporal/polyfill": "^0.5.0",
|
|
35
35
|
"json-bigint": "^1.0.0",
|
|
36
36
|
"zod": "^4.3.6"
|
package/src/v1/client.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
-
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
5
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
6
|
-
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
7
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
8
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
-
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newHttpClient} from './transport';
|
|
11
|
-
import {
|
|
12
|
-
buildHttpRequest,
|
|
13
|
-
executeCall,
|
|
14
|
-
executeHttpCall,
|
|
15
|
-
marshalRequest,
|
|
16
|
-
parseResponse,
|
|
17
|
-
} from './utils';
|
|
18
|
-
import pkgJson from '../../package.json' with {type: 'json'};
|
|
19
|
-
import type {QueryEndpointInputRequest, QueryEndpointResponse} from './model';
|
|
20
|
-
import {
|
|
21
|
-
marshalQueryEndpointInputRequestSchema,
|
|
22
|
-
unmarshalQueryEndpointResponseSchema,
|
|
23
|
-
} from './model';
|
|
24
|
-
|
|
25
|
-
// Package identity segment for this client to be used in the User-Agent header.
|
|
26
|
-
const PACKAGE_SEGMENT = {
|
|
27
|
-
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
28
|
-
value: pkgJson.version,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export class ModelServingQueryClient {
|
|
32
|
-
private readonly host: string;
|
|
33
|
-
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
34
|
-
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
35
|
-
// request.
|
|
36
|
-
private readonly workspaceId: string | undefined;
|
|
37
|
-
private readonly httpClient: HttpClient;
|
|
38
|
-
private readonly logger: Logger;
|
|
39
|
-
// User-Agent header value. Composed once at construction from
|
|
40
|
-
// createDefault() merged with this package's identity and the active
|
|
41
|
-
// credential's name.
|
|
42
|
-
private readonly userAgent: string;
|
|
43
|
-
|
|
44
|
-
constructor(options: ClientOptions) {
|
|
45
|
-
if (options.host === undefined) {
|
|
46
|
-
throw new Error('Host is required.');
|
|
47
|
-
}
|
|
48
|
-
this.host = options.host.replace(/\/$/, '');
|
|
49
|
-
this.workspaceId = options.workspaceId;
|
|
50
|
-
this.logger = options.logger ?? new NoOpLogger();
|
|
51
|
-
const info = createDefault()
|
|
52
|
-
.with(PACKAGE_SEGMENT)
|
|
53
|
-
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
54
|
-
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
55
|
-
this.userAgent = info.toString();
|
|
56
|
-
this.httpClient = newHttpClient(options);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** Query a serving endpoint */
|
|
60
|
-
async query(
|
|
61
|
-
req: QueryEndpointInputRequest,
|
|
62
|
-
options?: CallOptions
|
|
63
|
-
): Promise<QueryEndpointResponse> {
|
|
64
|
-
const url = `${this.host}/api/serving-endpoints/${req.name ?? ''}/invocations`;
|
|
65
|
-
const body = marshalRequest(req, marshalQueryEndpointInputRequestSchema);
|
|
66
|
-
let resp: QueryEndpointResponse | undefined;
|
|
67
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
68
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
69
|
-
if (this.workspaceId !== undefined) {
|
|
70
|
-
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
71
|
-
}
|
|
72
|
-
headers.set('User-Agent', this.userAgent);
|
|
73
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
74
|
-
const respBody = await executeHttpCall({
|
|
75
|
-
request: httpReq,
|
|
76
|
-
httpClient: this.httpClient,
|
|
77
|
-
logger: this.logger,
|
|
78
|
-
});
|
|
79
|
-
resp = parseResponse(respBody, unmarshalQueryEndpointResponseSchema);
|
|
80
|
-
};
|
|
81
|
-
await executeCall(call, options);
|
|
82
|
-
if (resp === undefined) {
|
|
83
|
-
throw new Error('operation completed without a result.');
|
|
84
|
-
}
|
|
85
|
-
return resp;
|
|
86
|
-
}
|
|
87
|
-
}
|
package/src/v1/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
export {ModelServingQueryClient} from './client';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
ChatMessageRole,
|
|
7
|
-
EmbeddingsV1ResponseEmbeddingElementObject,
|
|
8
|
-
QueryEndpointResponseObject,
|
|
9
|
-
} from './model';
|
|
10
|
-
|
|
11
|
-
export type {
|
|
12
|
-
ChatMessage,
|
|
13
|
-
DataframeSplitInput,
|
|
14
|
-
EmbeddingsV1ResponseEmbeddingElement,
|
|
15
|
-
ExternalModelUsageElement,
|
|
16
|
-
QueryEndpointInputRequest,
|
|
17
|
-
QueryEndpointInputRequest_ExtraParamsEntry,
|
|
18
|
-
QueryEndpointInputRequest_UsageContextEntry,
|
|
19
|
-
QueryEndpointResponse,
|
|
20
|
-
V1ResponseChoiceElement,
|
|
21
|
-
} from './model';
|
package/src/v1/model.ts
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import type {JsonValue} from '@databricks/sdk-core/wkt';
|
|
4
|
-
import {z} from 'zod';
|
|
5
|
-
|
|
6
|
-
const jsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>
|
|
7
|
-
z.union([
|
|
8
|
-
z.null(),
|
|
9
|
-
z.number(),
|
|
10
|
-
z.string(),
|
|
11
|
-
z.boolean(),
|
|
12
|
-
z.record(z.string(), jsonValueSchema),
|
|
13
|
-
z.array(jsonValueSchema),
|
|
14
|
-
])
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
/** The role of the message. One of [system, user, assistant]. */
|
|
18
|
-
export enum ChatMessageRole {
|
|
19
|
-
CHAT_MESSAGE_ROLE_UNSPECIFIED = 'CHAT_MESSAGE_ROLE_UNSPECIFIED',
|
|
20
|
-
SYSTEM = 'system',
|
|
21
|
-
USER = 'user',
|
|
22
|
-
ASSISTANT = 'assistant',
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** This will always be 'embedding'. */
|
|
26
|
-
export enum EmbeddingsV1ResponseEmbeddingElementObject {
|
|
27
|
-
EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED = 'EMBEDDINGS_V1_RESPONSE_EMBEDDING_ELEMENT_OBJECT_UNSPECIFIED',
|
|
28
|
-
EMBEDDING = 'embedding',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The type of object returned by the __external/foundation model__ serving endpoint, one of
|
|
33
|
-
* [text_completion, chat.completion, list (of embeddings)].
|
|
34
|
-
*/
|
|
35
|
-
export enum QueryEndpointResponseObject {
|
|
36
|
-
QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED = 'QUERY_ENDPOINT_RESPONSE_OBJECT_UNSPECIFIED',
|
|
37
|
-
TEXT_COMPLETION = 'text_completion',
|
|
38
|
-
CHAT_COMPLETION = 'chat.completion',
|
|
39
|
-
LIST = 'list',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface ChatMessage {
|
|
43
|
-
/** The role of the message. One of [system, user, assistant]. */
|
|
44
|
-
role?: ChatMessageRole | undefined;
|
|
45
|
-
/** The content of the message. */
|
|
46
|
-
content?: string | undefined;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface DataframeSplitInput {
|
|
50
|
-
/** Index array for the dataframe */
|
|
51
|
-
index?: number[] | undefined;
|
|
52
|
-
/** Columns array for the dataframe */
|
|
53
|
-
columns?: JsonValue[] | undefined;
|
|
54
|
-
/** Data array for the dataframe */
|
|
55
|
-
data?: JsonValue[] | undefined;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface EmbeddingsV1ResponseEmbeddingElement {
|
|
59
|
-
/** The embedding vector */
|
|
60
|
-
embedding?: number[] | undefined;
|
|
61
|
-
/** The index of the embedding in the response. */
|
|
62
|
-
index?: number | undefined;
|
|
63
|
-
/** This will always be 'embedding'. */
|
|
64
|
-
object?: EmbeddingsV1ResponseEmbeddingElementObject | undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface ExternalModelUsageElement {
|
|
68
|
-
/** The number of tokens in the prompt. */
|
|
69
|
-
promptTokens?: number | undefined;
|
|
70
|
-
/** The number of tokens in the chat/completions response. */
|
|
71
|
-
completionTokens?: number | undefined;
|
|
72
|
-
/** The total number of tokens in the prompt and response. */
|
|
73
|
-
totalTokens?: number | undefined;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface QueryEndpointInputRequest {
|
|
77
|
-
/** The name of the serving endpoint. This field is required and is provided via the path parameter. */
|
|
78
|
-
name?: string | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* The prompt string (or array of strings) field used ONLY for __completions external & foundation model__
|
|
81
|
-
* serving endpoints and should only be used with other completions query fields.
|
|
82
|
-
*/
|
|
83
|
-
prompt?: JsonValue | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* The input string (or array of strings) field used ONLY for __embeddings external & foundation model__
|
|
86
|
-
* serving endpoints and is the only field (along with extra_params if needed) used by embeddings queries.
|
|
87
|
-
*/
|
|
88
|
-
input?: JsonValue | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* The messages field used ONLY for __chat external & foundation model__ serving endpoints.
|
|
91
|
-
* This is an array of ChatMessage objects and should only be used with other chat query fields.
|
|
92
|
-
*/
|
|
93
|
-
messages?: ChatMessage[] | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* The temperature field used ONLY for __completions__ and __chat external & foundation model__ serving
|
|
96
|
-
* endpoints. This is a float between 0.0 and 2.0 with a default of 1.0 and should only be used with other
|
|
97
|
-
* chat/completions query fields.
|
|
98
|
-
*/
|
|
99
|
-
temperature?: number | undefined;
|
|
100
|
-
/**
|
|
101
|
-
* The stop sequences field used ONLY for __completions__ and __chat external & foundation model__ serving
|
|
102
|
-
* endpoints. This is a list of strings and should only be used with other chat/completions query fields.
|
|
103
|
-
*/
|
|
104
|
-
stop?: string[] | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* The max tokens field used ONLY for __completions__ and __chat external & foundation model__ serving
|
|
107
|
-
* endpoints. This is an integer and should only be used with other chat/completions query fields.
|
|
108
|
-
*/
|
|
109
|
-
maxTokens?: number | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* The n (number of candidates) field used ONLY for __completions__ and __chat external & foundation model__
|
|
112
|
-
* serving endpoints. This is an integer between 1 and 5 with a default of 1 and should only be used with
|
|
113
|
-
* other chat/completions query fields.
|
|
114
|
-
*/
|
|
115
|
-
n?: number | undefined;
|
|
116
|
-
/**
|
|
117
|
-
* The stream field used ONLY for __completions__ and __chat external & foundation model__ serving endpoints.
|
|
118
|
-
* This is a boolean defaulting to false and should only be used with other chat/completions query fields.
|
|
119
|
-
*/
|
|
120
|
-
stream?: boolean | undefined;
|
|
121
|
-
/**
|
|
122
|
-
* The extra parameters field used ONLY for __completions, chat,__ and __embeddings external & foundation
|
|
123
|
-
* model__ serving endpoints. This is a map of strings and should only be used with other external/foundation
|
|
124
|
-
* model query fields.
|
|
125
|
-
*/
|
|
126
|
-
extraParams?: Record<string, string> | undefined;
|
|
127
|
-
/** Pandas Dataframe input in the records orientation. */
|
|
128
|
-
dataframeRecords?: JsonValue[] | undefined;
|
|
129
|
-
/** Pandas Dataframe input in the split orientation. */
|
|
130
|
-
dataframeSplit?: DataframeSplitInput | undefined;
|
|
131
|
-
/** Tensor-based input in row format. */
|
|
132
|
-
instances?: JsonValue[] | undefined;
|
|
133
|
-
/** Tensor-based input in columnar format. */
|
|
134
|
-
inputs?: JsonValue | undefined;
|
|
135
|
-
/** Optional user-provided request identifier that will be recorded in the inference table and the usage tracking table. */
|
|
136
|
-
clientRequestId?: string | undefined;
|
|
137
|
-
/** Optional user-provided context that will be recorded in the usage tracking table. */
|
|
138
|
-
usageContext?: Record<string, string> | undefined;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
142
|
-
export interface QueryEndpointInputRequest_ExtraParamsEntry {
|
|
143
|
-
key?: string | undefined;
|
|
144
|
-
value?: string | undefined;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
|
|
148
|
-
export interface QueryEndpointInputRequest_UsageContextEntry {
|
|
149
|
-
key?: string | undefined;
|
|
150
|
-
value?: string | undefined;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface QueryEndpointResponse {
|
|
154
|
-
/** The list of choices returned by the __chat or completions external/foundation model__ serving endpoint. */
|
|
155
|
-
choices?: V1ResponseChoiceElement[] | undefined;
|
|
156
|
-
/** The list of the embeddings returned by the __embeddings external/foundation model__ serving endpoint. */
|
|
157
|
-
data?: EmbeddingsV1ResponseEmbeddingElement[] | undefined;
|
|
158
|
-
/**
|
|
159
|
-
* The name of the __external/foundation model__ used for querying. This is the name of the model that was
|
|
160
|
-
* specified in the endpoint config.
|
|
161
|
-
*/
|
|
162
|
-
model?: string | undefined;
|
|
163
|
-
/**
|
|
164
|
-
* The usage object that may be returned by the __external/foundation model__ serving endpoint. This
|
|
165
|
-
* contains information about the number of tokens used in the prompt and response.
|
|
166
|
-
*/
|
|
167
|
-
usage?: ExternalModelUsageElement | undefined;
|
|
168
|
-
/** The ID of the query that may be returned by a __completions or chat external/foundation model__ serving endpoint. */
|
|
169
|
-
id?: string | undefined;
|
|
170
|
-
/** The timestamp in seconds when the query was created in Unix time returned by a __completions or chat external/foundation model__ serving endpoint. */
|
|
171
|
-
created?: bigint | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* The type of object returned by the __external/foundation model__ serving endpoint, one of
|
|
174
|
-
* [text_completion, chat.completion, list (of embeddings)].
|
|
175
|
-
*/
|
|
176
|
-
object?: QueryEndpointResponseObject | undefined;
|
|
177
|
-
/** The predictions returned by the serving endpoint. */
|
|
178
|
-
predictions?: JsonValue[] | undefined;
|
|
179
|
-
/** The outputs of the feature serving endpoint. */
|
|
180
|
-
outputs?: JsonValue[] | undefined;
|
|
181
|
-
/** The name of the served model that served the request. This is useful when there are multiple models behind the same endpoint with traffic split. */
|
|
182
|
-
servedModelName?: string | undefined;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export interface V1ResponseChoiceElement {
|
|
186
|
-
/** The text response from the __completions__ endpoint. */
|
|
187
|
-
text?: string | undefined;
|
|
188
|
-
/** The message response from the __chat__ endpoint. */
|
|
189
|
-
message?: ChatMessage | undefined;
|
|
190
|
-
/** The index of the choice in the __chat or completions__ response. */
|
|
191
|
-
index?: number | undefined;
|
|
192
|
-
/** The finish reason returned by the endpoint. */
|
|
193
|
-
finishReason?: string | undefined;
|
|
194
|
-
/** The logprobs returned only by the __completions__ endpoint. */
|
|
195
|
-
logprobs?: number | undefined;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export const unmarshalChatMessageSchema: z.ZodType<ChatMessage> = z
|
|
199
|
-
.object({
|
|
200
|
-
role: z.enum(ChatMessageRole).optional(),
|
|
201
|
-
content: z.string().optional(),
|
|
202
|
-
})
|
|
203
|
-
.transform(d => ({
|
|
204
|
-
role: d.role,
|
|
205
|
-
content: d.content,
|
|
206
|
-
}));
|
|
207
|
-
|
|
208
|
-
export const unmarshalEmbeddingsV1ResponseEmbeddingElementSchema: z.ZodType<EmbeddingsV1ResponseEmbeddingElement> =
|
|
209
|
-
z
|
|
210
|
-
.object({
|
|
211
|
-
embedding: z.array(z.number()).optional(),
|
|
212
|
-
index: z.number().optional(),
|
|
213
|
-
object: z.enum(EmbeddingsV1ResponseEmbeddingElementObject).optional(),
|
|
214
|
-
})
|
|
215
|
-
.transform(d => ({
|
|
216
|
-
embedding: d.embedding,
|
|
217
|
-
index: d.index,
|
|
218
|
-
object: d.object,
|
|
219
|
-
}));
|
|
220
|
-
|
|
221
|
-
export const unmarshalExternalModelUsageElementSchema: z.ZodType<ExternalModelUsageElement> =
|
|
222
|
-
z
|
|
223
|
-
.object({
|
|
224
|
-
prompt_tokens: z.number().optional(),
|
|
225
|
-
completion_tokens: z.number().optional(),
|
|
226
|
-
total_tokens: z.number().optional(),
|
|
227
|
-
})
|
|
228
|
-
.transform(d => ({
|
|
229
|
-
promptTokens: d.prompt_tokens,
|
|
230
|
-
completionTokens: d.completion_tokens,
|
|
231
|
-
totalTokens: d.total_tokens,
|
|
232
|
-
}));
|
|
233
|
-
|
|
234
|
-
export const unmarshalQueryEndpointResponseSchema: z.ZodType<QueryEndpointResponse> =
|
|
235
|
-
z
|
|
236
|
-
.object({
|
|
237
|
-
choices: z
|
|
238
|
-
.array(z.lazy(() => unmarshalV1ResponseChoiceElementSchema))
|
|
239
|
-
.optional(),
|
|
240
|
-
data: z
|
|
241
|
-
.array(
|
|
242
|
-
z.lazy(() => unmarshalEmbeddingsV1ResponseEmbeddingElementSchema)
|
|
243
|
-
)
|
|
244
|
-
.optional(),
|
|
245
|
-
model: z.string().optional(),
|
|
246
|
-
usage: z.lazy(() => unmarshalExternalModelUsageElementSchema).optional(),
|
|
247
|
-
id: z.string().optional(),
|
|
248
|
-
created: z
|
|
249
|
-
.union([z.number(), z.bigint()])
|
|
250
|
-
.transform(v => BigInt(v))
|
|
251
|
-
.optional(),
|
|
252
|
-
object: z.enum(QueryEndpointResponseObject).optional(),
|
|
253
|
-
predictions: z.array(jsonValueSchema).optional(),
|
|
254
|
-
outputs: z.array(jsonValueSchema).optional(),
|
|
255
|
-
'served-model-name': z.string().optional(),
|
|
256
|
-
})
|
|
257
|
-
.transform(d => ({
|
|
258
|
-
choices: d.choices,
|
|
259
|
-
data: d.data,
|
|
260
|
-
model: d.model,
|
|
261
|
-
usage: d.usage,
|
|
262
|
-
id: d.id,
|
|
263
|
-
created: d.created,
|
|
264
|
-
object: d.object,
|
|
265
|
-
predictions: d.predictions,
|
|
266
|
-
outputs: d.outputs,
|
|
267
|
-
servedModelName: d['served-model-name'],
|
|
268
|
-
}));
|
|
269
|
-
|
|
270
|
-
export const unmarshalV1ResponseChoiceElementSchema: z.ZodType<V1ResponseChoiceElement> =
|
|
271
|
-
z
|
|
272
|
-
.object({
|
|
273
|
-
text: z.string().optional(),
|
|
274
|
-
message: z.lazy(() => unmarshalChatMessageSchema).optional(),
|
|
275
|
-
index: z.number().optional(),
|
|
276
|
-
finishReason: z.string().optional(),
|
|
277
|
-
logprobs: z.number().optional(),
|
|
278
|
-
})
|
|
279
|
-
.transform(d => ({
|
|
280
|
-
text: d.text,
|
|
281
|
-
message: d.message,
|
|
282
|
-
index: d.index,
|
|
283
|
-
finishReason: d.finishReason,
|
|
284
|
-
logprobs: d.logprobs,
|
|
285
|
-
}));
|
|
286
|
-
|
|
287
|
-
export const marshalChatMessageSchema: z.ZodType = z
|
|
288
|
-
.object({
|
|
289
|
-
role: z.enum(ChatMessageRole).optional(),
|
|
290
|
-
content: z.string().optional(),
|
|
291
|
-
})
|
|
292
|
-
.transform(d => ({
|
|
293
|
-
role: d.role,
|
|
294
|
-
content: d.content,
|
|
295
|
-
}));
|
|
296
|
-
|
|
297
|
-
export const marshalDataframeSplitInputSchema: z.ZodType = z
|
|
298
|
-
.object({
|
|
299
|
-
index: z.array(z.number()).optional(),
|
|
300
|
-
columns: z.array(jsonValueSchema).optional(),
|
|
301
|
-
data: z.array(jsonValueSchema).optional(),
|
|
302
|
-
})
|
|
303
|
-
.transform(d => ({
|
|
304
|
-
index: d.index,
|
|
305
|
-
columns: d.columns,
|
|
306
|
-
data: d.data,
|
|
307
|
-
}));
|
|
308
|
-
|
|
309
|
-
export const marshalQueryEndpointInputRequestSchema: z.ZodType = z
|
|
310
|
-
.object({
|
|
311
|
-
name: z.string().optional(),
|
|
312
|
-
prompt: jsonValueSchema.optional(),
|
|
313
|
-
input: jsonValueSchema.optional(),
|
|
314
|
-
messages: z.array(z.lazy(() => marshalChatMessageSchema)).optional(),
|
|
315
|
-
temperature: z.number().optional(),
|
|
316
|
-
stop: z.array(z.string()).optional(),
|
|
317
|
-
maxTokens: z.number().optional(),
|
|
318
|
-
n: z.number().optional(),
|
|
319
|
-
stream: z.boolean().optional(),
|
|
320
|
-
extraParams: z.record(z.string(), z.string()).optional(),
|
|
321
|
-
dataframeRecords: z.array(jsonValueSchema).optional(),
|
|
322
|
-
dataframeSplit: z.lazy(() => marshalDataframeSplitInputSchema).optional(),
|
|
323
|
-
instances: z.array(jsonValueSchema).optional(),
|
|
324
|
-
inputs: jsonValueSchema.optional(),
|
|
325
|
-
clientRequestId: z.string().optional(),
|
|
326
|
-
usageContext: z.record(z.string(), z.string()).optional(),
|
|
327
|
-
})
|
|
328
|
-
.transform(d => ({
|
|
329
|
-
name: d.name,
|
|
330
|
-
prompt: d.prompt,
|
|
331
|
-
input: d.input,
|
|
332
|
-
messages: d.messages,
|
|
333
|
-
temperature: d.temperature,
|
|
334
|
-
stop: d.stop,
|
|
335
|
-
max_tokens: d.maxTokens,
|
|
336
|
-
n: d.n,
|
|
337
|
-
stream: d.stream,
|
|
338
|
-
extra_params: d.extraParams,
|
|
339
|
-
dataframe_records: d.dataframeRecords,
|
|
340
|
-
dataframe_split: d.dataframeSplit,
|
|
341
|
-
instances: d.instances,
|
|
342
|
-
inputs: d.inputs,
|
|
343
|
-
client_request_id: d.clientRequestId,
|
|
344
|
-
usage_context: d.usageContext,
|
|
345
|
-
}));
|
package/src/v1/transport.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import type {Credentials} from '@databricks/sdk-auth';
|
|
4
|
-
import {defaultCredentials} from '@databricks/sdk-auth/credentials';
|
|
5
|
-
import type {
|
|
6
|
-
HttpClient,
|
|
7
|
-
HttpRequest,
|
|
8
|
-
HttpResponse,
|
|
9
|
-
} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newFetchHttpClient} from '@databricks/sdk-core/http';
|
|
11
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
12
|
-
|
|
13
|
-
/** Creates a new HTTP client with the given options. */
|
|
14
|
-
export function newHttpClient(options?: ClientOptions): HttpClient {
|
|
15
|
-
const opts = options ?? {};
|
|
16
|
-
|
|
17
|
-
// If an HTTP client is provided, use it as-is. Throw if other options are
|
|
18
|
-
// also set, since they would be silently ignored.
|
|
19
|
-
if (opts.httpClient !== undefined) {
|
|
20
|
-
if (opts.credentials !== undefined || opts.timeout !== undefined) {
|
|
21
|
-
throw new Error(
|
|
22
|
-
'httpClient cannot be combined with credentials or timeout'
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
return opts.httpClient;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const credentials = opts.credentials ?? defaultCredentials();
|
|
29
|
-
|
|
30
|
-
const base = newFetchHttpClient();
|
|
31
|
-
let client: HttpClient = new AuthHttpClient(base, credentials);
|
|
32
|
-
|
|
33
|
-
if (opts.timeout !== undefined) {
|
|
34
|
-
client = new TimeoutHttpClient(client, opts.timeout);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return client;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Wraps an HttpClient and adds authentication headers to requests. */
|
|
41
|
-
class AuthHttpClient implements HttpClient {
|
|
42
|
-
constructor(
|
|
43
|
-
private readonly base: HttpClient,
|
|
44
|
-
private readonly credentials: Credentials
|
|
45
|
-
) {}
|
|
46
|
-
|
|
47
|
-
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
48
|
-
const authHeaders = await this.credentials.authHeaders();
|
|
49
|
-
// Do not modify the original request.
|
|
50
|
-
const headers = new Headers(request.headers);
|
|
51
|
-
for (const h of authHeaders) {
|
|
52
|
-
headers.set(h.key, h.value);
|
|
53
|
-
}
|
|
54
|
-
return this.base.send({...request, headers});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Wraps an HttpClient and applies a default timeout to requests. */
|
|
59
|
-
class TimeoutHttpClient implements HttpClient {
|
|
60
|
-
constructor(
|
|
61
|
-
private readonly base: HttpClient,
|
|
62
|
-
private readonly timeout: number
|
|
63
|
-
) {}
|
|
64
|
-
|
|
65
|
-
async send(request: HttpRequest): Promise<HttpResponse> {
|
|
66
|
-
const timeoutSignal = AbortSignal.timeout(this.timeout);
|
|
67
|
-
const signal =
|
|
68
|
-
request.signal !== undefined
|
|
69
|
-
? AbortSignal.any([request.signal, timeoutSignal])
|
|
70
|
-
: timeoutSignal;
|
|
71
|
-
return this.base.send({...request, signal});
|
|
72
|
-
}
|
|
73
|
-
}
|
package/src/v1/utils.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import type {Options} from '@databricks/sdk-core/ops';
|
|
4
|
-
import {execute} from '@databricks/sdk-core/ops';
|
|
5
|
-
import {ApiError} from '@databricks/sdk-core/apierror';
|
|
6
|
-
import type {
|
|
7
|
-
HttpClient,
|
|
8
|
-
HttpRequest,
|
|
9
|
-
HttpResponse,
|
|
10
|
-
} from '@databricks/sdk-core/http';
|
|
11
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
12
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
13
|
-
import JSONBig from 'json-bigint';
|
|
14
|
-
import type {z} from 'zod';
|
|
15
|
-
|
|
16
|
-
// JSON codec that preserves int64 precision. On the way in, large integer
|
|
17
|
-
// literals come back as bigint instead of being rounded to JS Number. On the
|
|
18
|
-
// way out, bigint values are emitted as raw JSON number digits.
|
|
19
|
-
const jsonBigint = JSONBig({useNativeBigInt: true});
|
|
20
|
-
|
|
21
|
-
export interface HttpCallOptions {
|
|
22
|
-
readonly request: HttpRequest;
|
|
23
|
-
readonly httpClient: HttpClient;
|
|
24
|
-
readonly logger: Logger;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Translates public CallOptions to the internal Options shape accepted by
|
|
29
|
-
* execute(). Even though the shapes match today, this isolates the public
|
|
30
|
-
* API from the executor's internal type so they can diverge.
|
|
31
|
-
*/
|
|
32
|
-
export async function executeCall(
|
|
33
|
-
call: (signal?: AbortSignal) => Promise<void>,
|
|
34
|
-
options?: CallOptions
|
|
35
|
-
): Promise<void> {
|
|
36
|
-
const opts: Options = {
|
|
37
|
-
...(options?.retrier !== undefined && {retrier: options.retrier}),
|
|
38
|
-
...(options?.rateLimiter !== undefined && {
|
|
39
|
-
rateLimiter: options.rateLimiter,
|
|
40
|
-
}),
|
|
41
|
-
...(options?.timeout !== undefined && {timeout: options.timeout}),
|
|
42
|
-
};
|
|
43
|
-
return execute(options?.signal, call, opts);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function readAll(
|
|
47
|
-
body: ReadableStream<Uint8Array> | null
|
|
48
|
-
): Promise<Uint8Array> {
|
|
49
|
-
if (body === null) {
|
|
50
|
-
return new Uint8Array(0);
|
|
51
|
-
}
|
|
52
|
-
const reader = body.getReader();
|
|
53
|
-
const chunks: Uint8Array[] = [];
|
|
54
|
-
for (;;) {
|
|
55
|
-
const {done, value} = await reader.read();
|
|
56
|
-
if (done) {
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
chunks.push(value);
|
|
60
|
-
}
|
|
61
|
-
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
62
|
-
const result = new Uint8Array(totalLength);
|
|
63
|
-
let offset = 0;
|
|
64
|
-
for (const chunk of chunks) {
|
|
65
|
-
result.set(chunk, offset);
|
|
66
|
-
offset += chunk.length;
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export async function executeHttpCall(
|
|
72
|
-
opts: HttpCallOptions
|
|
73
|
-
): Promise<Uint8Array> {
|
|
74
|
-
opts.logger.debug('HTTP request', {
|
|
75
|
-
method: opts.request.method,
|
|
76
|
-
url: opts.request.url,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
let resp: HttpResponse;
|
|
80
|
-
try {
|
|
81
|
-
resp = await opts.httpClient.send(opts.request);
|
|
82
|
-
} catch (e: unknown) {
|
|
83
|
-
opts.logger.debug('HTTP request failed');
|
|
84
|
-
throw e;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const body = await readAll(resp.body);
|
|
88
|
-
|
|
89
|
-
opts.logger.debug('HTTP response', {
|
|
90
|
-
statusCode: resp.statusCode,
|
|
91
|
-
body: new TextDecoder().decode(body),
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const apiErr = ApiError.fromHttpError(resp.statusCode, resp.headers, body);
|
|
95
|
-
if (apiErr !== undefined) {
|
|
96
|
-
throw apiErr;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return body;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function buildHttpRequest(
|
|
103
|
-
method: string,
|
|
104
|
-
url: string,
|
|
105
|
-
headers: Headers,
|
|
106
|
-
signal?: AbortSignal,
|
|
107
|
-
body?: string | ReadableStream<Uint8Array>
|
|
108
|
-
): HttpRequest {
|
|
109
|
-
const req: HttpRequest = {url, method, headers};
|
|
110
|
-
if (body !== undefined) {
|
|
111
|
-
req.body = body;
|
|
112
|
-
}
|
|
113
|
-
if (signal !== undefined) {
|
|
114
|
-
req.signal = signal;
|
|
115
|
-
}
|
|
116
|
-
return req;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T {
|
|
120
|
-
const text = new TextDecoder().decode(body);
|
|
121
|
-
const parsed: unknown = jsonBigint.parse(text);
|
|
122
|
-
return schema.parse(parsed);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function marshalRequest(data: unknown, schema: z.ZodType): string {
|
|
126
|
-
return jsonBigint.stringify(schema.parse(data));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function flattenQueryParams(
|
|
130
|
-
prefix: string,
|
|
131
|
-
value: unknown,
|
|
132
|
-
params: URLSearchParams
|
|
133
|
-
): void {
|
|
134
|
-
if (value === null || value === undefined) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (Array.isArray(value)) {
|
|
138
|
-
// arrays of objects are not yet supported
|
|
139
|
-
for (const item of value) {
|
|
140
|
-
params.append(prefix, String(item));
|
|
141
|
-
}
|
|
142
|
-
} else if (typeof value === 'object') {
|
|
143
|
-
for (const [key, val] of Object.entries(value as Record<string, unknown>)) {
|
|
144
|
-
flattenQueryParams(`${prefix}.${key}`, val, params);
|
|
145
|
-
}
|
|
146
|
-
} else if (
|
|
147
|
-
typeof value === 'string' ||
|
|
148
|
-
typeof value === 'number' ||
|
|
149
|
-
typeof value === 'boolean' ||
|
|
150
|
-
typeof value === 'bigint'
|
|
151
|
-
) {
|
|
152
|
-
params.append(prefix, String(value));
|
|
153
|
-
} else {
|
|
154
|
-
throw new Error(`Unsupported query parameter type: ${typeof value}`);
|
|
155
|
-
}
|
|
156
|
-
}
|