feat(chat): multi-model /tasks/chat/completions (sunflower-14b + sunflower-9b)#239
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- docs/sunflower-multi-models.md: add a "Using via the Sunbird API" section covering model selection on /tasks/chat/completions, the legacy Sunbird/Sunflower-14B alias, and the Gemma-only <=30s audio clip limit with no server-side chunking. - app/tests/test_routers/test_translation.py: update test_feedback_logged_with_sunflower_model to expect the resolved canonical model key "sunflower-14b" as model_type, since DEFAULT_MODEL now holds the new short key rather than the old upstream model name string "Sunbird/Sunflower-14B" (per design spec: feedback model_type is the resolved canonical model name).
… base64-only audio Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Remove the multimodal Gemma model and all audio machinery (input_audio content parts, audio-capability check, feedback audio-sanitization), returning /tasks/chat/completions to text-only string content. Multi-model routing across sunflower-14b (default) and sunflower-9b, the Sunbird/Sunflower-14B alias, and the legacy qwen/sunflower keys remain. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…flower-multi-models
Document the /tasks/chat/completions endpoint across app/docs.py, docs/tutorial.md, and the frontend Tutorial page: model selection (sunflower-14b default, sunflower-9b), the Sunbird/Sunflower-14B alias, and per-model language coverage sourced from the SALT model pages (14B: English + 31 Ugandan/regional; 9B: 67 African languages by tier). Deployment: add SUNFLOWER_14B_ENDPOINT_ID / SUNFLOWER_9B_ENDPOINT_ID to the Cloud Run deploy workflow using env_vars_update_strategy: merge (preserves existing service env), and document the new endpoint vars + optional model-name overrides in .env.example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…flower-multi-models
The old 'Sunbird/Sunflower-14B' identifier is no longer accepted. resolve_model applies no aliases; the router returns a 400 with a message telling the client to use 'sunflower-14b' instead (RENAMED_MODELS drives the targeted hint). Docs (docs.py, tutorial.md, frontend Tutorial page) and the design-spec amendment note updated accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The upstream `model=` forwarded to the vLLM/RunPod endpoint defaulted to `Sunbird/Sunflower-14B`, which the deployed endpoint rejects with 404 'The model ... does not exist' — it serves under `--served-model-name sunflower-14b`. Default the 14B upstream served name to `sunflower-14b` (9B already `sunflower-9b`); still overridable via SUNFLOWER_14B_MODEL_NAME. Legacy qwen/sunflower keys (translation service) now send the short name too, matching the same endpoint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…flower-multi-models
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.
Summary
Extends the OpenAI-compatible
POST /tasks/chat/completionsendpoint from a single hardcoded model to two Sunflower text models, each on its own RunPod serverless endpoint. Backward compatible with existing string-content clients; also documents the endpoint across the API docs, tutorial, and frontend, and wires the new config into the Cloud Run deploy.modelsunflower-14b(default)SUNFLOWER_14B_ENDPOINT_ID(falls back toSUNFLOWER_ENDPOINT_ID/QWEN_ENDPOINT_ID)sunflower-9bSUNFLOWER_9B_ENDPOINT_IDBehavior
modelfield;sunflower-14bis the default when omitted. Unknown model →400listing supported models.Sunbird/Sunflower-14Bidentifier is not accepted — it returns400telling the client to usesunflower-14b.contentis a plain string; non-string content →422.model=forwarded to each RunPod/vLLM endpoint defaults to the short name (sunflower-14b/sunflower-9b) to match each endpoint's--served-model-name; overridable viaSUNFLOWER_14B_MODEL_NAME/SUNFLOWER_9B_MODEL_NAME.qwen/sunflowerkeys are preserved and now also send the short upstream name (the translation service routes through them to the same 14B endpoint).Changes
Backend
app/schemas/chat.py—SUPPORTED_MODELS = ("sunflower-14b", "sunflower-9b"),DEFAULT_MODEL,RENAMED_MODELS(drives the deprecated-identifier error),resolve_model(no aliases), string-onlycontent.app/services/inference_service.py— env-driven multi-endpoint routing map for both models plus legacyqwen/sunflowerkeys; short upstream served names.app/routers/chat.py— per-model routing (no hardcoded model constant);_validate_modelreturns the targeted rename error or the generic unsupported-model error.Docs
app/docs.py,docs/tutorial.md,frontend/src/pages/Tutorial.tsx— model selection, per-model language coverage (sourced from the SALT model pages / HuggingFace), removed-alias behavior, and updated code samples. Rebuilt SPA assets committed.Deployment / config
.github/workflows/deploy-api.yml— addsSUNFLOWER_14B_ENDPOINT_ID/SUNFLOWER_9B_ENDPOINT_IDto the Cloud Run deploy viaenv_vars_update_strategy: merge(preserves the service's existing env). Azure/Heroku untouched..env.example— documents the new endpoint vars, the 14B fallback chain, and the optional model-name overrides.Testing
app/is black/isort/flake8-clean; frontendnpm run build(tsc + vite) passes.Ops before / after deploy
SUNFLOWER_14B_ENDPOINT_IDandSUNFLOWER_9B_ENDPOINT_IDbefore the next Cloud Run deploy. (14B still falls back to the existingSUNFLOWER_ENDPOINT_ID/QWEN_ENDPOINT_IDon the service; 9B needs its secret to function.)--served-model-name, setSUNFLOWER_14B_MODEL_NAME/SUNFLOWER_9B_MODEL_NAMEon the service to match.Known, out of scope
npm run lintfails due to a pre-existing ESLint v10 / flat-config toolchain mismatch (fails identically without this branch's changes); thenpm run buildtype-check gate passes.🤖 Generated with Claude Code