Only add the image_url to the constructed chat message if it is a url

This commit is contained in:
sabaimran 2024-11-30 14:39:27 -08:00
parent 991577aa17
commit 224abd14e0

View file

@ -344,7 +344,8 @@ def construct_structured_message(
constructed_messages.append({"type": "text", "text": attached_file_context})
if vision_enabled and images:
for image in images:
constructed_messages.append({"type": "image_url", "image_url": {"url": image}})
if image.startswith("https://"):
constructed_messages.append({"type": "image_url", "image_url": {"url": image}})
return constructed_messages
if not is_none_or_empty(attached_file_context):