Share via

Bugs copying a model using REST API

Menno Laan 0 Reputation points
2024-08-21T06:30:21.82+00:00

Hi there,

I'm trying to copy a model using the the REST API for Microsoft's Document Intelligence service. I'm using the 2024-07-31-preview copy and authorize api with 2AuthToAuth instead of key-based access, but I'm getting stuck at the copy-to REST API.

When I use Document Intelligence Studio portal to copy the model, everything works as intended. But when I try to copy the model via the REST API using curl with the provided parameters, I get an error 400 bad request with the following payload:

{
    "error": {
        "code": "InvalidRequest",
        "message": "Invalid request.",
        "innererror": {
            "code": "ModelNotReady",
            "message": "Model is not ready for the requested operation. Wait for training to complete or check for operation errors."
        }
    }
}

However, the copy through the portal was successful. So, the model should be ready.

Interestingly, when I run the API request https://*****.cognitiveservices.azure.com/documentintelligence/documentModels?api-version=2024-02-29-preview, it doesn't show my model that is available if I look at models in Document Intelligence Studio.

More importantly, creating authorize request with REST API version 2024-07-31-preview seems to reserve the model ID in the target source. If you issue a new authorize request with this model ID in the target source, it will fail. This is a very limiting feature. Furthermore, there is no way to cancel an authorized copy request.

Here are the things I've discovered so far:

When creating authorize request with REST API version 2024-07-31-preview, it actually reserves this model ID in the target source. You can't issue new authorize requests with this model ID in the target source. There is no way to cancel an authorized copy request: https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/authorize-model-copy?view=rest-aiservices-v4.0%20(2024-07-31-preview)&tabs=HTTP

Models created in a document intelligence project with api version 2024-02-29-preview with model api version 2024-02-29-preview created on 2024-06-20T08:24:17Z cannot be copied trough REST API: https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/copy-model-to?view=rest-aiservices-v4.0%20(2024-07-31-preview)&tabs=HTTP

Models created in a document intelligence project with api version 2024-02-29-preview with model api version 2024-02-29-preview created on 2024-06-20T08:24:17Z can be copied through the Document Intelligence Studio web interface, so the model should be ready for copy somehow.

Models created in a document intelligence project with api version 2024-02-29-preview with model api version 2024-02-29-preview created on 2024-06-20T08:24:17Z will not show up when invoking the API request: https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/list-models?view=rest-aiservices-v4.0%20(2024-07-31-preview)&tabs=HTTP

Models created in a document intelligence project with api version 2024-07-31-preview with model api version 2024-02-29-preview will show up in List Model and will be copied to other DI instances.

Azure Document Intelligence in Foundry Tools

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.