mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-12-18 10:37:11 +00:00
Keep chatml message content simple for wider compat unless attachments
Some checks are pending
dockerize / Publish Khoj Docker Images (push) Waiting to run
build and deploy github pages for documentation / deploy (push) Waiting to run
pre-commit / Setup Application and Lint (push) Waiting to run
pypi / Publish Python Package to PyPI (push) Waiting to run
test / Run Tests (push) Waiting to run
Some checks are pending
dockerize / Publish Khoj Docker Images (push) Waiting to run
build and deploy github pages for documentation / deploy (push) Waiting to run
pre-commit / Setup Application and Lint (push) Waiting to run
pypi / Publish Python Package to PyPI (push) Waiting to run
test / Run Tests (push) Waiting to run
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:
parent
4b4e0e20d4
commit
f8957e52bf
1 changed files with 4 additions and 3 deletions
|
@ -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})
|
||||||
|
|
Loading…
Reference in a new issue