Skip to content

Commit c26fbda

Browse files
committed
Fix carried-forward Responses API and TTS logging regressions
1 parent 47f9e44 commit c26fbda

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

litellm/litellm_core_utils/litellm_logging.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,6 +1855,12 @@ def _is_recognized_call_type_for_logging(
18551855
"""
18561856
Returns True if the call type is recognized for logging (eg. ModelResponse, ModelResponseStream, etc.)
18571857
"""
1858+
try:
1859+
if self.call_type in (CallTypes.speech.value, CallTypes.aspeech.value):
1860+
return True
1861+
except Exception:
1862+
pass
1863+
18581864
if (
18591865
isinstance(logging_result, ModelResponse)
18601866
or isinstance(logging_result, ModelResponseStream)
@@ -2039,6 +2045,24 @@ def success_handler( # noqa: PLR0915
20392045
call_type=self.call_type,
20402046
)
20412047

2048+
if "standard_logging_object" not in self.model_call_details:
2049+
try:
2050+
self.model_call_details["standard_logging_object"] = (
2051+
get_standard_logging_object_payload(
2052+
kwargs=self.model_call_details,
2053+
init_response_obj=result
2054+
if isinstance(result, (dict, BaseModel))
2055+
else {},
2056+
start_time=start_time,
2057+
end_time=end_time,
2058+
logging_obj=self,
2059+
status="success",
2060+
standard_built_in_tools_params=self.standard_built_in_tools_params,
2061+
)
2062+
)
2063+
except Exception:
2064+
pass
2065+
20422066
self.has_run_logging(event_type="sync_success")
20432067
for callback in callbacks:
20442068
try:
@@ -2604,6 +2628,22 @@ async def async_success_handler( # noqa: PLR0915
26042628
call_type=self.call_type,
26052629
)
26062630

2631+
if "standard_logging_object" not in self.model_call_details:
2632+
try:
2633+
self.model_call_details["standard_logging_object"] = (
2634+
get_standard_logging_object_payload(
2635+
kwargs=self.model_call_details,
2636+
init_response_obj=result if isinstance(result, (dict, BaseModel)) else {},
2637+
start_time=start_time,
2638+
end_time=end_time,
2639+
logging_obj=self,
2640+
status="success",
2641+
standard_built_in_tools_params=self.standard_built_in_tools_params,
2642+
)
2643+
)
2644+
except Exception:
2645+
pass
2646+
26072647
self.has_run_logging(event_type="async_success")
26082648

26092649
for callback in callbacks:

litellm/types/llms/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ class ResponsesAPIResponse(BaseLiteLLMOpenAIResponseObject):
12331233
created_at: int
12341234
error: Optional[dict] = None
12351235
incomplete_details: Optional[IncompleteDetails] = None
1236-
instructions: Optional[str] = None
1236+
instructions: Optional[Union[str, List[Dict[str, Any]]]] = None
12371237
metadata: Optional[Dict] = None
12381238
model: Optional[str] = None
12391239
object: Optional[str] = None

0 commit comments

Comments
 (0)