feat(vector-stores): support Bedrock retrievalConfiguration passthrough#26685
feat(vector-stores): support Bedrock retrievalConfiguration passthrough#26685Sameerlite wants to merge 5 commits intolitellm_internal_stagingfrom
Conversation
Route vector store search `extra_body` into provider transformers and handle Bedrock `retrievalConfiguration` explicitly so only intended provider-specific fields are forwarded. Made-with: Cursor
Greptile SummaryThis PR threads Confidence Score: 5/5Safe to merge — no P0/P1 issues; all previously flagged concerns (shallow copy mutation, silent override) have been addressed with deepcopy, debug logging, and targeted tests. The deep copy correctly prevents caller mutation, standard-params-win override is explicitly logged and covered by tests, the interface change is consistent across all 12 provider files, and new tests exercise all three key scenarios. No regressions for non-Bedrock providers since extra_body was never forwarded to transformers before this PR. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/llms/bedrock/vector_stores/transformation.py | Core Bedrock transformer: uses deepcopy to safely extract retrievalConfiguration from extra_body, logs conflicts, and passes the full config through to Bedrock via cast(). All previous concerns (shallow copy mutation, silent override) are addressed. |
| litellm/llms/base_llm/vector_store/transformation.py | Adds extra_body parameter to abstract and default implementations of transform_search_vector_store_request; interface change is consistent across the class hierarchy. |
| litellm/llms/custom_httpx/llm_http_handler.py | Threads extra_body through to both sync and async transform_search_vector_store_request call sites; straightforward plumbing change. |
| tests/test_litellm/llms/bedrock/vector_stores/test_bedrock_vector_store_transformation.py | Adds three new tests covering: extra_body passthrough with irrelevant fields excluded, no mutation of caller's extra_body when max_num_results overrides, and no mutation when filters override. Good coverage of previously flagged concerns. |
Sequence Diagram
sequenceDiagram
participant Caller
participant llm_http_handler
participant BedrockTransformer
participant BedrockAPI
Caller->>llm_http_handler: vector_store_search(query, extra_body, optional_params)
llm_http_handler->>BedrockTransformer: transform_search_vector_store_request(query, optional_params, extra_body)
Note over BedrockTransformer: deepcopy(extra_body["retrievalConfiguration"])
Note over BedrockTransformer: Merge max_num_results → numberOfResults (standard param wins)
Note over BedrockTransformer: Merge filters → filter (standard param wins)
Note over BedrockTransformer: cast(BedrockKBRetrievalConfiguration, retrieval_config)
BedrockTransformer-->>llm_http_handler: (url, request_body)
llm_http_handler->>BedrockAPI: POST /knowledgebases/{id}/retrieve
BedrockAPI-->>llm_http_handler: retrievalResults
llm_http_handler-->>Caller: VectorStoreSearchResponse
Reviews (3): Last reviewed commit: "Fix tests" | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Route vector store search
extra_bodyinto provider transformers and handle BedrockretrievalConfigurationexplicitly so only intended provider-specific fields are forwarded.Fixes LIT-2482
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
Type
🆕 New Feature
🐛 Bug Fix
Changes