File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
responses/litellm_completion_transformation Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -4150,15 +4150,24 @@ def _generate_cold_storage_object_key(
4150
4150
from litellm .integrations .s3 import get_s3_object_key
4151
4151
4152
4152
# Only generate object key if cold storage is configured
4153
- if litellm .configured_cold_storage_logger is None :
4153
+ configured_cold_storage_logger = litellm .configured_cold_storage_logger
4154
+ if configured_cold_storage_logger is None :
4154
4155
return None
4155
4156
4156
4157
try :
4157
4158
# Generate file name in same format as litellm.utils.get_logging_id
4158
4159
s3_file_name = f"time-{ start_time .strftime ('%H-%M-%S-%f' )} _{ response_id } "
4159
4160
4161
+ # Get the actual s3_path from the configured cold storage logger instance
4162
+ s3_path = "" # default value
4163
+
4164
+ # Get the actual logger instance from the logger name
4165
+ custom_logger = litellm .logging_callback_manager .get_active_custom_logger_for_callback_name (configured_cold_storage_logger )
4166
+ if custom_logger and hasattr (custom_logger , 's3_path' ) and custom_logger .s3_path :
4167
+ s3_path = custom_logger .s3_path
4168
+
4160
4169
s3_object_key = get_s3_object_key (
4161
- s3_path = "" , # Use empty path as default
4170
+ s3_path = s3_path , # Use actual s3_path from logger configuration
4162
4171
team_alias_prefix = "" , # Don't split by team alias for cold storage
4163
4172
start_time = start_time ,
4164
4173
s3_file_name = s3_file_name ,
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ async def extend_chat_completion_message_with_spend_log_payload(
141
141
# Add Output messages for this Spend Log
142
142
############################################################
143
143
_response_output = spend_log .get ("response" , "{}" )
144
- if isinstance (_response_output , dict ):
144
+ if isinstance (_response_output , dict ) and _response_output and _response_output != {} :
145
145
# transform `ChatCompletion Response` to `ResponsesAPIResponse`
146
146
model_response = ModelResponse (** _response_output )
147
147
for choice in model_response .choices :
You can’t perform that action at this time.
0 commit comments