oughtinc / ice

Interactive Composition Explorer: a debugger for compositional language model programs
https://ice.ought.org
MIT License
529 stars 66 forks source link

Pydantic version must be <2 and >=1.10.0 (Python 3.11 and ICE 0.5.0) #326

Open miloknowles opened 6 months ago

miloknowles commented 6 months ago

Context

I ran into some dependency issues when going through the Ought ICE primer. I thought I'd share the fix in case anyone else is in the same situation. For context, I'm using Python 3.11, and ought-ice == 0.5.0 installed via pip.

Problem

Due to #312, I needed to use pydantic < 2. I had Pydantic 1.9.x in my virtual environment, so I thought it would be compatible. But then I got this eventual error when importing ice:

  File "/Users/miloknowles/envs/ought-primer-SDTjr-vl/lib/python3.11/site-packages/pydantic/utils.py", line 258, in generate_model_signature
    merged_params[param_name] = Parameter(
                                ^^^^^^^^^^
  File "/Users/miloknowles/.pyenv/versions/3.11.7/lib/python3.11/inspect.py", line 2725, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'not' is not a valid parameter name

Solution

Due to this issue with FastAPI, I needed to upgrade to pydantic >= 1.10.0. This fixed the above error.

Maybe it would be helpful to pin a more precise version of Pydantic?