fix(responses): honor include on input item retrieval.#5605
Open
skamenan7 wants to merge 2 commits intoogx-ai:mainfrom
Open
fix(responses): honor include on input item retrieval.#5605skamenan7 wants to merge 2 commits intoogx-ai:mainfrom
skamenan7 wants to merge 2 commits intoogx-ai:mainfrom
Conversation
Stored response input items should follow the same include contract as live responses so gated fields stay hidden unless callers explicitly request them. Signed-off-by: skamenan7 <skamenan@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Closes #5345
The
GET /responses/{id}/input_itemsendpoint accepted theincludequery parameter but raisedNotImplementedErrorwhen it was actually set. This wires up the filtering logic so gated fields (file_search_call.results,message.input_image.image_url,message.output_text.logprobs) are nulled out by default and only populated when the caller explicitly requests them viainclude, matching the OpenAI whitelist contract.Include values whose backing models don't exist yet in Llama Stack (
web_search_call.action.sources,reasoning.encrypted_content,computer_call_output.output.image_url,code_interpreter_call.outputs) are accepted silently as no-ops.Changes:
src/llama_stack/providers/utils/responses/responses_store.py-- added_apply_include_filter()and_filter_message_include_fields()private functions, removed theNotImplementedErrorguard, and called the filter after pagination inlist_response_input_items()tests/unit/utils/responses/test_responses_store.py-- added 5 new tests covering all include filter branches plus a store round-trip test that verifies stored data is never mutated by filteringtests/unit/providers/responses/builtin/test_openai_responses_core.py-- updated the delegation test to use a realResponseItemIncludeenum value instead of a bare stringTest Plan
Also,
GET /v1/responses/{response_id}/input_itemsinclude behavior end to end using a deterministic stored response fixture.file_search_call.resultsis hidden by default and only returned wheninclude=file_search_call.resultsis requested.message.output_text.logprobsis hidden by default and only returned wheninclude=message.output_text.logprobsis requested.