@dbx-tools/model 0.3.28 → 0.3.30
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 +11 -2
- package/package.json +4 -4
- package/src/invoke.ts +13 -0
package/README.md
CHANGED
|
@@ -172,6 +172,15 @@ rather than the SDK's typed `servingEndpoints.query`. Mint `authHeaders()` per
|
|
|
172
172
|
request: the SDK refreshes the underlying token as it nears expiry, so you never
|
|
173
173
|
track lifetimes yourself.
|
|
174
174
|
|
|
175
|
+
Every serving path this repo talks to is a constant here, with a matching URL
|
|
176
|
+
builder: `INVOCATIONS_SUFFIX` / `invocationsUrl()`, `RESPONSES_PATH` /
|
|
177
|
+
`responsesUrl()`, `OPEN_RESPONSES_PATH` / `openResponsesUrl()`, and
|
|
178
|
+
`CHAT_COMPLETIONS_PATH` / `chatCompletionsUrl()`. Import one instead of writing a
|
|
179
|
+
`/serving-endpoints/...` literal in a consumer: which path a model can accept is
|
|
180
|
+
a property of the model (see `isResponsesOnly()` and `responsesUpstreamUrl()`),
|
|
181
|
+
so a hard-coded string in one package silently diverges when that routing
|
|
182
|
+
changes.
|
|
183
|
+
|
|
175
184
|
## Use Static Fallbacks
|
|
176
185
|
|
|
177
186
|
```ts
|
|
@@ -192,8 +201,8 @@ policy decisions; fallbacks are a last resort.
|
|
|
192
201
|
resolver functions.
|
|
193
202
|
- `serving` - Databricks serving-endpoint listing, cache management, fuzzy
|
|
194
203
|
search, and endpoint-id resolution.
|
|
195
|
-
- `invoke` -
|
|
196
|
-
calling an endpoint over raw HTTP.
|
|
204
|
+
- `invoke` - serving-path constants, URL construction, and per-request auth
|
|
205
|
+
headers for calling an endpoint over raw HTTP.
|
|
197
206
|
- `classes` - model-class parsing, ordering, and class-ceiling helpers.
|
|
198
207
|
- `fallback` - static fallback model ids per class.
|
|
199
208
|
|
package/package.json
CHANGED
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@databricks/appkit": "^0.43.0",
|
|
15
15
|
"fuse.js": "^7.4.2",
|
|
16
|
-
"@dbx-tools/appkit": "0.3.
|
|
17
|
-
"@dbx-tools/shared-
|
|
18
|
-
"@dbx-tools/shared-
|
|
16
|
+
"@dbx-tools/appkit": "0.3.30",
|
|
17
|
+
"@dbx-tools/shared-core": "0.3.30",
|
|
18
|
+
"@dbx-tools/shared-model": "0.3.30"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.ts",
|
|
21
21
|
"license": "UNLICENSED",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
-
"version": "0.3.
|
|
25
|
+
"version": "0.3.30",
|
|
26
26
|
"types": "index.ts",
|
|
27
27
|
"type": "module",
|
|
28
28
|
"exports": {
|
package/src/invoke.ts
CHANGED
|
@@ -38,6 +38,14 @@ export const RESPONSES_PATH = "serving-endpoints/responses";
|
|
|
38
38
|
*/
|
|
39
39
|
export const OPEN_RESPONSES_PATH = "serving-endpoints/open-responses";
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Workspace-level OpenAI Chat Completions path. Body carries `model` (endpoint
|
|
43
|
+
* id), unlike {@link invocationsUrl} which names the endpoint in the URL. Use
|
|
44
|
+
* this when the caller has a model id rather than a per-endpoint route - e.g.
|
|
45
|
+
* attaching a provider tool spec to whichever endpoint was resolved.
|
|
46
|
+
*/
|
|
47
|
+
export const CHAT_COMPLETIONS_PATH = "serving-endpoints/chat/completions";
|
|
48
|
+
|
|
41
49
|
/**
|
|
42
50
|
* The OpenAI-compatible chat-completions invocations URL for an endpoint id.
|
|
43
51
|
*
|
|
@@ -62,6 +70,11 @@ export function openResponsesUrl(host: string): string {
|
|
|
62
70
|
return new URL(OPEN_RESPONSES_PATH, host).toString();
|
|
63
71
|
}
|
|
64
72
|
|
|
73
|
+
/** Workspace OpenAI Chat Completions URL (`POST`, model in the body). */
|
|
74
|
+
export function chatCompletionsUrl(host: string): string {
|
|
75
|
+
return new URL(CHAT_COMPLETIONS_PATH, host).toString();
|
|
76
|
+
}
|
|
77
|
+
|
|
65
78
|
/**
|
|
66
79
|
* True when the endpoint is known to reject Chat Completions `/invocations`
|
|
67
80
|
* and require the Responses API (Codex models today). Callers should route
|