Hello! This PR is by no means production ready, I mainly wanted to alert you to a couple issues I had with Azure and my (super quick) fixes.
Changes made:
The upload.py file was always creating a PGVector store with OpenAIEmbeddings(). In my use case, I am only using Azure. So without an openai key set, the app would not start up. I created a simple function that sees if there is an openai key env variable set and returns a PGVector store with OpenAIEmbeddings. If that was not found, it tries the same with Azure. If that was not found, it raises an exception.
In llms.py the AzureChatOpenAI was created with the openai_api_base variable set. As of openai>=1.0.0 this has been changed to azure_endpoint.
Also in llms.py during the startup of the app, it would crash due to me not having an OpenAI api key set. I created a simple try / catch block to try and fall back to Azure in that instance.
These changes work for me but as I do not have an openai api key I can not test for conflicts caused by these changes.
Hello! This PR is by no means production ready, I mainly wanted to alert you to a couple issues I had with Azure and my (super quick) fixes.
Changes made:
upload.py
file was always creating a PGVector store withOpenAIEmbeddings()
. In my use case, I am only using Azure. So without an openai key set, the app would not start up. I created a simple function that sees if there is an openai key env variable set and returns a PGVector store withOpenAIEmbeddings
. If that was not found, it tries the same with Azure. If that was not found, it raises an exception.llms.py
theAzureChatOpenAI
was created with theopenai_api_base
variable set. As ofopenai>=1.0.0
this has been changed toazure_endpoint
.llms.py
during the startup of the app, it would crash due to me not having an OpenAI api key set. I created a simple try / catch block to try and fall back to Azure in that instance.These changes work for me but as I do not have an openai api key I can not test for conflicts caused by these changes.