Hi everyone!
I am developing a RAG chatbot. I have tried different models using the AzureOpenAI center. Therefore, I had to change to a different region and therefore had to set up a new Azure OpenAI account than that I was using initially.
With the code for the chatbot, I have already managed to get through the error I am getting right now:
I am always getting the same error:
NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
With the new and the old Azure OpenAI account, I am not able to resolve this error. I have checked the key and endpoint are correct etc. I am still getting this error.
I also tried minimal code example like the one below.
I'd appreciate any help!
Thanks a lot in advance!
Best,
Johanna
Minimal code example(https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/switching-endpoints?source=recommendations):
Load environment variables for Azure OpenAI
from langchain.chat_models import AzureChatOpenAI
from langchain.schema import HumanMessage
os.environ['AZURE_OPENAI_API_KEY'] = 'xxxxxxxxxxx'
os.environ['AZURE_OPENAI_ENDPOINT'] = 'https://****.openai.azure.com/'
import os
from openai import AzureOpenAI
client = AzureOpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
api_version="2024-05-13", #used a different version number for the other Azure OpenAI account
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT")
)
completion = client.completions.create(
model="myexamplename", # This must match the custom deployment name you chose for your model.
prompt="<prompt>"
)
chat_completion = client.chat.completions.create(
model="gpt-4o", # model = "deployment_name".
messages="<messages>"
)
embedding = client.embeddings.create(
model="text-embedding-ada-002", # model = "deployment_name".
input="<input>"
)
gives:
NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Res