gluck0101
gluck0101

Reputation: 155

Error: NotFoundError - Resource not found while implementing llama index with Azure OpenAI for fine-tuning

Description: During the implementation of the llama index with Azure OpenAI for fine-tuning, the following error occurred:

Retrying llama_index.llms.openai.base.OpenAI._chat in 0.6394267984578837 seconds as it raised NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}.

Code snippet:

# Perform query to retrieve the contexts and answers for the generated questions

self.llm = OpenAI(
    api_base=self.azure_openai_endpoint,
    api_key=self.azure_openai_api_key,
    api_version=self.azure_openai_api_version,
    model=self.model,
    temperature=self.temperature
)

query_engine = index.as_query_engine(similarity_top_k=2, llm=self.llm)

Additional Information: The error seems to be related to a NotFound error with code 404 indicating that the requested resource was not found.

Problem Statement: The issue occurs while trying to execute the query using Azure OpenAI. The error message suggests that the resource being requested is not found.

Solution Required: Please provide guidance on how to resolve this issue as I am unsure how to proceed.

Upvotes: 0

Views: 782

Answers (1)

JayashankarGS
JayashankarGS

Reputation: 8040

There is separate python package for azure OpenAI integration. So, create llm using AzureOpenAI.

First, install the integration package using below command.

%pip install llama-index-llms-azure-openai

Next, create llm.

from llama_index.llms.azure_openai import AzureOpenAI

aoai_api_key = "YOUR_AZURE_OPENAI_API_KEY"
aoai_endpoint = "YOUR_AZURE_OPENAI_ENDPOINT"
aoai_api_version = "2023-05-15"

llm = AzureOpenAI(
    model="YOUR_AZURE_OPENAI_COMPLETION_MODEL_NAME",
    deployment_name="YOUR_AZURE_OPENAI_COMPLETION_DEPLOYMENT_NAME",
    api_key=aoai_api_key,
    azure_endpoint=aoai_endpoint,
    api_version=aoai_api_version,
)

Use that llm while getting query engine.

Refer below documentation for more information.

Azure AI Search - LlamaIndex Azure OpenAI - LlamaIndex

Upvotes: 0

Related Questions