Skip to content

Commit e1068f6

Browse files
committed
fix: rename DATABRICKS_SERVING_ENDPOINT to DATABRICKS_SERVING_ENDPOINT_NAME in type generator
Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
1 parent 464e54e commit e1068f6

File tree

8 files changed

+139
-22
lines changed

8 files changed

+139
-22
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
// Auto-generated by AppKit - DO NOT EDIT
2+
// Generated from serving endpoint OpenAPI schemas
3+
import "@databricks/appkit";
4+
import "@databricks/appkit-ui/react";
5+
6+
declare module "@databricks/appkit" {
7+
interface ServingEndpointRegistry {
8+
default: {
9+
request: {
10+
messages?: {
11+
role?: "user" | "assistant";
12+
content?: string;
13+
}[];
14+
/** @openapi integer, nullable */
15+
n?: number | null;
16+
max_tokens?: number;
17+
/** @openapi double, nullable */
18+
top_p?: number | null;
19+
reasoning_effort?: "low" | "medium" | "high" | null;
20+
/** @openapi double, nullable */
21+
temperature?: number | null;
22+
stop?: string | string[] | null;
23+
};
24+
response: {
25+
model?: string;
26+
choices?: {
27+
index?: number;
28+
message?: {
29+
role?: "user" | "assistant";
30+
content?: string;
31+
};
32+
finish_reason?: string;
33+
}[];
34+
usage?: {
35+
prompt_tokens?: number;
36+
completion_tokens?: number;
37+
total_tokens?: number;
38+
} | null;
39+
object?: string;
40+
id?: string;
41+
created?: number;
42+
};
43+
chunk: {
44+
model?: string;
45+
choices?: {
46+
index?: number;
47+
delta?: {
48+
role?: "user" | "assistant";
49+
content?: string;
50+
};
51+
finish_reason?: string | null;
52+
}[];
53+
object?: string;
54+
id?: string;
55+
created?: number;
56+
};
57+
};
58+
}
59+
}
60+
61+
declare module "@databricks/appkit-ui/react" {
62+
interface ServingEndpointRegistry {
63+
default: {
64+
request: {
65+
messages?: {
66+
role?: "user" | "assistant";
67+
content?: string;
68+
}[];
69+
/** @openapi integer, nullable */
70+
n?: number | null;
71+
max_tokens?: number;
72+
/** @openapi double, nullable */
73+
top_p?: number | null;
74+
reasoning_effort?: "low" | "medium" | "high" | null;
75+
/** @openapi double, nullable */
76+
temperature?: number | null;
77+
stop?: string | string[] | null;
78+
};
79+
response: {
80+
model?: string;
81+
choices?: {
82+
index?: number;
83+
message?: {
84+
role?: "user" | "assistant";
85+
content?: string;
86+
};
87+
finish_reason?: string;
88+
}[];
89+
usage?: {
90+
prompt_tokens?: number;
91+
completion_tokens?: number;
92+
total_tokens?: number;
93+
} | null;
94+
object?: string;
95+
id?: string;
96+
created?: number;
97+
};
98+
chunk: {
99+
model?: string;
100+
choices?: {
101+
index?: number;
102+
delta?: {
103+
role?: "user" | "assistant";
104+
content?: string;
105+
};
106+
finish_reason?: string | null;
107+
}[];
108+
object?: string;
109+
id?: string;
110+
created?: number;
111+
};
112+
};
113+
}
114+
}

docs/docs/api/appkit/Function.appKitServingTypesPlugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ServingEndpointRegistry module augmentation.
1111
Endpoint discovery order:
1212
1. Explicit `endpoints` option (override)
1313
2. AST extraction from server file (server/index.ts or server/server.ts)
14-
3. DATABRICKS_SERVING_ENDPOINT env var (single default endpoint)
14+
3. DATABRICKS_SERVING_ENDPOINT_NAME env var (single default endpoint)
1515

1616
## Parameters
1717

packages/appkit/src/type-generator/serving/generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ export async function generateServingTypes(
226226
}
227227

