Skip to content

Commit eda7beb

Browse files
committed
Support 3.9
1 parent 00c3490 commit eda7beb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/openai_messages_token_helper/images_helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
from fractions import Fraction
55
from io import BytesIO
6+
from typing import Optional
67

78
from PIL import Image
89

@@ -17,7 +18,7 @@ def get_image_dims(image_uri: str) -> tuple[int, int]:
1718
raise ValueError("Image must be a base64 string.")
1819

1920

20-
def count_tokens_for_image(image_uri: str, detail: str = "auto", model: str | None = None) -> int:
21+
def count_tokens_for_image(image_uri: str, detail: str = "auto", model: Optional[str] = None) -> int:
2122
# From https://github.com/openai/openai-cookbook/pull/881/files
2223
# Based on https://platform.openai.com/docs/guides/vision
2324
multiplier = Fraction(1, 1)

0 commit comments

Comments
 (0)