ruoccofabrizio / azure-open-ai-embeddings-qna

A simple web application for a OpenAI-enabled document search. This repo uses Azure OpenAI Service for creating embeddings vectors from documents. For answering the question of a user, it retrieves the most relevant document and then uses GPT-3, GPT-3.5 or GPT-4 to extract the matching answer for the question.
https://azure.microsoft.com/en-us/products/cognitive-services/openai-service
MIT License
846 stars 510 forks source link

Log Error when Running Site #102

Open agrim3 opened 1 year ago

agrim3 commented 1 year ago

Hi Fabrizio. I saw a post was done on the same error, but no solution was provided. I launched my web-app, but upon loading in ran into an error (pasted below)

Traceback (most recent call last): File "/usr/local/src/myscripts/OpenAI_Queries.py", line 147, in llm_helper = LLMHelper(custom_prompt=st.session_state.custom_prompt, temperature=st.session_state.custom_temperature) File "/usr/local/src/myscripts/utilities/helper.py", line 92, in init self.embeddings: OpenAIEmbeddings = OpenAIEmbeddings(model=self.model, chunk_size=1) if embeddings is None else embeddings File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 1 validation error for OpenAIEmbeddings root Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)

Can you be so kind ot help me out ? Grazie, Alberto

ruoccofabrizio commented 1 year ago

Check your environment for the OPENAI_API_KEY variable