228228
function resolveDefaultEndpoints(): Record<string, EndpointConfig> {
229-
if (process.env.DATABRICKS_SERVING_ENDPOINT) {
230-
return { default: { env: "DATABRICKS_SERVING_ENDPOINT" } };
229+
if (process.env.DATABRICKS_SERVING_ENDPOINT_NAME) {
230+
return { default: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" } };
231231
}
232232
return {};
233233
}

packages/appkit/src/type-generator/serving/server-file-extractor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function getPropertyValue(pairNode: SgNode): SgNode | null {
175175

176176
/**
177177
* Extract a single endpoint entry from a pair node like:
178-
* `demo: { env: "DATABRICKS_SERVING_ENDPOINT", servedModel: "my-model" }`
178+
* `demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME", servedModel: "my-model" }`
179179
*/
180180
function extractEndpointEntry(
181181
pair: SgNode,

packages/appkit/src/type-generator/serving/tests/generator.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe("generateServingTypes", () => {
9797

9898
afterEach(() => {
9999
delete process.env.TEST_SERVING_ENDPOINT;
100-
delete process.env.DATABRICKS_SERVING_ENDPOINT;
100+
delete process.env.DATABRICKS_SERVING_ENDPOINT_NAME;
101101
vi.restoreAllMocks();
102102
});
103103

@@ -191,8 +191,8 @@ describe("generateServingTypes", () => {
191191
expect(output).toContain("Record<string, unknown>");
192192
});
193193

194-
test("resolves default endpoint from DATABRICKS_SERVING_ENDPOINT", async () => {
195-
process.env.DATABRICKS_SERVING_ENDPOINT = "my-default-endpoint";
194+
test("resolves default endpoint from DATABRICKS_SERVING_ENDPOINT_NAME", async () => {
195+
process.env.DATABRICKS_SERVING_ENDPOINT_NAME = "my-default-endpoint";
196196
mockFetchOpenApiSchema.mockResolvedValue({
197197
spec: CHAT_OPENAPI_SPEC,
198198
pathKey: "/served-models/llm/invocations",

packages/appkit/src/type-generator/serving/tests/server-file-extractor.test.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ createApp({
5252
plugins: [
5353
serving({
5454
endpoints: {
55-
demo: { env: "DATABRICKS_SERVING_ENDPOINT" },
55+
demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" },
5656
second: { env: "DATABRICKS_SERVING_ENDPOINT_SECOND" },
5757
}
5858
}),
@@ -62,7 +62,7 @@ createApp({
6262

6363
const result = extractServingEndpoints("/app/server/index.ts");
6464
expect(result).toEqual({
65-
demo: { env: "DATABRICKS_SERVING_ENDPOINT" },
65+
demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" },
6666
second: { env: "DATABRICKS_SERVING_ENDPOINT_SECOND" },
6767
});
6868
});
@@ -75,7 +75,7 @@ createApp({
7575
plugins: [
7676
serving({
7777
endpoints: {
78-
demo: { env: "DATABRICKS_SERVING_ENDPOINT", servedModel: "my-model" },
78+
demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME", servedModel: "my-model" },
7979
}
8080
}),
8181
],
@@ -84,7 +84,10 @@ createApp({
8484

8585
const result = extractServingEndpoints("/app/server/index.ts");
8686
expect(result).toEqual({
87-
demo: { env: "DATABRICKS_SERVING_ENDPOINT", servedModel: "my-model" },
87+
demo: {
88+
env: "DATABRICKS_SERVING_ENDPOINT_NAME",
89+
servedModel: "my-model",
90+
},
8891
});
8992
});
9093

@@ -133,7 +136,7 @@ createApp({
133136
mockServerFile(`
134137
import { createApp, serving } from '@databricks/appkit';
135138
136-
const myEndpoints = { demo: { env: "DATABRICKS_SERVING_ENDPOINT" } };
139+
const myEndpoints = { demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" } };
137140
createApp({
138141
plugins: [
139142
serving({ endpoints: myEndpoints }),
@@ -175,7 +178,7 @@ createApp({
175178
plugins: [
176179
serving({
177180
endpoints: {
178-
demo: { env: 'DATABRICKS_SERVING_ENDPOINT' },
181+
demo: { env: 'DATABRICKS_SERVING_ENDPOINT_NAME' },
179182
}
180183
}),
181184
],
@@ -184,7 +187,7 @@ createApp({
184187

185188
const result = extractServingEndpoints("/app/server/index.ts");
186189
expect(result).toEqual({
187-
demo: { env: "DATABRICKS_SERVING_ENDPOINT" },
190+
demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" },
188191
});
189192
});
190193

@@ -196,7 +199,7 @@ createApp({
196199
plugins: [
197200
serving({
198201
endpoints: {
199-
demo: { env: "DATABRICKS_SERVING_ENDPOINT" },
202+
demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" },
200203
second: { env: "DATABRICKS_SERVING_ENDPOINT_SECOND" },
201204
},
202205
}),
@@ -206,7 +209,7 @@ createApp({
206209

207210
const result = extractServingEndpoints("/app/server/index.ts");
208211
expect(result).toEqual({
209-
demo: { env: "DATABRICKS_SERVING_ENDPOINT" },
212+
demo: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" },
210213
second: { env: "DATABRICKS_SERVING_ENDPOINT_SECOND" },
211214
});
212215
});

packages/appkit/src/type-generator/serving/tests/vite-plugin.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ describe("appKitServingTypesPlugin", () => {
4040
expect((plugin as any).apply()).toBe(true);
4141
});
4242

43-
test("returns true when DATABRICKS_SERVING_ENDPOINT is set", () => {
44-
process.env.DATABRICKS_SERVING_ENDPOINT = "my-endpoint";
43+
test("returns true when DATABRICKS_SERVING_ENDPOINT_NAME is set", () => {
44+
process.env.DATABRICKS_SERVING_ENDPOINT_NAME = "my-endpoint";
4545
const plugin = appKitServingTypesPlugin();
4646
expect((plugin as any).apply()).toBe(true);
4747
});
@@ -61,7 +61,7 @@ describe("appKitServingTypesPlugin", () => {
6161
});
6262

6363
test("returns false when nothing configured", () => {
64-
delete process.env.DATABRICKS_SERVING_ENDPOINT;
64+
delete process.env.DATABRICKS_SERVING_ENDPOINT_NAME;
6565
mockFindServerFile.mockReturnValue(null);
6666
const plugin = appKitServingTypesPlugin();
6767
expect((plugin as any).apply()).toBe(false);

packages/appkit/src/type-generator/serving/vite-plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const logger = createLogger("type-generator:serving:vite-plugin");
1313
interface AppKitServingTypesPluginOptions {
1414
/** Path to the output .d.ts file (relative to client root). Default: "src/appKitServingTypes.d.ts" */
1515
outFile?: string;
16-
/** Endpoint config override. If omitted, auto-discovers from the server file or falls back to DATABRICKS_SERVING_ENDPOINT env var. */
16+
/** Endpoint config override. If omitted, auto-discovers from the server file or falls back to DATABRICKS_SERVING_ENDPOINT_NAME env var. */
1717
endpoints?: Record<string, EndpointConfig>;
1818
}
1919

@@ -25,7 +25,7 @@ interface AppKitServingTypesPluginOptions {
2525
* Endpoint discovery order:
2626
* 1. Explicit `endpoints` option (override)
2727
* 2. AST extraction from server file (server/index.ts or server/server.ts)
28-
* 3. DATABRICKS_SERVING_ENDPOINT env var (single default endpoint)
28+
* 3. DATABRICKS_SERVING_ENDPOINT_NAME env var (single default endpoint)
2929
*/
3030
export function appKitServingTypesPlugin(
3131
options?: AppKitServingTypesPluginOptions,
@@ -66,7 +66,7 @@ export function appKitServingTypesPlugin(
6666
return true;
6767
}
6868

69-
if (process.env.DATABRICKS_SERVING_ENDPOINT) {
69+
if (process.env.DATABRICKS_SERVING_ENDPOINT_NAME) {
7070
return true;
7171
}
7272

0 commit comments

Comments
 (0)