@dbx-tools/model 0.1.21 → 0.1.23

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/serving.ts +28 -0
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.1.21",
17
- "@dbx-tools/shared-core": "0.1.21",
18
- "@dbx-tools/shared-model": "0.1.21"
16
+ "@dbx-tools/appkit": "0.1.23",
17
+ "@dbx-tools/shared-model": "0.1.23",
18
+ "@dbx-tools/shared-core": "0.1.23"
19
19
  },
20
20
  "main": "index.ts",
21
21
  "license": "UNLICENSED",
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
- "version": "0.1.21",
25
+ "version": "0.1.23",
26
26
  "types": "index.ts",
27
27
  "type": "module",
28
28
  "exports": {
package/src/serving.ts CHANGED
@@ -22,6 +22,7 @@
22
22
  import { error, log, string } from "@dbx-tools/shared-core";
23
23
  import {
24
24
  classify,
25
+ display,
25
26
  model,
26
27
  type ModelProfile,
27
28
  type ServingEndpointSummary,
@@ -124,6 +125,9 @@ export async function listServingEndpointsUncached(
124
125
  const profile = extractProfile(ep);
125
126
  out.push({
126
127
  name: ep.name,
128
+ // Prefer a Databricks-provided human name (a display-name tag or an
129
+ // external-model name); else derive a title-cased label from the id.
130
+ displayName: display.toModelDisplayName(ep.name, providedDisplayName(ep)),
127
131
  ...(ep.task !== undefined ? { task: ep.task } : {}),
128
132
  ...(ep.state?.ready !== undefined ? { state: String(ep.state.ready) } : {}),
129
133
  ...(ep.description !== undefined ? { description: ep.description } : {}),
@@ -133,6 +137,30 @@ export async function listServingEndpointsUncached(
133
137
  return out;
134
138
  }
135
139
 
140
+ /**
141
+ * Pull a Databricks-provided human name off a serving endpoint, if any:
142
+ * a `display_name` / `displayName` / `name` tag first, then an
143
+ * external-model `name` from the served-entity config. Returns `null`
144
+ * when the endpoint carries no explicit name (the common case for
145
+ * Foundation Model API endpoints), so the caller falls back to deriving
146
+ * one from the id.
147
+ */
148
+ function providedDisplayName(ep: {
149
+ tags?: Array<{ key: string; value?: string }>;
150
+ config?: { served_entities?: Array<{ external_model?: { name?: string } }> };
151
+ }): string | null {
152
+ const tag = ep.tags?.find(
153
+ (t) => t.key === "display_name" || t.key === "displayName" || t.key === "name",
154
+ );
155
+ const fromTag = string.trimToNull(tag?.value);
156
+ if (fromTag) return fromTag;
157
+ for (const entity of ep.config?.served_entities ?? []) {
158
+ const external = string.trimToNull(entity.external_model?.name);
159
+ if (external) return external;
160
+ }
161
+ return null;
162
+ }
163
+
136
164
  async function fetchEndpoints(client: WorkspaceClientLike): Promise<ServingEndpointSummary[]> {
137
165
  const startedAt = Date.now();
138
166
  const out = await listServingEndpointsUncached(client);