Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Openai attribute error on configure #1246

Closed
devjerry0 opened this issue Mar 18, 2025 · 1 comment
Closed

[bug] Openai attribute error on configure #1246

devjerry0 opened this issue Mar 18, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@devjerry0
Copy link

devjerry0 commented Mar 18, 2025

Describe the bug
Guardrails configure llm providers missing error key?!

To Reproduce
Steps to reproduce the behavior:

  1. uv add guardrails-ai
  2. guardrails configure

Expected behavior
Configuration for the hub / api key

Library version:
Version 0.1.8
uv add installs version 0.1.8 instead of 0.6.4 🤷

Additional context
There seem to be some errors with your openai import

Error:

.venv/lib/python3.12/site-packages/guardrails/llm_providers.py", line 17, in <module>
    openai.error.APIConnectionError,
    ^^^^^^^^^^^^
AttributeError: module 'openai' has no attribute 'error'

This one should work:

guardrails/llm_providers.py

OPENAI_RETRYABLE_ERRORS = [
    openai.APIConnectionError,
    openai.APIError,
    # openai.TryAgain,
    openai.Timeout,
    openai.RateLimitError,
    # openai.ServiceUnavailableError,
]

once fixed I am greeted with this error:

    from griffe.dataclasses import Docstring
ModuleNotFoundError: No module named 'griffe.dataclasses'

an upgrade fixed it, seems like the default version is somehow messed up?
pip install --upgrade guardrails-ai

@devjerry0 devjerry0 added the bug Something isn't working label Mar 18, 2025
@CalebCourier
Copy link
Collaborator

The error you're seeing regarding the openai error import is because version 0.1.8 of guardrails only supports 0.x versions of openai (the only major version that existed at the time). Likewise, the configure command did not exist in 0.1.8; the cli has changed drastically since then. As you pointed out, this is a non-issue if you upgrade to a newer version.

If I try to reproduce this issue in a clean environment I also see uv installing an older version (0.5.15). Since pip and poetry work as expected and install the latest version (0.6.4), this suggests the issue lies with uv, or possibly the environment uv is running in, and not the guardrails-ai package.

I'm going to close this for now, but please reach back out if you encounter other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants