Skip to content

Commit

Permalink
Merge branch 'main' into nqn/filter-large-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kxtran committed Jun 17, 2024
2 parents 323f2e2 + feb8001 commit 3f7774c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Binary file removed tests/large_image.png
Binary file not shown.
19 changes: 14 additions & 5 deletions tests/test_magentic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Literal

import openai
Expand Down Expand Up @@ -188,14 +189,22 @@ async def _generate_title_and_description(query: str, widget_data: str) -> Widge
).assert_function_call_response()


@pytest.mark.async_client
@pytest.mark.widget
@pytest.mark.asyncio(scope="module")
async def test_large_image_upload(session, magentic_model):
@pytest.mark.vision
def test_large_image_upload(session):
# If large_image.png doesn't exist, download it from https://log10py-public.s3.us-east-2.amazonaws.com/large_image.png
if not os.path.exists("./tests/large_image.png"):
import requests

url = "https://log10py-public.s3.us-east-2.amazonaws.com/large_image.png"
response = requests.get(url)
with open("./tests/large_image.png", "wb") as f:
f.write(response.content)

with open("./tests/large_image.png", "rb") as f:
image_bytes = f.read()

@chatprompt(SystemMessage("What's in the following screenshot?"), UserImageMessage(image_bytes))
def _llm() -> str: ...

_llm()
output = _llm()
assert isinstance(output, str)

0 comments on commit 3f7774c

Please sign in to comment.