azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

`infer_deployment` function broken

Open davidADSP opened this issue 2 years ago • 6 comments

  • Package Name: azureml-rag[faiss,document_parsing,cognitive_search,hugging_face]
  • Package Version: 0.2.2
  • Operating System: Linux
  • Python Version: 3.10

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.

davidADSP avatar Sep 21 '23 11:09 davidADSP

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

@azureml-github - Can you take a look?

swathipil avatar Sep 21 '23 15:09 swathipil

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

github-actions[bot] avatar Sep 21 '23 15:09 github-actions[bot]

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

MRvra-MSFT avatar Sep 26 '23 08:09 MRvra-MSFT

Bumping this as it is still occurring

muonmax avatar Oct 17 '23 00:10 muonmax

@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

tarunchopra avatar Feb 27 '24 03:02 tarunchopra

+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

PranshuBansalDev avatar Mar 11 '24 16:03 PranshuBansalDev