DocumentModelAdministrationClient class

Een client voor interactie met de modelbeheerfuncties van de Form Recognizer-service, zoals het maken, lezen, weergeven, verwijderen en kopiëren van modellen.

Voorbeelden:

Azure Active Directory

import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
import { DefaultAzureCredential } from "@azure/identity";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new DefaultAzureCredential();

const client = new DocumentModelAdministrationClient(endpoint, credential);

API-sleutel (abonnementssleutel)

import { DocumentModelAdministrationClient, AzureKeyCredential } from "@azure/ai-form-recognizer";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new AzureKeyCredential("<api key>");

const client = new DocumentModelAdministrationClient(endpoint, credential);

Constructors

DocumentModelAdministrationClient(string, KeyCredential, DocumentModelAdministrationClientOptions)

Een DocumentModelAdministrationClient-exemplaar maken van een resource-eindpunt en een statische API-sleutel (KeyCredential),

Voorbeeld:

import { DocumentModelAdministrationClient, AzureKeyCredential } from "@azure/ai-form-recognizer";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new AzureKeyCredential("<api key>");

const client = new DocumentModelAdministrationClient(endpoint, credential);
DocumentModelAdministrationClient(string, TokenCredential, DocumentModelAdministrationClientOptions)

Maak een DocumentModelAdministrationClient-exemplaar van een resource-eindpunt en een Azure-identiteit TokenCredential.

Zie het @azure/identity pakket voor meer informatie over verificatie met Azure Active Directory.

Voorbeeld:

import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
import { DefaultAzureCredential } from "@azure/identity";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new DefaultAzureCredential();

const client = new DocumentModelAdministrationClient(endpoint, credential);

Methoden

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

Bouw een nieuwe documentclassificatie met de opgegeven classificatie-id en documenttypen.

De classificatie-id moet uniek zijn tussen classificaties binnen de resource.

De documenttypen worden opgegeven als een object waarmee de naam van het documenttype wordt toegewezen aan de set trainingsgegevens voor dat documenttype. Er worden twee invoermethoden voor trainingsgegevens ondersteund:

  • azureBlobSource, waarmee een classificatie wordt getraind met behulp van de gegevens in de opgegeven Azure Blob Storage container.
  • azureBlobFileListSource, die vergelijkbaar is met azureBlobSource , maar biedt meer gedetailleerde controle over de bestanden die zijn opgenomen in de trainingsgegevensset met behulp van een bestandenlijst met JSONL-indeling.

De Form Recognizer-service leest de trainingsgegevensset uit een Azure Storage-container, die als URL naar de container wordt gegeven met een SAS-token waarmee de back-end van de service kan communiceren met de container. De machtigingen 'lezen' en 'lijst' zijn minimaal vereist. Bovendien moeten de gegevens in de opgegeven container worden georganiseerd volgens een bepaalde conventie, die wordt beschreven in de documentatie van de service voor het bouwen van aangepaste documentclassificaties.

Voorbeeld

const classifierId = "aNewClassifier";
const containerUrl1 = "<training data container SAS URL 1>";
const containerUrl2 = "<training data container SAS URL 2>";

const poller = await client.beginBuildDocumentClassifier(
  classifierId,
  {
    // The document types. Each entry in this object should map a document type name to a
    // `ClassifierDocumentTypeDetails` object
    "formX": {
      azureBlobSource: {
        containerUrl: containerUrl1,
      }
    },
    "formY": {
      azureBlobFileListSource: {
        containerUrl: containerUrl2,
        fileList: "path/to/fileList.jsonl"
      }
    },
  },
  {
    // Optionally, a text description may be attached to the classifier
    description: "This is an example classifier!"
  }
);

// Classifier building, like model creation operations, returns a poller that eventually produces a
// DocumentClassifierDetails object
const classifierDetails = await poller.pollUntilDone();

