fix: OSS Python SDK hygiene batch, 9 small bug fixes (#6770)

This commit is contained in:
Kartik
2026-08-03 20:36:28 +05:30
committed by GitHub
parent 5f77d86caf
commit 8ca9a0f2c0
17 changed files with 201 additions and 86 deletions
+5 -3
View File
@@ -121,6 +121,8 @@ def remove_code_blocks(content: str) -> str:
- If a code block is detected, it returns only the inner content, stripping out the markers.
- If no code block markers are found, the original content is returned as-is.
"""
if content is None:
return ""
pattern = r"^```[a-zA-Z0-9]*\n([\s\S]*?)\n```$"
match = re.match(pattern, content.strip())
match_res=match.group(1).strip() if match else content.strip()
@@ -213,8 +215,8 @@ def parse_vision_messages(messages, llm=None, vision_details="auto"):
try:
description = get_image_description(image_url, llm, vision_details)
returned_messages.append({"role": role, "content": description})
except Exception:
raise Exception(f"Error while downloading {image_url}.")
except Exception as e:
raise Exception(f"Error while downloading {image_url}.") from e
else:
# Regular text content
returned_messages.append(msg)
@@ -227,7 +229,7 @@ def process_telemetry_filters(filters):
Process the telemetry filters
"""
if filters is None:
return {}
return [], {}
encoded_ids = {}
if "user_id" in filters: