Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-850] Large files break logger #184

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added examples/logging/large_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions examples/logging/large_image_upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import openai
from magentic import SystemMessage, chatprompt
from magentic.vision import UserImageMessage

from log10.load import log10


log10(openai)

with open("./examples/logging/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()
6 changes: 5 additions & 1 deletion log10/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,11 @@ def wrapper(*args, **kwargs):
while result_queue.empty():
pass
result = result_queue.get()
completionID = result["completionID"]

if result is None:
return output

completionID = result.get("completionID")
last_completion_response_var.set(result)

with timed_block("result call duration (sync)"):
Expand Down
Loading