nicholishen / tooldantic

Other
10 stars 3 forks source link

Syntax error when using with python3 #2

Closed Pietroro closed 1 month ago

Pietroro commented 2 months ago

Getting a SyntaxError when importing the OpenAiResponseFormatBaseModel module. I am using python 3.10.12.

Here is the Traceback (it may just be syntax that worked with a prior python version, but with not with a different one and a quick fix):

Traceback (most recent call last):
  File "****", line 4, in <module>
    from tooldantic import OpenAiResponseFormatBaseModel as BaseModel
  File "****/.local/lib/python3.10/site-packages/tooldantic/__init__.py", line 3, in <module>
    from .builder import ModelBuilder
  File "****/.local/lib/python3.10/site-packages/tooldantic/builder.py", line 158
    f"Extracted schema details: name={name}, description={
    ^
SyntaxError: unterminated string literal (detected at line 158)
nicholishen commented 1 month ago

Thanks for reporting this. It was an issue with Black formatter splitting f'strings at the braces. While it works with python >3.12 it caused issues with older versions. The fix has been merged.