Skip to content

Commit 106c9f5

Browse files
committed
fix: rename DATABRICKS_SERVING_ENDPOINT to DATABRICKS_SERVING_ENDPOINT_NAME in playground and docs
Also add execution context section documenting OBO-by-default behavior. Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
1 parent afda139 commit 106c9f5

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

apps/dev-playground/.env.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ OTEL_SERVICE_NAME='dev-playground'
99
DATABRICKS_VOLUME_PLAYGROUND=
1010
DATABRICKS_VOLUME_OTHER=
1111
DATABRICKS_GENIE_SPACE_ID=
12-
DATABRICKS_SERVING_ENDPOINT=
12+
DATABRICKS_SERVING_ENDPOINT_NAME=
1313
LAKEBASE_ENDPOINT='' # Run: databricks postgres list-endpoints projects/{project-id}/branches/{branch-id} — use the `name` field from the output
1414
PGHOST=
1515
PGUSER=

docs/docs/plugins/serving.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ await createApp({
2626
});
2727
```
2828

29-
With no configuration, the plugin reads `DATABRICKS_SERVING_ENDPOINT` from the environment and registers it under the `default` alias.
29+
With no configuration, the plugin reads `DATABRICKS_SERVING_ENDPOINT_NAME` from the environment and registers it under the `default` alias.
3030

3131
## Configuration options
3232

3333
| Option | Type | Default | Description |
3434
|--------|------|---------|-------------|
35-
| `endpoints` | `Record<string, EndpointConfig>` | `{ default: { env: "DATABRICKS_SERVING_ENDPOINT" } }` | Map of alias names to endpoint configs |
35+
| `endpoints` | `Record<string, EndpointConfig>` | `{ default: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" } }` | Map of alias names to endpoint configs |
3636
| `timeout` | `number` | `120000` | Request timeout in ms |
3737

3838
### Endpoint aliases
@@ -42,8 +42,8 @@ Endpoint aliases let you reference multiple serving endpoints by name:
4242
```ts
4343
serving({
4444
endpoints: {
45-
llm: { env: "DATABRICKS_SERVING_ENDPOINT" },
46-
classifier: { env: "DATABRICKS_SERVING_ENDPOINT_CLASSIFIER" },
45+
llm: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" },
46+
classifier: { env: "DATABRICKS_SERVING_ENDPOINT_NAME_CLASSIFIER" },
4747
},
4848
})
4949
```
@@ -53,7 +53,7 @@ Each alias maps to an environment variable holding the actual endpoint name. If
5353
```ts
5454
serving({
5555
endpoints: {
56-
llm: { env: "DATABRICKS_SERVING_ENDPOINT", servedModel: "llama-v2" },
56+
llm: { env: "DATABRICKS_SERVING_ENDPOINT_NAME", servedModel: "llama-v2" },
5757
},
5858
})
5959
```
@@ -88,9 +88,23 @@ Endpoints that don't define a streaming response schema in their OpenAPI spec wi
8888

8989
| Variable | Description |
9090
|----------|-------------|
91-
| `DATABRICKS_SERVING_ENDPOINT` | Default endpoint name (used when `endpoints` config is omitted) |
91+
| `DATABRICKS_SERVING_ENDPOINT_NAME` | Default endpoint name (used when `endpoints` config is omitted) |
9292

93-
When using named endpoints, define a custom environment variable per alias (e.g. `DATABRICKS_SERVING_ENDPOINT_CLASSIFIER`).
93+
When using named endpoints, define a custom environment variable per alias (e.g. `DATABRICKS_SERVING_ENDPOINT_NAME_CLASSIFIER`).
94+
95+
## Execution context
96+
97+
All serving routes execute on behalf of the authenticated user (OBO) by default, consistent with the Genie and Files plugins. This ensures per-user `CAN_QUERY` permissions are enforced on the serving endpoint.
98+
99+
For programmatic access via `exports()`, use `.asUser(req)` to run in user context:
100+
101+
```ts
102+
// Service principal context (default)
103+
const result = await AppKit.serving("llm").invoke({ messages });
104+
105+
// User context (recommended in route handlers)
106+
const result = await AppKit.serving("llm").asUser(req).invoke({ messages });
107+
```
94108

95109
## HTTP endpoints
96110

@@ -127,7 +141,7 @@ const AppKit = await createApp({
127141
server(),
128142
serving({
129143
endpoints: {
130-
llm: { env: "DATABRICKS_SERVING_ENDPOINT" },
144+
llm: { env: "DATABRICKS_SERVING_ENDPOINT_NAME" },
131145
},
132146
}),
133147
],

0 commit comments

Comments
 (0)