Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(file_search): preserve emulated response params and hidden metadata

Sameer Kankute77a5093ce287
diff --git a/litellm/responses/file_search/emulated_handler.py b/litellm/responses/file_search/emulated_handler.py
index 2ac1d3dea67..85a8f789988 100644
--- a/litellm/responses/file_search/emulated_handler.py
+++ b/litellm/responses/file_search/emulated_handler.py
@@ -339,9 +339,7 @@ def _synthesize_responses_api_response(
output[0] = file_search_call item
output[1] = message item (with citations)
"""
- import litellm
-
- return ResponsesAPIResponse(
+ synthesized = ResponsesAPIResponse(
id=getattr(original_response, "id", f"resp_{uuid.uuid4().hex}"),
object="response",
created_at=getattr(original_response, "created_at", int(time.time())),
@@ -351,6 +349,9 @@ def _synthesize_responses_api_response(
usage=getattr(original_response, "usage", None),
error=None,
)
+ if hasattr(original_response, "_hidden_params"):
+ synthesized._hidden_params = getattr(original_response, "_hidden_params")
+ return synthesized
# ---------------------------------------------------------------------------
@@ -513,7 +514,7 @@ async def aresponses_with_emulated_file_search(
input=follow_up_input,
model=model,
tools=None, # no tools needed for the answer step
- **{k: v for k, v in kwargs.items() if k not in ("tools",)},
+ **kwargs,
),
)
diff --git a/litellm/responses/main.py b/litellm/responses/main.py
index 5438676c5fe..761be5a2e14 100644
--- a/litellm/responses/main.py
+++ b/litellm/responses/main.py
@@ -742,6 +742,7 @@ def responses(
"previous_response_id": previous_response_id,
"reasoning": reasoning,
"store": store,
+ "background": background,
"stream": stream,
"temperature": temperature,
"text": text,
@@ -749,6 +750,10 @@ def responses(
"top_p": top_p,
"truncation": truncation,
"user": user,
+ "service_tier": service_tier,
+ "safety_identifier": safety_identifier,
+ "text_format": text_format,
+ "allowed_openai_params": allowed_openai_params,
"extra_headers": extra_headers,
"extra_query": extra_query,
"extra_body": extra_body,