GrowthEngineAI/async-openai

Import Issue related to Pydantic V1/V2

Opened this issue · 1 comments

After installing 'async-openai' into my projects environment with pipenv, I am receiving this issue:

In [1]: from async_openai import OpenAI, settings, CompletionResponse
    ....
    294     return import_string(REDIRECT_TO_V1[import_path])
    295 if import_path == 'pydantic:BaseSettings':
--> 296     raise PydanticImportError(
    297         '`BaseSettings` has been moved to the `pydantic-settings` package. '
    298         f'See https://docs.pydantic.dev/{version_short()}/migration/#basesettings-has-moved-to-pydantic-settings '
    299         'for more details.'
    300     )
    301 if import_path in REMOVED_IN_V2:
    302     raise PydanticImportError(f'`{import_path}` has been removed in V2.')
    
    PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.5/migration/#basesettings-has-moved-to-pydantic-settings for more details.

In the setup.py requirements, I see this note on line 21:

# 'pydantic-settings', # remove to allow for v1/v2 support

Assuming `remove ' means uncomment, simply reinstalling as such won't fix my issue; pydantic-settings is already in my environment:

$ pip freeze | grep pydantic
pydantic==2.5.2
pydantic-settings==2.1.0
pydantic_core==2.14.5

Was the change to setup.py enough to fix the issue in your environment? I'm seeing the same issue.