const {
  classifierId, // identical to the classifierId given when creating the classifier
  description, // identical to the description given when creating the classifier (if any)
  createdOn, // the Date (timestamp) that the classifier was created
  docTypes // information about the document types in the classifier and their details
} = classifierDetails;
beginBuildDocumentModel(string, DocumentModelSource, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Bouw een nieuw model met een opgegeven id uit een modelinhoudsbron.

De model-id kan bestaan uit elke tekst, zolang deze niet begint met 'vooraf gedefinieerd-' (omdat deze modellen verwijzen naar vooraf gemaakte Form Recognizer modellen die gemeenschappelijk zijn voor alle resources), en zolang deze nog niet bestaat in de resource.

De inhoudsbron beschrijft het mechanisme dat de service gebruikt om de invoertrainingsgegevens te lezen. Zie het <xref:DocumentModelContentSource> type voor meer informatie.

Voorbeeld

const modelId = "aNewModel";

const poller = await client.beginBuildDocumentModel(modelId, { containerUrl: "<SAS-encoded blob container URL>" }, {
  // Optionally, a text description may be attached to the model
  description: "This is an example model!"
});

// Model building, like all other model creation operations, returns a poller that eventually produces a ModelDetails
// object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the model
  description, // identical to the description given when creating the model
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types in the model and their field schemas
} = modelDetails;
beginBuildDocumentModel(string, string, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Bouw een nieuw model met een bepaalde id uit een set invoerdocumenten en gelabelde velden.

De model-id kan bestaan uit elke tekst, zolang deze niet begint met 'vooraf gedefinieerd-' (omdat deze modellen verwijzen naar vooraf gemaakte Form Recognizer modellen die gemeenschappelijk zijn voor alle resources), en zolang deze nog niet bestaat in de resource.

De Form Recognizer-service leest de trainingsgegevensset uit een Azure Storage-container, die als URL naar de container wordt gegeven met een SAS-token waarmee de back-end van de service kan communiceren met de container. De machtigingen 'lezen' en 'lijst' zijn minimaal vereist. Bovendien moeten de gegevens in de opgegeven container worden georganiseerd volgens een bepaalde conventie, die wordt beschreven in de documentatie van de service voor het bouwen van aangepaste modellen.

Voorbeeld

const modelId = "aNewModel";
const containerUrl = "<training data container SAS URL>";

const poller = await client.beginBuildDocumentModel(modelId, containerUrl, {
  // Optionally, a text description may be attached to the model
  description: "This is an example model!"
});

// Model building, like all other model creation operations, returns a poller that eventually produces a ModelDetails
// object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the model
  description, // identical to the description given when creating the model
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types in the model and their field schemas
} = modelDetails;
beginComposeDocumentModel(string, Iterable<string>, BeginComposeDocumentModelOptions)

Hiermee maakt u één samengesteld model op basis van verschillende bestaande submodellen.

Het resulterende samengestelde model combineert de documenttypen van de onderdeelmodellen en voegt een classificatiestap in de extractiepijplijn in om te bepalen welke van de submodellen van de component het meest geschikt is voor de opgegeven invoer.

Voorbeeld

const modelId = "aNewComposedModel";
const subModelIds = [
  "documentType1Model",
  "documentType2Model",
  "documentType3Model"
];

// The resulting composed model can classify and extract data from documents
// conforming to any of the above document types
const poller = await client.beginComposeDocumentModel(modelId, subModelIds, {
  description: "This is a composed model that can handle several document types."
});

// Model composition, like all other model creation operations, returns a poller that eventually produces a
// ModelDetails object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the model
  description, // identical to the description given when creating the model
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types of the composed submodels
} = modelDetails;
beginCopyModelTo(string, CopyAuthorization, BeginCopyModelOptions)

Kopieert een model met de opgegeven id naar de resource en model-id gecodeerd door een bepaalde kopieerautorisatie.

Zie CopyAuthorization en getCopyAuthorization.

Voorbeeld

// We need a client for the source model's resource
const sourceEndpoint = "https://<source resource name>.cognitiveservices.azure.com";
const sourceCredential = new AzureKeyCredential("<source api key>");
const sourceClient = new DocumentModelAdministrationClient(sourceEndpoint, sourceCredential);

// We create the copy authorization using a client authenticated with the destination resource. Note that these two
// resources can be the same (you can copy a model to a new ID in the same resource).
const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");

// Finally, use the _source_ client to copy the model and await the copy operation
const poller = await sourceClient.beginCopyModelTo("<source model ID>");

// Model copying, like all other model creation operations, returns a poller that eventually produces a ModelDetails
// object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the copy authorization
  description, // identical to the description given when creating the copy authorization
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types of the model (identical to the original, source model)
} = modelDetails;
deleteDocumentClassifier(string, OperationOptions)

Hiermee verwijdert u een classificatie met de opgegeven id uit de resource van de client, als deze bestaat. Deze bewerking kan niet worden teruggedraaid.

Voorbeeld

await client.deleteDocumentClassifier("<classifier ID to delete>"));
deleteDocumentModel(string, DeleteDocumentModelOptions)

Hiermee verwijdert u een model met de opgegeven id uit de resource van de client, indien aanwezig. Deze bewerking kan niet worden teruggedraaid.

Voorbeeld

await client.deleteDocumentModel("<model ID to delete>"));
getCopyAuthorization(string, GetCopyAuthorizationOptions)

Hiermee maakt u een autorisatie voor het kopiëren van een model naar de resource, die wordt gebruikt met de beginCopyModelTo -methode.

De CopyAuthorization verleent een andere Cognitive Service-resource het recht om een model te maken in de resource van deze client met de model-id en optionele beschrijving die zijn gecodeerd in de autorisatie.

Voorbeeld

// The copyAuthorization data structure stored below grants any cognitive services resource the right to copy a
// model into the client's resource with the given destination model ID.
const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");
getDocumentClassifier(string, OperationOptions)

Hiermee wordt informatie opgehaald over een classificatie (DocumentClassifierDetails) op basis van id.

Voorbeeld

const classifierId = "<classifier ID";

const {
  classifierId, // identical to the ID given when calling `getDocumentClassifier`
  description, // a textual description of the classifier, if provided during classifier creation
  createdOn, // the Date (timestamp) that the classifier was created
  // information about the document types in the classifier and their corresponding traning data
  docTypes
} = await client.getDocumentClassifier(classifierId);

// The `docTypes` property is a map of document type names to information about the training data
// for that document type.
for (const [docTypeName, classifierDocTypeDetails] of Object.entries(docTypes)) {
 console.log(`- '${docTypeName}': `, classifierDocTypeDetails);
}
getDocumentModel(string, GetModelOptions)

Hiermee haalt u informatie op over een model (DocumentModelDetails) op id.

Met deze methode kunt u informatie ophalen over aangepaste en vooraf gemaakte modellen.

Wijziging die fouten veroorzaakt

In eerdere versies van de Form Recognizer REST API en SDK kan de getModel methode elk model retourneren, zelfs een model dat niet kan worden gemaakt vanwege fouten. In de nieuwe serviceversies getDocumentModel worden listDocumentModelsalleen met succes gemaakte modellen geproduceerd (dat wil zeggen modellen die 'gereed' zijn voor gebruik). Mislukte modellen worden nu opgehaald via de API's voor bewerkingen. Zie getOperation en listOperations.

Voorbeeld

// The ID of the prebuilt business card model
const modelId = "prebuilt-businessCard";

const {
  modelId, // identical to the modelId given when calling `getDocumentModel`
  description, // a textual description of the model, if provided during model creation
  createdOn, // the Date (timestamp) that the model was created
  // information about the document types in the model and their field schemas
  docTypes: {
    // the document type of the prebuilt business card model
    "prebuilt:businesscard": {
      // an optional, textual description of this document type
      description,
      // the schema of the fields in this document type, see the FieldSchema type
      fieldSchema,
      // the service's confidences in the fields (an object with field names as properties and numeric confidence
      // values)
      fieldConfidence
    }
  }
} = await client.getDocumentModel(modelId);
getOperation(string, GetOperationOptions)

Hiermee wordt informatie opgehaald over een bewerking (OperationDetails) op basis van de id.

Bewerkingen vertegenwoordigen niet-analysetaken, zoals het bouwen, opstellen of kopiëren van een model.

getResourceDetails(GetResourceDetailsOptions)

Basisinformatie over de resource van deze client ophalen.

Voorbeeld

const {
  // Information about the custom models in the current resource
  customDocumentModelDetails: {
    // The number of custom models in the current resource
    count,
    // The maximum number of models that the current resource can support
    limit
  }
} = await client.getResourceDetails();
listDocumentClassifiers(ListModelsOptions)

Lijst met details over classificaties in de resource. Deze bewerking ondersteunt paging.

Voorbeelden

Asynchrone iteratie

for await (const details of client.listDocumentClassifiers()) {
  const {
    classifierId, // The classifier's unique ID
    description, // a textual description of the classifier, if provided during creation
    docTypes, // information about the document types in the classifier and their corresponding traning data
  } = details;
}

Op pagina

// The listDocumentClassifiers method is paged, and you can iterate by page using the `byPage` method.
const pages = client.listDocumentClassifiers().byPage();

for await (const page of pages) {
  // Each page is an array of classifiers and can be iterated synchronously
  for (const details of page) {
    const {
      classifierId, // The classifier's unique ID
      description, // a textual description of the classifier, if provided during creation
      docTypes, // information about the document types in the classifier and their corresponding traning data
    } = details;
  }
}
listDocumentModels(ListModelsOptions)

Overzichten van modellen in de resource weergeven. Aangepaste en vooraf gemaakte modellen worden opgenomen. Deze bewerking ondersteunt paging.

De modelsamenvatting (DocumentModelSummary) bevat alleen de basisinformatie over het model en bevat geen informatie over de documenttypen in het model (zoals de veldschema's en betrouwbaarheidswaarden).

Gebruik getDocumentModel voor toegang tot de volledige informatie over het model.

Wijziging die fouten veroorzaakt

In eerdere versies van de Form Recognizer REST API en SDK retourneert de listModels methode alle modellen, zelfs modellen die niet konden worden gemaakt vanwege fouten. In de nieuwe serviceversies listDocumentModels worden getDocumentModelalleen met succes gemaakte modellen geproduceerd (dat wil zeggen modellen die 'gereed' zijn voor gebruik). Mislukte modellen worden nu opgehaald via de API's voor bewerkingen. Zie getOperation en listOperations.

Voorbeelden

Asynchrone iteratie

for await (const summary of client.listDocumentModels()) {
  const {
    modelId, // The model's unique ID
    description, // a textual description of the model, if provided during model creation
  } = summary;

  // You can get the full model info using `getDocumentModel`
  const model = await client.getDocumentModel(modelId);
}

Op pagina

// The listDocumentModels method is paged, and you can iterate by page using the `byPage` method.
const pages = client.listDocumentModels().byPage();

for await (const page of pages) {
  // Each page is an array of models and can be iterated synchronously
  for (const model of page) {
    const {
      modelId, // The model's unique ID
      description, // a textual description of the model, if provided during model creation
    } = summary;

    // You can get the full model info using `getDocumentModel`
    const model = await client.getDocumentModel(modelId);
  }
}
listOperations(ListOperationsOptions)

Maak een lijst met bewerkingen voor het maken van modellen in de resource. Hiermee worden alle bewerkingen geproduceerd, inclusief bewerkingen waarvoor het maken van modellen is mislukt. Deze bewerking ondersteunt paging.

Voorbeelden

Asynchrone iteratie

for await (const operation of client.listOperations()) {
  const {
    operationId, // the operation's GUID
    status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
    percentCompleted // the progress of the operation, from 0 to 100
  } = operation;
}

Op pagina

// The listOperations method is paged, and you can iterate by page using the `byPage` method.
const pages = client.listOperations().byPage();

for await (const page of pages) {
  // Each page is an array of operation info objects and can be iterated synchronously
  for (const operation of page) {
    const {
      operationId, // the operation's GUID
      status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
      percentCompleted // the progress of the operation, from 0 to 100
    } = operation;
  }
}

Constructordetails

DocumentModelAdministrationClient(string, KeyCredential, DocumentModelAdministrationClientOptions)

Een DocumentModelAdministrationClient-exemplaar maken van een resource-eindpunt en een statische API-sleutel (KeyCredential),

Voorbeeld:

import { DocumentModelAdministrationClient, AzureKeyCredential } from "@azure/ai-form-recognizer";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new AzureKeyCredential("<api key>");

const client = new DocumentModelAdministrationClient(endpoint, credential);
new DocumentModelAdministrationClient(endpoint: string, credential: KeyCredential, options?: DocumentModelAdministrationClientOptions)

Parameters

endpoint

string

de eindpunt-URL van een Azure Cognitive Services-exemplaar

credential
KeyCredential

een KeyCredential met de abonnementssleutel van het Cognitive Services-exemplaar

options
DocumentModelAdministrationClientOptions

optionele instellingen voor het configureren van alle methoden in de client

DocumentModelAdministrationClient(string, TokenCredential, DocumentModelAdministrationClientOptions)

Maak een DocumentModelAdministrationClient-exemplaar van een resource-eindpunt en een Azure-identiteit TokenCredential.

Zie het @azure/identity pakket voor meer informatie over verificatie met Azure Active Directory.

Voorbeeld:

import { DocumentModelAdministrationClient } from "@azure/ai-form-recognizer";
import { DefaultAzureCredential } from "@azure/identity";

const endpoint = "https://<resource name>.cognitiveservices.azure.com";
const credential = new DefaultAzureCredential();

const client = new DocumentModelAdministrationClient(endpoint, credential);
new DocumentModelAdministrationClient(endpoint: string, credential: TokenCredential, options?: DocumentModelAdministrationClientOptions)

Parameters

endpoint

string

de eindpunt-URL van een Azure Cognitive Services-exemplaar

credential
TokenCredential

een TokenCredential-exemplaar uit het @azure/identity pakket

options
DocumentModelAdministrationClientOptions

optionele instellingen voor het configureren van alle methoden in de client

Methodedetails

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

Bouw een nieuwe documentclassificatie met de opgegeven classificatie-id en documenttypen.

De classificatie-id moet uniek zijn tussen classificaties binnen de resource.

De documenttypen worden opgegeven als een object waarmee de naam van het documenttype wordt toegewezen aan de set trainingsgegevens voor dat documenttype. Er worden twee invoermethoden voor trainingsgegevens ondersteund:

  • azureBlobSource, waarmee een classificatie wordt getraind met behulp van de gegevens in de opgegeven Azure Blob Storage container.
  • azureBlobFileListSource, die vergelijkbaar is met azureBlobSource , maar biedt meer gedetailleerde controle over de bestanden die zijn opgenomen in de trainingsgegevensset met behulp van een bestandenlijst met JSONL-indeling.

De Form Recognizer-service leest de trainingsgegevensset uit een Azure Storage-container, die als URL naar de container wordt gegeven met een SAS-token waarmee de back-end van de service kan communiceren met de container. De machtigingen 'lezen' en 'lijst' zijn minimaal vereist. Bovendien moeten de gegevens in de opgegeven container worden georganiseerd volgens een bepaalde conventie, die wordt beschreven in de documentatie van de service voor het bouwen van aangepaste documentclassificaties.

Voorbeeld

const classifierId = "aNewClassifier";
const containerUrl1 = "<training data container SAS URL 1>";
const containerUrl2 = "<training data container SAS URL 2>";

const poller = await client.beginBuildDocumentClassifier(
  classifierId,
  {
    // The document types. Each entry in this object should map a document type name to a
    // `ClassifierDocumentTypeDetails` object
    "formX": {
      azureBlobSource: {
        containerUrl: containerUrl1,
      }
    },
    "formY": {
      azureBlobFileListSource: {
        containerUrl: containerUrl2,
        fileList: "path/to/fileList.jsonl"
      }
    },
  },
  {
    // Optionally, a text description may be attached to the classifier
    description: "This is an example classifier!"
  }
);

// Classifier building, like model creation operations, returns a poller that eventually produces a
// DocumentClassifierDetails object
const classifierDetails = await poller.pollUntilDone();

const {
  classifierId, // identical to the classifierId given when creating the classifier
  description, // identical to the description given when creating the classifier (if any)
  createdOn, // the Date (timestamp) that the classifier was created
  docTypes // information about the document types in the classifier and their details
} = classifierDetails;
function beginBuildDocumentClassifier(classifierId: string, docTypeSources: DocumentClassifierDocumentTypeSources, options?: BeginBuildDocumentClassifierOptions): Promise<DocumentClassifierPoller>

Parameters

classifierId

string

de unieke id van de classificatie die moet worden gemaakt

docTypeSources
DocumentClassifierDocumentTypeSources

de documenttypen die moeten worden opgenomen in de classificatie en de bijbehorende bronnen (een toewijzing van documenttypenamen aan ClassifierDocumentTypeDetails)

options
BeginBuildDocumentClassifierOptions

optionele instellingen voor de buildbewerking van de classificatie

Retouren

een langdurige bewerking (poller) die uiteindelijk de gemaakte classificatiedetails of een fout produceert

beginBuildDocumentModel(string, DocumentModelSource, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Bouw een nieuw model met een opgegeven id uit een modelinhoudsbron.

De model-id kan bestaan uit elke tekst, zolang deze niet begint met 'vooraf gedefinieerd-' (omdat deze modellen verwijzen naar vooraf gemaakte Form Recognizer modellen die gemeenschappelijk zijn voor alle resources), en zolang deze nog niet bestaat in de resource.

De inhoudsbron beschrijft het mechanisme dat de service gebruikt om de invoertrainingsgegevens te lezen. Zie het <xref:DocumentModelContentSource> type voor meer informatie.

Voorbeeld

const modelId = "aNewModel";

const poller = await client.beginBuildDocumentModel(modelId, { containerUrl: "<SAS-encoded blob container URL>" }, {
  // Optionally, a text description may be attached to the model
  description: "This is an example model!"
});

// Model building, like all other model creation operations, returns a poller that eventually produces a ModelDetails
// object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the model
  description, // identical to the description given when creating the model
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types in the model and their field schemas
} = modelDetails;
function beginBuildDocumentModel(modelId: string, contentSource: DocumentModelSource, buildMode: DocumentModelBuildMode, options?: BeginBuildDocumentModelOptions): Promise<DocumentModelPoller>

Parameters

modelId

string

de unieke id van het model dat moet worden gemaakt

contentSource
DocumentModelSource

een inhoudsbron die de trainingsgegevens voor dit model levert

buildMode

DocumentModelBuildMode

de modus die moet worden gebruikt bij het bouwen van het model (zie DocumentModelBuildMode)

options
BeginBuildDocumentModelOptions

optionele instellingen voor de buildbewerking van het model

Retouren

een langdurige bewerking (poller) die uiteindelijk de gemaakte modelgegevens of een fout produceert

beginBuildDocumentModel(string, string, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Bouw een nieuw model met een bepaalde id uit een set invoerdocumenten en gelabelde velden.

De model-id kan bestaan uit elke tekst, zolang deze niet begint met 'vooraf gedefinieerd-' (omdat deze modellen verwijzen naar vooraf gemaakte Form Recognizer modellen die gemeenschappelijk zijn voor alle resources), en zolang deze nog niet bestaat in de resource.

De Form Recognizer-service leest de trainingsgegevensset uit een Azure Storage-container, die als URL naar de container wordt gegeven met een SAS-token waarmee de back-end van de service kan communiceren met de container. De machtigingen 'lezen' en 'lijst' zijn minimaal vereist. Bovendien moeten de gegevens in de opgegeven container worden georganiseerd volgens een bepaalde conventie, die wordt beschreven in de documentatie van de service voor het bouwen van aangepaste modellen.

Voorbeeld

const modelId = "aNewModel";
const containerUrl = "<training data container SAS URL>";

const poller = await client.beginBuildDocumentModel(modelId, containerUrl, {
  // Optionally, a text description may be attached to the model
  description: "This is an example model!"
});

// Model building, like all other model creation operations, returns a poller that eventually produces a ModelDetails
// object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the model
  description, // identical to the description given when creating the model
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types in the model and their field schemas
} = modelDetails;
function beginBuildDocumentModel(modelId: string, containerUrl: string, buildMode: DocumentModelBuildMode, options?: BeginBuildDocumentModelOptions): Promise<DocumentModelPoller>

Parameters

modelId

string

de unieke id van het model dat moet worden gemaakt

containerUrl

string

MET SAS gecodeerde URL naar een Azure Storage-container met de set trainingsgegevens

buildMode

DocumentModelBuildMode

de modus die moet worden gebruikt bij het bouwen van het model (zie DocumentModelBuildMode)

options
BeginBuildDocumentModelOptions

optionele instellingen voor de buildbewerking van het model

Retouren

een langdurige bewerking (poller) die uiteindelijk de gemaakte modelinformatie of een fout produceert

beginComposeDocumentModel(string, Iterable<string>, BeginComposeDocumentModelOptions)

Hiermee maakt u één samengesteld model op basis van verschillende bestaande submodellen.

Het resulterende samengestelde model combineert de documenttypen van de onderdeelmodellen en voegt een classificatiestap in de extractiepijplijn in om te bepalen welke van de submodellen van de component het meest geschikt is voor de opgegeven invoer.

Voorbeeld

const modelId = "aNewComposedModel";
const subModelIds = [
  "documentType1Model",
  "documentType2Model",
  "documentType3Model"
];

// The resulting composed model can classify and extract data from documents
// conforming to any of the above document types
const poller = await client.beginComposeDocumentModel(modelId, subModelIds, {
  description: "This is a composed model that can handle several document types."
});

// Model composition, like all other model creation operations, returns a poller that eventually produces a
// ModelDetails object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the model
  description, // identical to the description given when creating the model
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types of the composed submodels
} = modelDetails;
function beginComposeDocumentModel(modelId: string, componentModelIds: Iterable<string>, options?: BeginComposeDocumentModelOptions): Promise<DocumentModelPoller>

Parameters

modelId

string

de unieke id van het model dat moet worden gemaakt

componentModelIds

Iterable<string>

een iterable van tekenreeksen die de unieke model-id's vertegenwoordigen van de modellen die moeten worden samengesteld

options
BeginComposeDocumentModelOptions

optionele instellingen voor het maken van modellen

Retouren

een langdurige bewerking (poller) die uiteindelijk de gemaakte modelinformatie of een fout produceert

beginCopyModelTo(string, CopyAuthorization, BeginCopyModelOptions)

Kopieert een model met de opgegeven id naar de resource en model-id gecodeerd door een bepaalde kopieerautorisatie.

Zie CopyAuthorization en getCopyAuthorization.

Voorbeeld

// We need a client for the source model's resource
const sourceEndpoint = "https://<source resource name>.cognitiveservices.azure.com";
const sourceCredential = new AzureKeyCredential("<source api key>");
const sourceClient = new DocumentModelAdministrationClient(sourceEndpoint, sourceCredential);

// We create the copy authorization using a client authenticated with the destination resource. Note that these two
// resources can be the same (you can copy a model to a new ID in the same resource).
const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");

// Finally, use the _source_ client to copy the model and await the copy operation
const poller = await sourceClient.beginCopyModelTo("<source model ID>");

