Document Intelligence Copy model rest api several bugs
Hi,
referring to this:
Im using 2024-07-31-preview copy and authorize api as I'm using 2AuthToAuth instead of key based access. I'm getting stuck at copy to rest api.
If I copy a model through document intelligence studio portal everything works as intended.
But when invoking the copy url with the following curl:
curl --location 'https://***.cognitiveservices.azure.com/documentintelligence/documentModels/****:copyTo?api-version=2024-07-31-preview' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ******' \
--data '{
"targetResourceId": "/subscriptions/****/resourceGroups/***/providers/Microsoft.CognitiveServices/accounts/****",
"targetResourceRegion": "westeurope",
"targetModelId": "name-of-model",
"targetModelLocation": "https://*.cognitiveservices.azure.com/documentintelligence/documentModels/name-of-model?api-version=2024-07-31-preview",
"accessToken": "221210dc-*****",
"expirationDateTime": "2024-08-20T15:03:13Z"
}'
It generates 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, doing the copy through the portal does succeed. So the model is ready.
I want to remark that if i run https://*****.cognitiveservices.azure.com/documentintelligence/documentModels?api-version=2024-07-31-preview
It doesn't show my model that is available if i look at models in Document Intelligence Studio.
Upon inspection, the model that doesn't show up has Api Version: 2024-02-29-preview and is part of a project with api version 2024-02-29-preview
But one model did show up when I ran the documentModel get request. That model displays api version 2024-02-29-preview and is part of a project with api version 2024-07-31-preview.
I assumed I would finally see my model show up as I changed the api version to the api version of the project in which it was created. But it doesn't show up.
If I run https://*.cognitiveservices.azure.com/documentintelligence/docu
{
"error": {
"code": "InternalServerError",
"message": "Unable to get resource information."
}
}
So to recap:
- When creating authorize request with rest api version 2024-07-31-preview it seems it actually reserves this model id in target source. You can't issue new authorize request with this model id in target source. This is very limiting. There is no way to cancel an authorize 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 be copied trough the Document Intelligence Studio web interface. So model is 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 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 op in List Model and will be copied to other DI instance.