Skip to content

Commit

Permalink
feat(OllamaEngine): handle only local images
Browse files Browse the repository at this point in the history
  • Loading branch information
AAClause committed Feb 14, 2025
1 parent e88c187 commit 676770f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions basilisk/provider_engine/ollama_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ def prepare_message_request(self, message: Message):
images = []
if message.attachments:
for attachment in message.attachments:
location = str(attachment.location)
# TODO: fix `attachment.type` (currently returns IMAGE_UNKNOWN instead of IMAGE_LOCAL)
# best way: `if attachment.type != ImageFileTypes.IMAGE_LOCAL:``
if (
location.startswith("http")
or location.startswith("data:")
or location.startswith("memory://")
):
log.warning(
f"Received unsupported image type: {attachment.type}, {attachment.location}"
)
raise NotImplementedError(
"Only local images are supported for Ollama"
)
images.append(attachment.location)
return {
"role": message.role.value,
Expand Down

0 comments on commit 676770f

Please sign in to comment.