Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.63k stars 2.84k forks source link

`infer_deployment` function broken #32170

Open davidADSP opened 1 year ago

davidADSP commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

The infer_deployment function (from azureml.rag.utils.deployment import infer_deployment) contains reference to Deployment.list which isn't a valid method for the Deployment class from the openai package.

Digging into this a bit more - it's because there is no /deployments route here:

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/azureopenai.json or https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-07-01-preview/inference.json

However, there is a /models route.

So for example, https://aoairesourcename.openai.azure.com/openai/models?api-version=2023-07-01-preview will work but https://aoairesourcename.openai.azure.com/openai/deployments?api-version=2023-07-01-preview will not.

To Reproduce Steps to reproduce the behavior:

This will always fail to retrieve any deployments

from azureml.rag.utils.deployment import infer_deployment

aoai_embedding_model_name = "text-embedding-ada-002"
try:
    aoai_embedding_deployment_name = infer_deployment(
        aoai_connection, aoai_embedding_model_name
    )
    print(
        f"Deployment name in AOAI workspace for model '{aoai_embedding_model_name}' is '{aoai_embedding_deployment_name}'"
    )
except Exception as e:
    print(f"Deployment name in AOAI workspace for model '{aoai_embedding_model_name}' is not found.")
    print(
        f"Please create a deployment for this model by following the deploy instructions on the resource page for '{aoai_connection['properties']['target']}' in Azure Portal."
    )

e.g. from here https://github.com/Azure/azureml-examples/blob/main/sdk/python/generative-ai/rag/notebooks/mlindex_with_testgen_autoprompt.ipynb

Expected behavior A list of deployments should be retrieved

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

swathipil commented 1 year ago

Hi @davidADSP - Thanks for your detailed bug report! Tagging the right people.

@azureml-github - Can you take a look?

github-actions[bot] commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure @azureml-github @Azure/azure-ml-sdk.

iamramengirl commented 1 year ago

Following this as I also ran into this error today running the Notebook file.

muonmax commented 1 year ago

Bumping this as it is still occurring

tarunchopra commented 9 months ago

@luigiw @paulshealy1 Is there a workaround to this issue ? I'm trying to run this notebook and hitting same issue.

https://github.com/Azure/azureml-examples/blob/main/sdk/python/generative-ai/rag/notebooks/faiss/faiss_mlindex_with_langchain.ipynb

PranshuBansalDev commented 8 months ago

+1, my team is seeing pipeline build failures with this on azureml-rag v0.2.26

Downgrading to 0.2.25 seems to work for some reason