Repository navigation
fix: route Lemonade models by mapping downloaded to available state - #161
Conversation
Lemonade reports a per-model `downloaded` flag in /api/v1/models, but the discovery parser dropped it, so every Lemonade model resolved to state=unknown. The router treats unknown-state models as being on unhealthy endpoints and excludes them, leaving Lemonade endpoints unroutable for chat completions (404 "No <provider> endpoints available") even when the endpoint is healthy and the model is downloaded. Capture `downloaded` and map it to ModelStateAvailable - the same treatment a pulled, load-on-demand Ollama model already receives. Refs thushan#160
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe PR adds support for Lemonade model routing by capturing the ChangesLemonade model routing state
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Looks good to me, easy merge, thanks for the contrib. |
Resolves #160
Problem
Endpoints configured with
type: "lemonade"are health-checked fine, but no model on them is ever routable: the discovery parser drops the per-modeldownloadedflag that Lemonade returns in/api/v1/models, so every Lemonade model resolves tostate=unknown. The router treats unknown-state models as being on unhealthy endpoints and excludes them, so a Lemonade endpoint is unreachable for chat even when it is up and the model is downloaded.MapModelState(internal/adapter/unifier/model_builder.go) marks a modelavailablewhen it has astate/loadedindicator or a non-zero size.LemonadeModeldeclared neitherdownloadednorsize, so both were dropped at unmarshal and the model stayedunknown.Change
Capture Lemonade's
downloadedflag and map it toModelStateAvailable. This mirrors how a pulled, load-on-demand Ollama model is already treated: present on disk and serveable, so available for routing. Lemonade also loads on demand, anddownloaded: trueis the equivalent readiness signal.lemonade.go: addDownloaded booltoLemonadeModel(ordered to satisfy fieldalignment).lemonade_parser.go: setDetails.State = "available"whendownloadedis true.lemonade_parser_test.go: table-driven test covering downloaded true / false / omitted.I deliberately did not also capture
size: Lemonade reports it as a GiB float while Olla's internal size is bytes, so it would need a unit conversion. The routing fix stands ondownloadedalone; capturingsizefor catalog/concurrency parity can be a separate change if wanted.Verification
make readypasses (test-short, test-race, fmt, vet, golangci-lint 0 issues, betteralign clean).404 "No openai endpoints available"; after, the model reportsstate: availableand the request routes to the Lemonade endpoint and returns a completion (X-Olla-Routing-Decision: routed,X-Olla-Routing-Reason: model_found).Note
This makes Lemonade models routable via the native
/olla/lemonade/...path. Reaching the same endpoints through the generic/olla/openai/...path needs additional work that is out of scope here (the openai-compatible compatibility check and per-backend path translation); I'll open a separate issue describing that gap.Summary by CodeRabbit
Release Notes
New Features
Tests