// Model copying, like all other model creation operations, returns a poller that eventually produces a ModelDetails
// object
const modelDetails = await poller.pollUntilDone();

const {
  modelId, // identical to the modelId given when creating the copy authorization
  description, // identical to the description given when creating the copy authorization
  createdOn, // the Date (timestamp) that the model was created
  docTypes // information about the document types of the model (identical to the original, source model)
} = modelDetails;
function beginCopyModelTo(sourceModelId: string, authorization: CopyAuthorization, options?: BeginCopyModelOptions): Promise<DocumentModelPoller>

Parameters

sourceModelId

string

de unieke id van het bronmodel dat wordt gekopieerd

authorization
CopyAuthorization

een autorisatie voor het kopiëren van het model, gemaakt met behulp van de getCopyAuthorization

options
BeginCopyModelOptions

optionele instellingen voor

Retouren

een langdurige bewerking (poller) die uiteindelijk de gekopieerde modelgegevens of een fout produceert

deleteDocumentClassifier(string, OperationOptions)

Hiermee verwijdert u een classificatie met de opgegeven id uit de resource van de client, als deze bestaat. Deze bewerking kan niet worden teruggedraaid.

Voorbeeld

await client.deleteDocumentClassifier("<classifier ID to delete>"));
function deleteDocumentClassifier(classifierId: string, options?: OperationOptions): Promise<void>

Parameters

classifierId

string

de unieke id van de classificatie die uit de resource moet worden verwijderd

options
OperationOptions

optionele instellingen voor de aanvraag

Retouren

Promise<void>

deleteDocumentModel(string, DeleteDocumentModelOptions)

Hiermee verwijdert u een model met de opgegeven id uit de resource van de client, indien aanwezig. Deze bewerking kan niet worden teruggedraaid.

Voorbeeld

await client.deleteDocumentModel("<model ID to delete>"));
function deleteDocumentModel(modelId: string, options?: DeleteDocumentModelOptions): Promise<void>

Parameters

modelId

string

de unieke id van het model dat uit de resource moet worden verwijderd

options
DeleteDocumentModelOptions

optionele instellingen voor de aanvraag

Retouren

Promise<void>

getCopyAuthorization(string, GetCopyAuthorizationOptions)

Hiermee maakt u een autorisatie voor het kopiëren van een model naar de resource, die wordt gebruikt met de beginCopyModelTo -methode.

De CopyAuthorization verleent een andere Cognitive Service-resource het recht om een model te maken in de resource van deze client met de model-id en optionele beschrijving die zijn gecodeerd in de autorisatie.

