Skip to content

Commit

Permalink
feat: display media artifact creation for ui (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyiqunLu authored Oct 10, 2024
1 parent 2fb51db commit 1ba5438
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions vision_agent/tools/meta_tools.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
import difflib
import json
import os
Expand Down Expand Up @@ -510,6 +511,19 @@ def write_media_artifact(
return f"[Invalid media type {type(media)}]"
artifacts[name] = media_bytes
print(f"[Media {name} saved]")
display(
{
MimeType.APPLICATION_ARTIFACT: json.dumps(
{
"name": name,
"action": "create",
"content": base64.b64encode(media_bytes).decode("utf-8"),
"contentType": "media_output",
}
)
},
raw=True,
)
return f"[Media {name} saved]"


Expand Down

0 comments on commit 1ba5438

Please sign in to comment.