From f6aa2c3343b898db4997d0f31707d1a38d06d033 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Mon, 16 Mar 2026 13:24:08 +0530 Subject: [PATCH] feat(responses): add supports_native_file_search() capability flag to BaseResponsesAPIConfig Add a new method supports_native_file_search() to BaseResponsesAPIConfig that lets each provider declare whether it natively handles the file_search tool with vector_store_ids in the Responses API. - BaseResponsesAPIConfig: default returns False (RAG injection mode) - OpenAIResponsesAPIConfig: returns True (native passthrough) - AzureOpenAIResponsesAPIConfig inherits True from OpenAI via subclassing This flag is used by VectorStorePreCallHook to decide between: - Native passthrough (OpenAI/Azure): pass file_search tool through as-is - RAG injection (all others): search vector stores, inject context, strip tool Co-Authored-By: Claude Sonnet 4.6 (1M context) --- litellm/llms/base_llm/responses/transformation.py | 15 +++++++++++++++ litellm/llms/openai/responses/transformation.py | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/litellm/llms/base_llm/responses/transformation.py b/litellm/llms/base_llm/responses/transformation.py index f429930e002..48f06b6e314 100644 --- a/litellm/llms/base_llm/responses/transformation.py +++ b/litellm/llms/base_llm/responses/transformation.py @@ -230,6 +230,21 @@ class BaseResponsesAPIConfig(ABC): """ return False + def supports_native_file_search(self) -> bool: + """ + Returns True if the provider natively handles the file_search tool with + vector_store_ids in the Responses API. + + When True: the file_search tool is passed through as-is to the provider, + and LiteLLM maps any managed vector store IDs to provider-specific IDs. + When False: LiteLLM intercepts the file_search tool, performs RAG search against + the referenced vector stores, injects context into the input, and + strips the file_search tool before forwarding to the provider. + + Default: False (RAG injection mode) + """ + return False + ######################################################### ########## CANCEL RESPONSE API TRANSFORMATION ########## ######################################################### diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.py index 9d909fd4017..28ad23c3bd8 100644 --- a/litellm/llms/openai/responses/transformation.py +++ b/litellm/llms/openai/responses/transformation.py @@ -51,6 +51,10 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig): ) ) + def supports_native_file_search(self) -> bool: + """OpenAI natively handles file_search with vector_store_ids.""" + return True + def map_openai_params( self, response_api_optional_params: ResponsesAPIOptionalRequestParams,