fix(proxy): keep requested model group when merging vector store file credentials - #36106
Conversation
… credentials Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
|
Greptile SummaryThe PR preserves the requested model group after merging vector-store deployment credentials, preventing shared provider models from changing routing and spend attribution.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. The changed paths consistently restore the selected routing group after merging deployment credentials, and the regression coverage verifies the shared-provider-model scenario that previously caused incorrect routing and attribution.
|
| Filename | Overview |
|---|---|
| litellm/proxy/vector_store_files_endpoints/endpoints.py | Centralizes credential merging while retaining the routing group across the four affected vector-store file paths; no actionable defect was established. |
| tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py | Updates corrected model-group expectations and adds regression coverage using two groups backed by the same provider model. |
| tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_tenant_guard.py | Updates the managed-deployment assertion to verify that the routing group survives credential merging. |
Reviews (1): Last reviewed commit: "fix(proxy): keep requested model group w..." | Re-trigger Greptile
TLDR
Problem this solves:
litellm_params.modelHow it solves it:
data["model"]modelis restoredRelevant issues
Fixes #36103
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Config with two model groups pointing at the same
litellm_params.model, which is what makes the alias loss observable:The upstream is a local OpenAI-shaped server returning a vector store file list, since this box has no egress to api.openai.com, so the calls do not hit a real provider. Everything on the LiteLLM side (auth, routing, credential merge, deployment selection, spend logging) is the real code path
Before, at b66d4e6:
The request asked for
public-embeddingsand the proxy served, tracked and logged it asopenai/text-embedding-3-small, a group the caller never asked for and that no config entry declaresAfter, at 9cbc2c3, same config and same commands:
The deployment is now resolved under the group the caller requested, and spend rows carry
model_group: public-embeddingsType
🐛 Bug Fix
Changes
get_deployment_credentials_with_providerreturns the deployment'slitellm_params.model, and the vector store file endpoints merged that dict straight into the request body, sodata["model"]stopped being the requested group before the Router ever saw it. The Router usually papers over this with the_get_deployment_by_litellm_modelfallback, but that fallback matches on the underlying model, so any second group sharing it becomes an equally valid candidate: access group filtering, team scoping, per-group fallbacks, rate limits and tags are all evaluated against the wrong name, and the clientside-credential upsert registers a synthetic deployment whosemodel_groupis the provider modelThe fix is one helper in the vector store file endpoints that merges credentials and then puts the requested group name back:
It is used at the four call sites that merge deployment credentials: the managed file id path, the encoded file id path, the model routing hint path, and the single team deployment fallback. Credentials themselves are untouched, so provider-only fields such as the Bedrock batch keys added in #24548 still flow through, and the batch and file endpoints that call the provider SDK directly rather than routing keep their current behavior
Three existing tests asserted
data["model"]came back as the provider model out of hand written credential mocks. That expectation is the bug, so they now assert the requested group, and a new test builds a real Router with two groups sharingopenai/text-embedding-3-smalland checks that resolution stays on the requested one across repeated selections, which fails before this change since simple shuffle splits across bothFinal Attestation