mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Keep chatml message content simple for wider compat unless attachments
This allows for wider compatibility with chat models and openai proxy ai model apis that expect message content to be string format, not objects.
This commit is contained in:
@@ -333,9 +333,10 @@ def construct_structured_message(
|
|||||||
ChatModelOptions.ModelType.GOOGLE,
|
ChatModelOptions.ModelType.GOOGLE,
|
||||||
ChatModelOptions.ModelType.ANTHROPIC,
|
ChatModelOptions.ModelType.ANTHROPIC,
|
||||||
]:
|
]:
|
||||||
constructed_messages: List[Any] = [
|
if not attached_file_context and not (vision_enabled and images):
|
||||||
{"type": "text", "text": message},
|
return message
|
||||||
]
|
|
||||||
|
constructed_messages: List[Any] = [{"type": "text", "text": message}]
|
||||||
|
|
||||||
if not is_none_or_empty(attached_file_context):
|
if not is_none_or_empty(attached_file_context):
|
||||||
constructed_messages.append({"type": "text", "text": attached_file_context})
|
constructed_messages.append({"type": "text", "text": attached_file_context})
|
||||||
|
|||||||
Reference in New Issue
Block a user