yvann-ba / Robby-chatbot

AI chatbot 🤖 for chat with CSV, PDF, TXT files 📄 and YTB videos 🎥 | using Langchain🦜 | OpenAI | Streamlit ⚡
MIT License
766 stars 287 forks source link

Cannot use Azure OpenAI APIs with the chatbot #44

Closed al-yakubovich closed 1 year ago

al-yakubovich commented 1 year ago

Awesome chatbot! I tried to add Azure OpenAI APIs did changes in chatbot.py:

from langchain.chat_models import AzureChatOpenAI
llm = AzureChatOpenAI(model_name=self.model_name, temperature=self.temperature, deployment_name = 'My_Test')

And also I add this into 1_📄Robby-Chat.py:

    os.environ["OPENAI_API_KEY"] = user_api_key
    os.environ["OPENAI_API_TYPE"] = "azure"
    os.environ["OPENAI_API_BASE"] = 'https://my_test_chat.openai.azure.com/'
    os.environ["OPENAI_API_VERSION"] = "2023-05-15"

But I am getting Error message when try to ask the bot: Error: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.

yvann-ba commented 1 year ago

Hi, I have never used Azure, I advise you to look at the doc or the issues of the langchain repo you will surely find answers

https://python.langchain.com/en/latest/modules/models/chat/integrations/azure_chat_openai.html?highlight=azure

Have a nice day

al-yakubovich commented 1 year ago

Thanks.