Voorbeeld

// The copyAuthorization data structure stored below grants any cognitive services resource the right to copy a
// model into the client's resource with the given destination model ID.
const copyAuthorization = await client.getCopyAuthorization("<destination model ID>");
function getCopyAuthorization(destinationModelId: string, options?: GetCopyAuthorizationOptions): Promise<CopyAuthorization>

Parameters

destinationModelId

string

de unieke id van het doelmodel (de id om het model naar te kopiëren)

options
GetCopyAuthorizationOptions

optionele instellingen voor het maken van de kopieerautorisatie

Retouren

een kopieautorisatie die de opgegeven modelId en optionele beschrijving codeert

getDocumentClassifier(string, OperationOptions)

Hiermee wordt informatie opgehaald over een classificatie (DocumentClassifierDetails) op basis van id.

Voorbeeld

const classifierId = "<classifier ID";

const {
  classifierId, // identical to the ID given when calling `getDocumentClassifier`
  description, // a textual description of the classifier, if provided during classifier creation
  createdOn, // the Date (timestamp) that the classifier was created
  // information about the document types in the classifier and their corresponding traning data
  docTypes
} = await client.getDocumentClassifier(classifierId);

// The `docTypes` property is a map of document type names to information about the training data
// for that document type.
for (const [docTypeName, classifierDocTypeDetails] of Object.entries(docTypes)) {
 console.log(`- '${docTypeName}': `, classifierDocTypeDetails);
}
function getDocumentClassifier(classifierId: string, options?: OperationOptions): Promise<DocumentClassifierDetails>

Parameters

classifierId

string

de unieke id van de classificatie die moet worden opgevraagd

options
OperationOptions

optionele instellingen voor de aanvraag

Retouren

informatie over de classificatie met de opgegeven id

getDocumentModel(string, GetModelOptions)

Hiermee haalt u informatie op over een model (DocumentModelDetails) op id.

Met deze methode kunt u informatie ophalen over aangepaste en vooraf gemaakte modellen.

Wijziging die fouten veroorzaakt

In eerdere versies van de Form Recognizer REST API en SDK kan de getModel methode elk model retourneren, zelfs een model dat niet kan worden gemaakt vanwege fouten. In de nieuwe serviceversies getDocumentModel worden listDocumentModelsalleen met succes gemaakte modellen geproduceerd (dat wil zeggen modellen die 'gereed' zijn voor gebruik). Mislukte modellen worden nu opgehaald via de API's voor bewerkingen. Zie getOperation en listOperations.

Voorbeeld

// The ID of the prebuilt business card model
const modelId = "prebuilt-businessCard";

const {
  modelId, // identical to the modelId given when calling `getDocumentModel`
  description, // a textual description of the model, if provided during model creation
  createdOn, // the Date (timestamp) that the model was created
  // information about the document types in the model and their field schemas
  docTypes: {
    // the document type of the prebuilt business card model
    "prebuilt:businesscard": {
      // an optional, textual description of this document type
      description,
      // the schema of the fields in this document type, see the FieldSchema type
      fieldSchema,
      // the service's confidences in the fields (an object with field names as properties and numeric confidence
      // values)
      fieldConfidence
    }
  }
} = await client.getDocumentModel(modelId);
function getDocumentModel(modelId: string, options?: GetModelOptions): Promise<DocumentModelDetails>

Parameters

modelId

string

de unieke id van het model dat moet worden opgevraagd

options
GetModelOptions

optionele instellingen voor de aanvraag

Retouren

informatie over het model met de opgegeven id

getOperation(string, GetOperationOptions)

Hiermee wordt informatie opgehaald over een bewerking (OperationDetails) op basis van de id.

Bewerkingen vertegenwoordigen niet-analysetaken, zoals het bouwen, opstellen of kopiëren van een model.

function getOperation(operationId: string, options?: GetOperationOptions): Promise<OperationDetails>

Parameters

operationId

string

de id van de bewerking die moet worden opgevraagd

options
GetOperationOptions

optionele instellingen voor de aanvraag

Retouren

Promise<OperationDetails>

informatie over de bewerking met de opgegeven id

Voorbeeld

// The ID of the operation, which should be a GUID
const operationId = "<operation GUID>";

const {
  operationId, // identical to the operationId given when calling `getOperation`
  kind, // the operation kind, one of "documentModelBuild", "documentModelCompose", or "documentModelCopyTo"
  status, // the status of the operation, one of "notStarted", "running", "failed", "succeeded", or "canceled"
  percentCompleted, // a number between 0 and 100 representing the progress of the operation
  createdOn, // a Date object that reflects the time when the operation was started
  lastUpdatedOn, // a Date object that reflects the time when the operation state was last modified
} = await client.getOperation(operationId);

getResourceDetails(GetResourceDetailsOptions)

Basisinformatie over de resource van deze client ophalen.

Voorbeeld

