feat(friendli): fetch model list dynamically from /v1/models - #1028
feat(friendli): fetch model list dynamically from /v1/models#1028Lee-Si-Yoon wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Convert Friendli from a static provider (4 hardcoded models) to a dynamic provider that fetches the live model list from the public https://api.friendli.ai/serverless/v1/models endpoint at runtime. - Add getFriendliModels() fetcher with zod schema validation - Wire friendli into modelCache, webviewMessageHandler, and dynamicProviders - FriendliHandler loads dynamic models in constructor, falls back to static friendliModels for cold-start and API lag - UI model picker uses routerModels.friendli instead of static list - Add fetcher spec (14 tests) and update Friendli.spec.tsx with ModelPicker mock
bab25e8 to
3ec8de5
Compare
|
Closing this PR. At the time it was made, https://api.friendli.ai/serverless/v1/models was not up-to-date, so the hardcode approach was used as a fallback. The endpoint is now reliable, so we can trust it going forward. Will open a fresh PR that relies on the live /v1/models endpoint. |
Friendli model list is now fetched live from
GET /v1/modelsinstead of being hardcoded. The endpoint is public (no auth), same as Vercel AI Gateway and OpenRouter in this repo.fetchers/friendli.ts): zod-validated axios call, maps API fields toModelInfo(pricing, cache, reasoning effort, image modality, deprecation)FriendliHandlerfire-and-forgets a model fetch in constructor;getModel()prefers dynamic data, falls back to staticfriendliModels"friendli"moved todynamicProviders; UI usesrouterModels.friendlifor the model picker