Resource not found using client.get_model_info()

strawberrybfs 0 Reputation points
2024-11-24T05:24:44.8166667+00:00

I was following this tutorial https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-llama?tabs=python-llama-3-2%2Cmeta-llama-3-1&pivots=programming-language-python

I used the following code and got error azure.core.exceptions.ResourceNotFoundError: (404) Resource not found

Does anyone know what happened here? Thank you!

client = ChatCompletionsClient(
    endpoint=api_llama.AZURE_ENDPOINT,
    credential=AzureKeyCredential(api_llama.API_KEY),
)

model_info = client.get_model_info()
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,322 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,938 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Max Lacy 180 Reputation points
    2024-11-24T21:45:40.3366667+00:00

    Hello strawberrybfs,

    Looks like you're working through the tutorial for deploying models. Typically, when I have a "Resource not found" error I like to verify my API endpoint and key. You can use a debugger or print to your terminal with a print statement above the chat completions client.

    print(endpoint, key)  ## if you want to debug using print statements
    
    client = ChatCompletionsClient(endpoint=api_llama.AZURE_ENDPOINT, credential=AzureKeyCredential(api_llama.API_KEY), ) 
    
    model_info = client.get_model_info()
    

    Check that your env variables match the endpoints setup from the earlier steps in the tutorial. As a reminder to ensure the security of your applications and data, never share your API keys with anyone.

    If they env variables are as you expect. You can use AI foundry for example code to compare your code.

    An alternate route would be to use something like Postman to do a API call using the same tutorial but instead of using python select REST as the programming language.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.