const {
  // Information about the custom models in the current resource
  customDocumentModelDetails: {
    // The number of custom models in the current resource
    count,
    // The maximum number of models that the current resource can support
    limit
  }
} = await client.getResourceDetails();
function getResourceDetails(options?: GetResourceDetailsOptions): Promise<ResourceDetails>

Parameters

options
GetResourceDetailsOptions

optionele instellingen voor de aanvraag

Retouren

Promise<ResourceDetails>

basisinformatie over de resource van deze client

listDocumentClassifiers(ListModelsOptions)

Lijst met details over classificaties in de resource. Deze bewerking ondersteunt paging.

Voorbeelden

Asynchrone iteratie

for await (const details of client.listDocumentClassifiers()) {
  const {
    classifierId, // The classifier's unique ID
    description, // a textual description of the classifier, if provided during creation
    docTypes, // information about the document types in the classifier and their corresponding traning data
  } = details;
}

Op pagina

// The listDocumentClassifiers method is paged, and you can iterate by page using the `byPage` method.
const pages = client.listDocumentClassifiers().byPage();

for await (const page of pages) {
  // Each page is an array of classifiers and can be iterated synchronously
  for (const details of page) {
    const {
      classifierId, // The classifier's unique ID
      description, // a textual description of the classifier, if provided during creation
      docTypes, // information about the document types in the classifier and their corresponding traning data
    } = details;
  }
}
function listDocumentClassifiers(options?: ListModelsOptions): PagedAsyncIterableIterator<DocumentClassifierDetails, DocumentClassifierDetails[], PageSettings>

Parameters

options
ListModelsOptions

optionele instellingen voor de classificatieaanvragen

Retouren

een asynchrone iterable van classificatiedetails die ondersteuning bieden voor paginering

listDocumentModels(ListModelsOptions)

Overzichten van modellen in de resource weergeven. Aangepaste en vooraf gemaakte modellen worden opgenomen. Deze bewerking ondersteunt paging.

De modelsamenvatting (DocumentModelSummary) bevat alleen de basisinformatie over het model en bevat geen informatie over de documenttypen in het model (zoals de veldschema's en betrouwbaarheidswaarden).

Gebruik getDocumentModel voor toegang tot de volledige informatie over het model.

Wijziging die fouten veroorzaakt

In eerdere versies van de Form Recognizer REST API en SDK retourneert de listModels methode alle modellen, zelfs modellen die niet konden worden gemaakt vanwege fouten. In de nieuwe serviceversies listDocumentModels worden getDocumentModelalleen met succes gemaakte modellen geproduceerd (dat wil zeggen modellen die 'gereed' zijn voor gebruik). Mislukte modellen worden nu opgehaald via de API's voor bewerkingen. Zie getOperation en listOperations.

Voorbeelden

Asynchrone iteratie

for await (const summary of client.listDocumentModels()) {
  const {
    modelId, // The model's unique ID
    description, // a textual description of the model, if provided during model creation
  } = summary;

  // You can get the full model info using `getDocumentModel`
  const model = await client.getDocumentModel(modelId);
}

Op pagina

// The listDocumentModels method is paged, and you can iterate by page using the `byPage` method.
const pages = client.listDocumentModels().byPage();

for await (const page of pages) {
  // Each page is an array of models and can be iterated synchronously
  for (const model of page) {
    const {
      modelId, // The model's unique ID
      description, // a textual description of the model, if provided during model creation
    } = summary;

    // You can get the full model info using `getDocumentModel`
    const model = await client.getDocumentModel(modelId);
  }
}
function listDocumentModels(options?: ListModelsOptions): PagedAsyncIterableIterator<DocumentModelSummary, DocumentModelSummary[], PageSettings>

Parameters

options
ListModelsOptions

optionele instellingen voor de modelaanvragen

Retouren

een asynchrone iterable van modelsamenvattingen die ondersteuning bieden voor paging

listOperations(ListOperationsOptions)

Maak een lijst met bewerkingen voor het maken van modellen in de resource. Hiermee worden alle bewerkingen geproduceerd, inclusief bewerkingen waarvoor het maken van modellen is mislukt. Deze bewerking ondersteunt paging.

Voorbeelden

Asynchrone iteratie

for await (const operation of client.listOperations()) {
  const {
    operationId, // the operation's GUID
    status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
    percentCompleted // the progress of the operation, from 0 to 100
  } = operation;
}

Op pagina

// The listOperations method is paged, and you can iterate by page using the `byPage` method.
const pages = client.listOperations().byPage();

for await (const page of pages) {
  // Each page is an array of operation info objects and can be iterated synchronously
  for (const operation of page) {
    const {
      operationId, // the operation's GUID
      status, // the operation status, one of "notStarted", "running", "succeeded", "failed", or "canceled"
      percentCompleted // the progress of the operation, from 0 to 100
    } = operation;
  }
}
function listOperations(options?: ListOperationsOptions): PagedAsyncIterableIterator<OperationSummary, OperationSummary[], PageSettings>

Parameters

options
ListOperationsOptions

optionele instellingen voor de bewerkingsaanvragen

Retouren

een asynchrone iterable van bewerkingsinformatieobjecten die paging ondersteunen