Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.6k stars 2.81k forks source link

Error importing openai in azure-ai-generative #33827

Closed pamelafox closed 6 days ago

pamelafox commented 9 months ago

Describe the bug

We get this error when using QADataGenerator:

    from azure.ai.generative.synthetic.qa import QADataGenerator, QAType
  File "/home/vscode/.local/lib/python3.11/site-packages/azure/ai/generative/synthetic/qa.py", line 33, in <module>
    openai.error.ServiceUnavailableError,
    ^^^^^^^^^^^^
AttributeError: module 'openai' has no attribute 'error'

I fixed it by adding openai==0.28.1 to our requirements.txt.

To Reproduce Steps to reproduce the behavior:

  1. Checkout repo at this point: https://github.com/Azure-Samples/ai-rag-chat-evaluator/tree/a96606c45d260ba6a690697eecac588b6dd3162f
  2. Run python3 -m scripts generate --output=example_input/qa.jsonl --numquestions=2 --persource=5
xiangyan99 commented 9 months ago

@kristapratico FYI.

kristapratico commented 9 months ago

@luigiw @needuv @paulshealy1 @singankit - please take a look

github-actions[bot] commented 9 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-ml-sdk @azureml-github.

luigiw commented 9 months ago

We have a release candidate that will support openai 1.x. That will fix this issue.

pamelafox commented 8 months ago

I am trying release candidate now, but it didn't realize that my installed openai (0.28) was incompatible. I think you need to bump the version constraints in https://github.com/Azure/azure-sdk-for-python/blob/75da6ac8e0ead6235ac09e3f725adce405b5adad/sdk/ai/azure-ai-generative/setup.py#L101 ?

paulshealy1 commented 6 days ago

Closing this issue for azure-ai-generative.