|
1 | 1 | import json |
2 | 2 | import os |
| 3 | +import re |
3 | 4 | from typing import Any, Dict, List, Optional, Tuple |
4 | 5 |
|
5 | 6 | from pydantic import BaseModel, Field |
@@ -142,7 +143,7 @@ def _galileo_input_messages( |
142 | 143 | @staticmethod |
143 | 144 | def _record_to_v2_span(record: Dict[str, Any]) -> Dict[str, Any]: |
144 | 145 | created_at = record.get("created_at", "") |
145 | | - if created_at and "Z" not in created_at and "+" not in created_at: |
| 146 | + if created_at and not re.search(r"(Z|[+-]\d{2}:?\d{2})$", created_at): |
146 | 147 | created_at = f"{created_at}Z" |
147 | 148 |
|
148 | 149 | span: Dict[str, Any] = { |
@@ -203,7 +204,7 @@ def get_output_str_from_response( |
203 | 204 | if isinstance(response_obj, litellm.TextCompletionResponse): |
204 | 205 | return response_obj.choices[0].text |
205 | 206 | if isinstance(response_obj, litellm.ImageResponse): |
206 | | - return json.dumps(response_obj["data"]) |
| 207 | + return json.dumps(response_obj["data"], default=str) |
207 | 208 | if isinstance(response_obj, (litellm.ModelResponse, dict)): |
208 | 209 | return get_content_from_model_response(response_obj) |
209 | 210 | return None |
@@ -289,7 +290,7 @@ async def flush_in_memory_records(self): |
289 | 290 | ) |
290 | 291 | return |
291 | 292 |
|
292 | | - if response.status_code == 200: |
| 293 | + if 200 <= response.status_code < 300: |
293 | 294 | verbose_logger.debug( |
294 | 295 | "Galileo Logger: successfully flushed in memory records" |
295 | 296 | ) |
|
0 commit comments