-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: pass LiteLLM credentials when flushing model cache #9683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
When refreshing LiteLLM models, the cache flush was not receiving the required apiKey and baseUrl parameters, causing an 'Invalid URL' error. This fix: - Updates flushModels() to accept optional GetModelsOptions parameter - Passes LiteLLM credentials when flushing cache in both places: 1. When explicitly refreshing via flushRouterModels message 2. When requesting models with new credentials Fixes #9682
Review completed. No issues found. The PR correctly fixes the LiteLLM cache flush issue by:
The implementation follows existing code patterns and properly addresses the root cause described in issue #9682. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
|
I tested this fix locally with 2 different litellm instances. While this fixes the flushing the cache, when switching between different configuration profiles, if the litellm url returns different models for the profile, it takes 2 clicks of "Refresh Models" for the new models to actually render in the drop down. |
Hi, I've submitted an alternative PR to tackle that issue, PTAL: #9870 |
Awesome thanks! I just tested out your PR as well to see if that rendering issue I mentioned still happens and it does. Rather than clicking refresh models twice though I noticed that if I clicked refresh models then open the drop down and click some random model, the next time I opened the drop down again it would be rendered with the models from the previous refresh. |
I believe the fix for that is to await the call to However, I cannot test that right now. |
I just tested that and it did fix it thanks! |
This PR fixes the LiteLLM cache flush issue where the "Refresh Models" button was causing an "Invalid URL" error.
Problem
When refreshing LiteLLM models, the cache flush was not receiving the required
apiKeyandbaseUrlparameters, resulting in an "Invalid URL" error in thegetLiteLLMModelsfunction.Solution
flushModels()inmodelCache.tsto accept an optionalGetModelsOptionsparameterflushModels()to pass the required credentials:flushRouterModelsmessage handlerChanges
src/api/providers/fetchers/modelCache.ts: Added optionaloptionsparameter toflushModels()src/core/webview/webviewMessageHandler.ts: Pass LiteLLM configuration when flushing cacheFixes #9682
Important
Fixes LiteLLM cache flush by passing credentials in
flushModels()to prevent "Invalid URL" error.getLiteLLMModelsby passingapiKeyandbaseUrlwhen flushing cache.flushModels()inmodelCache.tsto acceptGetModelsOptionsparameter.flushRouterModelsand model requests with new credentials inwebviewMessageHandler.tsto pass LiteLLM credentials.flushModels()inmodelCache.tsnow accepts an optionaloptionsparameter for credentials.webviewMessageHandler.tsupdatesflushModels()calls to include LiteLLM credentials when necessary.This description was created by
for f3df489. You can customize this summary. It will automatically update as commits are pushed.