pi: support OSS models (kimi, glm) via managed databricks-oss provider#227
Closed
lilly-luo wants to merge 1 commit into
Closed
pi: support OSS models (kimi, glm) via managed databricks-oss provider#227lilly-luo wants to merge 1 commit into
lilly-luo wants to merge 1 commit into
Conversation
Pi previously exposed only claude/openai/gemini. OSS families (kimi, glm) were left unmanaged, so an early build's `databricks-kimi` provider — wired with the wrong `openai-responses` dialect against the MLflow chat-completions route — lingered with a frozen, never-refreshed token and 401'd on every call. Add a managed `databricks-oss` provider (api: openai-completions → /ai-gateway/mlflow/v1) with per-model contextWindow/maxTokens from model_token_limits (so GLM's 25k output cap is honored) and supportsStore/supportsStrictMode compat flags the MLflow route requires. `ucode configure pi` now discovers and refreshes OSS models, and the stale `databricks-kimi` block is stripped on every write via LEGACY_PROVIDER_NAMES. Co-authored-by: Isaac
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.
Problem
Configuring Pi and calling an OSS model (e.g.
kimi-k2-7-code) returned 401 against…/ai-gateway/mlflow/v1/responses, while Claude on the same endpoint worked.Root cause: Pi only ever managed
claude/openai/geminiproviders. An early ucode build had written adatabricks-kimiprovider using the wrongopenai-responsesdialect against the MLflow chat-completions route (hence the/responses401), and because that provider wasn't in any list ucode manages:ucode configure.Fix
Re-introduce OSS support to Pi as a first-class managed provider:
databricks.py—build_pi_base_urlsnow returns theossMLflow base URL.agents/pi.py— add a manageddatabricks-ossprovider:api: "openai-completions"→/ai-gateway/mlflow/v1(correct dialect for the MLflow route).compat.supportsStore=false+supportsStrictMode=false— the two fields the MLflow route rejects.contextWindow/maxTokensfrommodel_token_limits, so GLM's 25k output cap is honored (Pi's 16k default would 400 GLM); kimi has no entry and uses Pi defaults.oss_modelsthroughrender_overlay,write_tool_config,_resolve_model_selector,default_model.databricks-osstoPROVIDER_NAMESand moveddatabricks-kimiintoLEGACY_PROVIDER_NAMESso the stale block is stripped on every write.cli.py—want_ossnow includespi, soucode configure pidiscovers and refreshes OSS models; updated the discovery diagnostic hint.Verified the
models.jsonschema (api dialects, per-modelcontextWindow/maxTokens,supportsStore/supportsStrictModecompat) against the installed@earendil-works/pi-coding-agentpackage and its docs.Tests
pi and oss are not ready yet
Added OSS coverage in
tests/test_agent_pi.py(dialect, MLflow URL, compat flags, model listing, GLM limits pinned / kimi limits omitted, selector prefix, default-model fallback) and updated the legacy-removal test to assertdatabricks-kimiis stripped. Full suite passes (895 passed; the one failing test is a pre-existing e2e environment issue unrelated to this change).Note
Not yet validated with a live end-to-end request through the gateway — the config shape is verified against Pi's schema/docs, but a real
ucode pilaunch against a workspace is needed to confirm kimi/glm return 200.This pull request and its description were written by Isaac.