mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-21 08:26:34 +00:00
fix(file_search): preserve emulated response params and hidden metadata
Forward explicit responses() params on emulated file search calls and preserve hidden params on synthesized responses so callback billing/logging context is retained. Made-with: Cursor
This commit is contained in:
@@ -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,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user