Share via

Resource not found using client.get_model_info()

strawberrybfs 5 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 in Foundry Models
Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

0 comments No comments

1 answer

Sort by: Most helpful
  1. Max Lacy 345 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.

    Was this answer helpful?


Your answer

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