nlmatics / llmsherpa

Developer APIs to Accelerate LLM Projects
https://www.nlmatics.com
MIT License
1.17k stars 117 forks source link

ImportError: cannot import name 'AsyncAzureOpenAI' from 'openai' #26

Closed wrc3 closed 8 months ago

wrc3 commented 8 months ago

This error was generated using your code example.

Traceback (most recent call last): File "C:\Users\x\wc-chat-pdf-py-willis\layout-pdf-reader.py", line 2, in from llama_index.readers.schema.base import Document File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\llama_index__init.py", line 17, in from llama_index.embeddings.langchain import LangchainEmbedding File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\llama_index\embeddings\init.py", line 7, in from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\llama_index\embeddings\azure_openai.py", line 3, in from openai import AsyncAzureOpenAI, AzureOpenAI ImportError: cannot import name 'AsyncAzureOpenAI' from 'openai' (C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\init__.py)

ansukla commented 8 months ago

Hello,

This is not related to LayoutPDFParser. It looks like you are setup to access AzureOpenAI, not OpenAI directly. Please follow the instructions in LlamaIndex to use AzureOpenAI instead of OpenAI. See this page for more information: https://gpt-index.readthedocs.io/en/latest/examples/customization/llms/AzureOpenAI.html

ansukla commented 8 months ago

Closing the issue aas it has been resolved.