feat(appkit): add DatabricksAdapter.fromAiGateway for gateway chat completions - #605
Draft
MarioCadenas wants to merge 1 commit into
Draft
MarioCadenas wants to merge 1 commit into
MarioCadenas wants to merge 1 commit into
Conversation
…mpletions Route agents through the Databricks AI Gateway Chat Completions endpoint (/ai-gateway/mlflow/v1/chat/completions), naming the model in the request body (e.g. system.ai.claude-opus-5-5) instead of in the URL. Reuses the existing Chat Completions tool loop and SSE parsing unchanged. Additive and non-breaking: the serving-endpoint path (fromModelServing, fromServingEndpoint, bare-string model) never sets a body model, so its request is byte-identical to before. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Contributor
📦 Bundle size reportCompared against
|
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 1.2 MB (+2.5 KB) | 426 KB (+648 B) |
| Type declarations | 446 KB (+2.4 KB) | 162 KB (+674 B) |
| Source maps | 2.3 MB (+5.3 KB) | 798 KB (+1.2 KB) |
| Other | 11 KB | 3.7 KB |
| Total | 4.0 MB (+10 KB) | 1.4 MB (+2.5 KB) |
Per-entry composition (own code — deps external (as shipped))
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
. |
96 KB | 2.5 KB | 98 KB | external | 314 KB |
./beta |
93 KB (+130 B) | 457 B | 94 KB (+130 B) | external | 281 KB (+529 B) |
./testing |
38 KB | 30 KB | 69 KB | external | 201 KB |
./tsdown |
520 B | 0 B | 520 B | external | 813 B |
./type-generator |
23 KB | 0 B | 23 KB | external | 65 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
. |
index.js |
initial | 92 KB |
. |
utils.js |
initial | 4.0 KB |
. |
remote-tunnel-manager.js |
lazy | 2.5 KB |
./beta |
beta.js |
initial | 77 KB |
./beta |
stream-manager.js |
initial | 5.8 KB |
./beta |
databricks.js |
initial | 3.2 KB |
./beta |
wide-event-emitter.js |
initial | 3.2 KB |
./beta |
configuration.js |
initial | 2.3 KB |
./beta |
service-context.js |
initial | 1.3 KB |
./beta |
client.js |
initial | 434 B |
./beta |
client-options.js |
initial | 219 B |
./beta |
supervisor-api.js |
lazy | 192 B |
./beta |
databricks.js |
lazy | 142 B |
./beta |
index.js |
lazy | 123 B |
./testing |
manifest.js |
initial | 26 KB |
./testing |
index.js |
initial | 10.0 KB |
./testing |
wide-event-emitter.js |
initial | 2.9 KB |
./testing |
index.js |
lazy | 26 KB |
./testing |
remote-tunnel-manager.js |
lazy | 2.5 KB |
./testing |
utils.js |
lazy | 1.2 KB |
./tsdown |
index.js |
initial | 520 B |
./type-generator |
index.js |
initial | 23 KB |
@databricks/appkit-ui
npm tarball (packed): 350 KB (-4 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 395 KB | 132 KB |
| Type declarations | 229 KB | 84 KB (-1 B) |
| Source maps | 766 KB | 253 KB |
| CSS | 16 KB | 3.2 KB |
| Total | 1.4 MB | 472 KB (-1 B) |
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
./js |
5.3 KB | 49 KB | 55 KB | 208 KB | 14 KB |
./js/beta |
20 B | 0 B | 20 B | 0 B | 0 B |
./react |
432 KB | 49 KB | 481 KB | 1.3 MB | 177 KB |
./react/beta |
1.0 KB | 0 B | 1.0 KB | 0 B | 1.9 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
./js |
index.js |
initial | 5.2 KB |
./js |
chunk |
initial | 120 B |
./js |
apache-arrow |
lazy | 49 KB |
./js/beta |
beta.js |
initial | 20 B |
./react |
index.js |
initial | 430 KB |
./react |
tslib |
initial | 2.1 KB |
./react |
apache-arrow |
lazy | 49 KB |
./react/beta |
beta.js |
initial | 1.0 KB |
Contributor
🤖 AppKit PR bot🔬 Run evalsStart an eval for this PR from the evals-monitor app: Go to Evals Monitor → 📦 Try this PR's app templateScaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh run download 36149675675 -R databricks/appkit -n appkit-template-0.78.0-pr.1ed8e38-feat-agents-ai-gateway-605 -D appkit-pr-605 \
&& unzip -o "appkit-pr-605/appkit-template-0.78.0-pr.1ed8e38-feat-agents-ai-gateway-605.zip" -d "appkit-pr-605" \
&& databricks apps init --template "appkit-pr-605"The template pins |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
DatabricksAdapter.fromAiGateway({ model })so agents can consume models through the Databricks AI Gateway Chat Completions endpoint (/ai-gateway/mlflow/v1/chat/completions), naming the model in the request body (e.g.system.ai.claude-opus-5-5) instead of a per-endpoint URL.This is the migration path off the legacy
databricks-*serving-endpoint names (/serving-endpoints/{name}/invocations) toward the gateway's UCsystem.ai.*models.How
The gateway speaks the same OpenAI Chat Completions wire format the adapter already used, so the change is deliberately tiny:
connectors/serving/client.ts— newstreamAiGateway(): hard-codes the gateway path and forcesstream: true(mirrors the existingstream()serving helper; keeps the@internal"hard-coded path only" contract ofstreamPath).agents/databricks.ts— optionalmodelon the adapter options, injected into the request body only when set; newfromAiGatewayfactory that auto-resolves aWorkspaceClient(likefromModelServing).Everything else is reused unchanged: the multi-step tool loop, SSE parsing, dot→
__tool-name mapping, thought-signature pass-through, DoS caps, and generation params.Non-breaking
Purely additive (+186 / -0).
modelis set only on the gateway path.fromModelServing,fromServingEndpoint, and bare-stringmodel:never set a bodymodel, so their requests are byte-identical to before — a test pins this.Verification
dogfoodgateway: confirmed the path/ai-gateway/mlflow/v1/chat/completions200s,model-in-body works (system.ai.claude-opus-5-5→global.anthropic.claude-opus-5-5), and streaming SSE + tool-calling return in the exactchoices[0].delta/tool_calls[]shape the adapter parses.databricks.test.ts(2 new — gateway path +modelin body; serving path leavesmodelout).genie/sql-warehouse/mock-workspace-clientfiles only).Follow-ups (not in scope)
model:still routes to serving endpoints; wiring gateway selection into frontmatter can be a separate change if wanted.This pull request and its description were written by Isaac.