Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Fabric - cant import AzureOpenAI

when you try to run the sample code in a fabric pyspark(python) notebook you might instantly hit the following issue

 

ImportError: cannot import name 'AzureOpenAI' from 'openai' (/home/trusted-service-user/cluster-env/trident_env/lib/python3.10/site-packages/openai/__init__.py)

 

This is because the version 0.27.8 is the default in the fabric environment. To force a newer verison make sure to install it either inline or via an environment config

 

here is the inline code:

%pip install openai==1.12.0
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi. I must have chose the wrong type of post. I was not Posting a question but a solution.

    I followed the instructions from the github repo and ran into Thais issue. That's why I thought I'd post the solution for others to benefit.

  • Anonymous's avatar
    Anonymous
    2 years ago

    here is the inline code needed at the top of your script

     

    %pip install openai==1.12.0

8 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi. I must have chose the wrong type of post. I was not Posting a question but a solution.

      I followed the instructions from the github repo and ran into Thais issue. That's why I thought I'd post the solution for others to benefit.

      • Anonymous's avatar
        Anonymous
        Not applicable

        here is the inline code needed at the top of your script

         

        %pip install openai==1.12.0

    • arminokic's avatar
      arminokic
      Regular Visitor

      Hi! Do you know how to use this openai endpoint with Python? I am not sure how to authenticate correctly.