Dan-wanna-M / formatron

Formatron empowers everyone to control the format of language models' output with minimal overhead.
MIT License
163 stars 6 forks source link

Issue when Import Schema on Mac OS #20

Closed remichu-ai closed 1 month ago

remichu-ai commented 1 month ago

Hi,

I am encounter this this error when importing Schema class on Mac Os. Would like to know if this is fixable or you dont have plan to support Mac Os at the moment.

from formatron.schemas.pydantic import Schema

Error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[9], line 1
----> 1 from formatron.schemas.pydantic import Schema

File ~/miniconda3/envs/mlenv/lib/python3.11/site-packages/formatron/schemas/__init__.py:8
      6 from . import pydantic
      7 from . import dict_inference
----> 8 from . import json_schema

File ~/miniconda3/envs/mlenv/lib/python3.11/site-packages/formatron/schemas/json_schema.py:16
     14 import jsonschema
     15 from formatron import schemas
---> 16 from referencing import Registry, Resource
     18 class FieldInfo(schemas.schema.FieldInfo):
     19     __slots__ = ("_annotation",)

ModuleNotFoundError: No module named 'referencing'
Dan-wanna-M commented 1 month ago

@remichu-ai I do not have a MacOS computer so I currently cannot test formatron on MacOS. That said, I do not use any OS-specific library so I do not expect it to break due to operating system differences. Could you try pip install referencing? It should already be installed as a necessary dependency of jsonschema, but maybe something unknown went wrong.

remichu-ai commented 1 month ago

@Dan-wanna-M , you are right that issue gone after i explicitly install referencing. Though, not why it was not installed even when i run pip install -U formatron

I will close the issue, however, do consider to explicitly include this as dependency if need to.