Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
markwaddle committed Dec 10, 2024
1 parent bca6141 commit 4dc087e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions assistants/prospector-assistant/assistant/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import deepmerge
import openai_client
from assistant_extensions.ai_clients.model import CompletionMessageImageContent
from assistant_extensions.attachments import AttachmentsExtension
from content_safety.evaluators import CombinedContentSafetyEvaluator
from openai.types.chat import ChatCompletionMessageParam
Expand Down Expand Up @@ -260,13 +261,16 @@ async def get(filename: str) -> str:
if not user_message:
return ""

content = user_message["content"]
if isinstance(content, str):
return content
content = user_message.content
match content:
case str():
return content

for part in content:
if part.get("type") == "image_url" and "image_url" in part:
return part["image_url"]["url"]
case list():
for part in content:
match part:
case CompletionMessageImageContent():
return part.data

return ""

Expand Down

0 comments on commit 4dc087e

Please sign in to comment.