Skip to content

Commit

Permalink
Document Intelligence 2024-11-30 GA (#31522)
Browse files Browse the repository at this point in the history
* Document Intelligence 2024-11-30 GA

* Fix validation

* Address feedback.

* Update tspconfig.yaml

* Remove extra file

* Update description of `pages` for clarity.

* Update class names to reflect SDK architect feedback.  No behavioral change.

* More class renames.

---------

Co-authored-by: Harsha Nalluru <[email protected]>
  • Loading branch information
bojunehsu and HarshaNalluru authored Nov 16, 2024
1 parent 894ad2b commit dd4ae36
Show file tree
Hide file tree
Showing 79 changed files with 22,050 additions and 161 deletions.
128 changes: 78 additions & 50 deletions specification/ai/DocumentIntelligence/client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ using Azure.ClientGenerator.Core;
using DocumentIntelligence;

@TypeSpec.Versioning.useDependency(Azure.Core.Versions.v1_0_Preview_2)
@TypeSpec.Versioning.useDependency(
DocumentIntelligence.Versions.v2024_07_31_preview
)
@TypeSpec.Versioning.useDependency(DocumentIntelligence.Versions.v2024_11_30)
namespace ClientCustomizations;

@client({
Expand All @@ -21,12 +19,19 @@ interface DocumentIntelligenceClient {
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
analyzeDocument is DocumentModels.analyzeDocument;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
analyzeBatchDocuments is DocumentModels.analyzeBatchDocuments;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
getAnalyzeResultPdf is DocumentModels.getAnalyzeResultPdf;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
getAnalyzeResultFigure is DocumentModels.getAnalyzeResultFigure;

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
deleteAnalyzeResult is DocumentModels.deleteAnalyzeResult;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
analyzeBatchDocuments is DocumentModels.analyzeBatchDocuments;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
listAnalyzeBatchResults is DocumentModels.listAnalyzeBatchResults;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
deleteAnalyzeBatchResult is DocumentModels.deleteAnalyzeBatchResult;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
getAnalyzeBatchResult is DocumentModels.getAnalyzeBatchResult;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
classifyDocument is DocumentClassifiers.classifyDocument;
}
Expand All @@ -49,7 +54,7 @@ interface DocumentIntelligenceAdministrationClient {
deleteModel is DocumentModels.deleteModel;

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops"
getResourceInfo is MiscellaneousOperations.getResourceInfo;
getResourceDetails is MiscellaneousOperations.getResourceDetails;
getOperation is MiscellaneousOperations.getOperation;
listOperations is MiscellaneousOperations.listOperations;

Expand All @@ -69,21 +74,61 @@ interface DocumentIntelligenceAdministrationClient {
"csharp"
);
@@clientName(AnalyzeDocumentRequest, "AnalyzeDocumentContent", "csharp");
@@clientName(AnalyzeDocumentRequest.urlSource, "UriSource", "csharp");
@@clientName(AuthorizeClassifierCopyRequest,
"AuthorizeClassifierCopyContent",
"csharp"
);
@@clientName(AuthorizeCopyRequest, "AuthorizeCopyContent", "csharp");
@@clientName(AzureBlobContentSource, "BlobContentSource", "csharp");
@@clientName(AzureBlobContentSource.containerUrl, "ContainerUri", "csharp");
@@clientName(AzureBlobFileListContentSource,
"BlobFileListContentSource",
"csharp"
);
@@clientName(AzureBlobFileListContentSource.containerUrl,
"ContainerUri",
"csharp"
);
@@clientName(BuildDocumentClassifierRequest,
"BuildDocumentClassifierContent",
"csharp"
);
@@clientName(BuildDocumentClassifierRequest.docTypes,
"DocumentTypes",
"csharp"
);
@@clientName(BuildDocumentModelRequest, "BuildDocumentModelContent", "csharp");
@@clientName(BuildDocumentModelRequest.azureBlobSource, "BlobSource", "csharp");
@@clientName(BuildDocumentModelRequest.azureBlobFileListSource,
"BlobFileListSource",
"csharp"
);
@@clientName(ClassifierCopyAuthorization.expirationDateTime,
"ExpiresOn",
"csharp"
);
@@clientName(ClassifierDocumentTypeDetails.azureBlobSource,
"BlobSource",
"csharp"
);
@@clientName(ClassifierDocumentTypeDetails.azureBlobFileListSource,
"BlobFileListSource",
"csharp"
);
@@clientName(ClassifyDocumentRequest, "ClassifyDocumentContent", "csharp");
@@clientName(ClassifyDocumentRequest.urlSource, "UriSource", "csharp");
@@clientName(ComposeDocumentModelRequest,
"ComposeDocumentModelContent",
"csharp"
);
@@clientName(ComposeDocumentModelRequest.docTypes, "DocumentTypes", "csharp");
@@clientName(ContentSourceKind.azureBlob, "Blob", "csharp");
@@clientName(ContentSourceKind.azureBlobFileList, "BlobFileList", "csharp");
@@clientName(ContentSourceKind.url, "Uri", "csharp");
@@clientName(ModelCopyAuthorization.expirationDateTime, "ExpiresOn", "csharp");
@@clientName(AnalyzedDocument.docType, "DocumentType", "csharp");
@@clientName(DocumentAnalysisFeature.styleFont, "FontStyling", "csharp");
@@clientName(DocumentBarcodeKind.EAN13, "Ean13", "csharp");
@@clientName(DocumentBarcodeKind.EAN8, "Ean8", "csharp");
@@clientName(DocumentBarcodeKind.ITF, "Itf", "csharp");
Expand All @@ -93,63 +138,46 @@ interface DocumentIntelligenceAdministrationClient {
@@clientName(DocumentBarcodeKind.UPCA, "Upca", "csharp");
@@clientName(DocumentBarcodeKind.UPCE, "Upce", "csharp");
@@clientName(DocumentClassifierDetails.createdDateTime, "CreatedOn", "csharp");
@@clientName(DocumentClassifierDetails.docTypes, "DocumentTypes", "csharp");
@@clientName(DocumentClassifierDetails.expirationDateTime,
"ExpiresOn",
"csharp"
);
@@clientName(DocumentClassifierDetails.modifiedDateTime,
"ModifiedOn",
"csharp"
);
@@clientName(DocumentField.valueArray, "ValueList", "csharp");
@@clientName(DocumentField.valueInteger, "ValueLong", "csharp");
@@clientName(DocumentField.valueNumber, "ValueDouble", "csharp");
@@clientName(DocumentField.valueObject, "ValueDictionary", "csharp");
@@clientName(DocumentFieldSchema.type, "FieldType", "csharp");
@@clientName(DocumentFieldType.array, "List", "csharp");
@@clientName(DocumentFieldType.integer, "Long", "csharp");
@@clientName(DocumentFieldType.number, "Double", "csharp");
@@clientName(DocumentFieldType.object, "Dictionary", "csharp");
@@clientName(DocumentModelDetails.azureBlobSource, "BlobSource", "csharp");
@@clientName(DocumentModelDetails.azureBlobFileListSource,
"BlobFileListSource",
"csharp"
);
@@clientName(DocumentModelDetails.createdDateTime, "CreatedOn", "csharp");
@@clientName(DocumentModelDetails.docTypes, "DocumentTypes", "csharp");
@@clientName(DocumentModelDetails.expirationDateTime, "ExpiresOn", "csharp");
@@clientName(FontStyle, "DocumentFontStyle", "csharp");
@@clientName(FontWeight, "DocumentFontWeight", "csharp");
@@clientName(OperationDetails.createdDateTime, "CreatedOn", "csharp");
@@clientName(OperationDetails.lastUpdatedDateTime, "LastUpdatedOn", "csharp");

@@usage(DocumentAnalysisFeature, Usage.output, "csharp");
@@usage(LengthUnit, Usage.output, "csharp");
@@usage(DocumentSelectionMarkState, Usage.output, "csharp");
@@usage(DocumentBarcodeKind, Usage.output, "csharp");
@@usage(DocumentFormulaKind, Usage.output, "csharp");
@@usage(ParagraphRole, Usage.output, "csharp");
@@usage(DocumentTableCellKind, Usage.output, "csharp");
@@usage(FontStyle, Usage.output, "csharp");
@@usage(FontWeight, Usage.output, "csharp");
@@usage(DocumentFieldType, Usage.output, "csharp");
@@usage(DocumentSignatureType, Usage.output, "csharp");
@@usage(AnalyzeResult, Usage.output, "csharp");
@@usage(DocumentPage, Usage.output, "csharp");
@@usage(DocumentSpan, Usage.output, "csharp");
@@usage(DocumentWord, Usage.output, "csharp");
@@usage(DocumentSelectionMark, Usage.output, "csharp");
@@usage(DocumentLine, Usage.output, "csharp");
@@usage(DocumentBarcode, Usage.output, "csharp");
@@usage(DocumentFormula, Usage.output, "csharp");
@@usage(DocumentParagraph, Usage.output, "csharp");
@@usage(BoundingRegion, Usage.output, "csharp");
@@usage(DocumentTable, Usage.output, "csharp");
@@usage(DocumentTableCell, Usage.output, "csharp");
@@usage(DocumentFigure, Usage.output, "csharp");
@@usage(DocumentSection, Usage.output, "csharp");
@@usage(DocumentCaption, Usage.output, "csharp");
@@usage(DocumentFootnote, Usage.output, "csharp");
@@usage(DocumentKeyValuePair, Usage.output, "csharp");
@@usage(DocumentKeyValueElement, Usage.output, "csharp");
@@usage(DocumentStyle, Usage.output, "csharp");
@@usage(DocumentLanguage, Usage.output, "csharp");
@@usage(Document, Usage.output, "csharp");
@@usage(DocumentField, Usage.output, "csharp");
@@usage(CurrencyValue, Usage.output, "csharp");
@@usage(AddressValue, Usage.output, "csharp");
@@usage(BuildDocumentModelRequest, Usage.input, "csharp");
@@usage(ComposeDocumentModelRequest, Usage.input, "csharp");
@@usage(CopyAuthorization, Usage.input | Usage.output, "csharp");
@@clientName(DocumentModelDetails.modifiedDateTime, "ModifiedOn", "csharp");
// https://github.com/Azure/typespec-azure/issues/417
@@clientName(DocumentIntelligenceInnerError.innererror,
"InnerErrorObject",
"csharp"
);
@@clientName(DocumentIntelligenceOperationDetails.createdDateTime,
"CreatedOn",
"csharp"
);
@@clientName(DocumentIntelligenceOperationDetails.lastUpdatedDateTime,
"LastUpdatedOn",
"csharp"
);

@@clientName(AnalyzeDocumentRequest.base64Source, "bytesSource", "python");
@@clientName(ClassifyDocumentRequest.base64Source, "bytesSource", "python");
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"operationId": "DocumentModels_AnalyzeBatchDocuments",
"title": "Analyze Batch Documents",
"parameters": {
"endpoint": "https://myendpoint.cognitiveservices.azure.com",
"api-version": "2024-11-30",
"modelId": "customModel",
"pages": "1-5",
"locale": "en-US",
"stringIndexType": "textElements",
"analyzeBatchRequest": {
"azureBlobSource": {
"containerUrl": "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken",
"prefix": "trainingDocs/"
},
"resultContainerUrl": "https://myStorageAccount.blob.core.windows.net/myOutputContainer?mySasToken",
"resultPrefix": "trainingDocsResult/",
"overwriteExisting": true
}
},
"responses": {
"202": {
"headers": {
"Operation-Location": "https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/customModel/analyzeBatchResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-02-29-preview"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"operationId": "DocumentModels_AnalyzeDocument",
"title": "Analyze Document from Base64",
"parameters": {
"endpoint": "https://myendpoint.cognitiveservices.azure.com",
"api-version": "2024-11-30",
"modelId": "prebuilt-layout",
"pages": "1-2,4",
"locale": "en-US",
"stringIndexType": "textElements",
"analyzeRequest": {
"base64Source": "e2Jhc2U2NEVuY29kZWRQZGZ9"
}
},
"responses": {
"202": {
"headers": {
"Operation-Location": "https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-layout/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-11-30"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"operationId": "DocumentModels_AnalyzeDocumentFromStream",
"title": "Analyze Document from Url",
"parameters": {
"endpoint": "https://myendpoint.cognitiveservices.azure.com",
"api-version": "2024-11-30",
"modelId": "customModel",
"pages": "1-2,4",
"locale": "en-US",
"stringIndexType": "textElements",
"input": "{binaryFile}"
},
"responses": {
"202": {
"headers": {
"Operation-Location": "https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/customModel/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-11-30"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"operationId": "DocumentModels_AnalyzeDocument",
"title": "Analyze Document from Url",
"parameters": {
"endpoint": "https://myendpoint.cognitiveservices.azure.com",
"api-version": "2024-11-30",
"modelId": "customModel",
"pages": "1-2,4",
"locale": "en-US",
"stringIndexType": "textElements",
"analyzeRequest": {
"urlSource": "http://host.com/doc.pdf"
}
},
"responses": {
"202": {
"headers": {
"Operation-Location": "https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/customModel/analyzeResults/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2024-11-30"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"operationId": "DocumentClassifiers_AuthorizeClassifierCopy",
"title": "Authorize Copy of Document Classifier",
"parameters": {
"endpoint": "https://myendpoint.cognitiveservices.azure.com",
"api-version": "2024-11-30",
"authorizeCopyRequest": {
"classifierId": "targetClassifier",
"description": "Target classifier description"
}
},
"responses": {
"200": {
"body": {
"targetResourceId": "/subscriptions/targetSub/resourceGroups/targetRG/providers/Microsoft.CognitiveServices/accounts/targetService",
"targetResourceRegion": "targetResourceRegion",
"targetClassifierId": "targetClassifier",
"targetClassifierLocation": "https://targetEndpoint.cognitiveservices.azure.com/documentintelligence/documentClassifiers/targetClassifier",
"accessToken": "accessToken",
"expirationDateTime": "2021-09-23T09:12:54.552Z"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"operationId": "DocumentModels_AuthorizeModelCopy",
"title": "Authorize Copy of Document Model",
"parameters": {
"endpoint": "https://myendpoint.cognitiveservices.azure.com",
"api-version": "2024-11-30",
"authorizeCopyRequest": {
"modelId": "targetModel",
"description": "Target model description"
}
},
"responses": {
"200": {
"body": {
"targetResourceId": "/subscriptions/targetSub/resourceGroups/targetRG/providers/Microsoft.CognitiveServices/accounts/targetService",
"targetResourceRegion": "targetResourceRegion",
"targetModelId": "targetModel",
"targetModelLocation": "https://targetEndpoint.cognitiveservices.azure.com/documentintelligence/documentModels/targetModel",
"accessToken": "accessToken",
"expirationDateTime": "2021-09-23T09:12:54.552Z"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"operationId": "DocumentClassifiers_BuildClassifier",
"title": "Build Document Classifier",
"parameters": {
"endpoint": "https://myendpoint.cognitiveservices.azure.com",
"api-version": "2024-11-30",
"buildRequest": {
"classifierId": "myClassifier",
"description": "Classifier description",
"docTypes": {
"formA": {
"azureBlobSource": {
"containerUrl": "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken",
"prefix": "formADocs/"
}
},
"formB": {
"azureBlobFileListSource": {
"containerUrl": "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken",
"fileList": "formB.jsonl"
}
}
}
}
},
"responses": {
"202": {
"headers": {
"Operation-Location": "https://myendpoint.cognitiveservices.azure.com/documentintelligence/operations/b704bb00-d130-4f3f-a1d8-ca96de3eabb4?api-version=2024-11-30"
}
}
}
}
Loading

0 comments on commit dd4ae36

Please sign in to comment.