mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 09:25:06 +01:00
Only add images when they're present and vision enabled
This commit is contained in:
parent
bd55028115
commit
79b15e4594
1 changed files with 3 additions and 5 deletions
|
@ -277,9 +277,6 @@ def construct_structured_message(
|
||||||
"""
|
"""
|
||||||
Format messages into appropriate multimedia format for supported chat model types
|
Format messages into appropriate multimedia format for supported chat model types
|
||||||
"""
|
"""
|
||||||
if not images or not vision_enabled:
|
|
||||||
return message
|
|
||||||
|
|
||||||
constructed_messages = [
|
constructed_messages = [
|
||||||
{"type": "text", "text": message},
|
{"type": "text", "text": message},
|
||||||
]
|
]
|
||||||
|
@ -292,8 +289,9 @@ def construct_structured_message(
|
||||||
ChatModelOptions.ModelType.GOOGLE,
|
ChatModelOptions.ModelType.GOOGLE,
|
||||||
ChatModelOptions.ModelType.ANTHROPIC,
|
ChatModelOptions.ModelType.ANTHROPIC,
|
||||||
]:
|
]:
|
||||||
for image in images:
|
if vision_enabled and images:
|
||||||
constructed_messages.append({"type": "image_url", "image_url": {"url": image}})
|
for image in images:
|
||||||
|
constructed_messages.append({"type": "image_url", "image_url": {"url": image}})
|
||||||
|
|
||||||
return constructed_messages
|
return constructed_messages
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue