DocumentModelAdministrationClient class

Ügyfél a Form Recognizer szolgáltatás modellkezelési funkcióival való interakcióhoz, például modellek létrehozásához, olvasásához, listázásához, törléséhez és másolásához.

Példák:

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-kulcs (előfizetői azonosító)

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);

Konstruktorok

DocumentModelAdministrationClient(string, KeyCredential, DocumentModelAdministrationClientOptions)

DocumentModelAdministrationClient-példány létrehozása egy erőforrásvégpontból és egy statikus API-kulcsból (KeyCredential),

Példa:

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)

Hozzon létre egy DocumentModelAdministrationClient-példányt egy erőforrásvégpontból és egy Azure-identitásból TokenCredential.

Az Azure Active Directoryval történő hitelesítésről további információt a @azure/identity csomagban talál.

Példa:

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);

Metódusok

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

Hozzon létre egy új dokumentumosztályozót a megadott osztályozóazonosítóval és dokumentumtípusokkal.

Az osztályozóazonosítónak egyedinek kell lennie az erőforrás osztályozói között.

A dokumentumtípusok olyan objektumként vannak megadva, amely leképzi a dokumentumtípus nevét az adott dokumentumtípus betanítási adatkészletére. Két betanítási adatbeviteli módszer támogatott:

  • azureBlobSource, amely betanítja az osztályozót az adott Azure Blob Storage tároló adataival.
  • azureBlobFileListSource, amely hasonló azureBlobSource a JSONL-formátumú fájllistához, de lehetővé teszi a betanítási adatokban szereplő fájlok részletesebb szabályozását.

A Form Recognizer szolgáltatás beolvassa a betanítási adatokat egy Azure Storage-tárolóból, amely a tároló URL-címeként van megadva egy SAS-jogkivonattal, amely lehetővé teszi, hogy a szolgáltatás háttérrendszere kommunikáljon a tárolóval. Legalább az "olvasás" és a "lista" engedélyekre van szükség. Ezenkívül az adott tárolóban lévő adatokat egy adott konvenció szerint kell rendszerezni, amelyet a szolgáltatás egyéni dokumentumosztályozók készítésére vonatkozó dokumentációjában dokumentálunk.

Példa

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)

Hozzon létre egy új modellt egy adott azonosítóval a modell tartalomforrásából.

A modellazonosító bármilyen szövegből állhat, amennyiben nem az "előre összeállított" szöveggel kezdődik (mivel ezek a modellek az összes erőforrásra jellemző előre összeállított Form Recognizer modellekre vonatkoznak), és mindaddig, amíg még nem létezik az erőforráson belül.

A tartalomforrás ismerteti azt a mechanizmust, amelyet a szolgáltatás használni fog a bemeneti betanítási adatok olvasásához. További információért tekintse meg a <xref:DocumentModelContentSource> típust.

Példa

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)

Hozzon létre egy új modellt egy adott azonosítóval a bemeneti dokumentumok és a címkézett mezők készletéből.

A modellazonosító bármilyen szövegből állhat, amennyiben nem az "előre összeállított" szöveggel kezdődik (mivel ezek a modellek az összes erőforrásra jellemző előre összeállított Form Recognizer modellekre vonatkoznak), és mindaddig, amíg még nem létezik az erőforráson belül.

A Form Recognizer szolgáltatás beolvassa a betanítási adatokat egy Azure Storage-tárolóból, amely a tároló URL-címeként van megadva egy SAS-jogkivonattal, amely lehetővé teszi, hogy a szolgáltatás háttérrendszere kommunikáljon a tárolóval. Legalább az "olvasási" és a "listázási" engedélyekre van szükség. Emellett az adott tárolóban lévő adatokat egy adott konvenció szerint kell rendszerezni, amelyet a szolgáltatás egyéni modellek készítésére vonatkozó dokumentációjában dokumentálunk.

Példa

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)

Egyetlen összeállított modellt hoz létre több meglévő almodellből.

Az eredményül kapott összeállított modell egyesíti az összetevőmodellek dokumentumtípusait, és beszúr egy besorolási lépést az extrakciós folyamatba annak meghatározásához, hogy az összetevő-almodelljei közül melyik a legmegfelelőbb az adott bemenethez.

Példa

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)

Egy adott azonosítóval rendelkező modellt másol az erőforrásba és egy adott másolási engedély által kódolt modellazonosítóba.

Lásd: CopyAuthorization és getCopyAuthorization.

Példa

// 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)

Törli a megadott azonosítóval rendelkező osztályozót az ügyfél erőforrásából, ha létezik. Ez a művelet NEM állítható vissza.

Példa

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

Törli a megadott azonosítóval rendelkező modellt az ügyfél erőforrásából, ha létezik. Ez a művelet NEM állítható vissza.

Példa

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

Létrehoz egy engedélyt, amellyel a metódussal használt modellt másolhat az beginCopyModelTo erőforrásba.

A CopyAuthorization jogosultságot biztosít egy másik Cognitive Service-erőforrásnak arra, hogy modellt hozzon létre az ügyfél erőforrásában az engedélyezésbe kódolt modellazonosítóval és opcionális leírással.

Példa

// 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)

Egy osztályozó (DocumentClassifierDetails) adatait kéri le azonosító alapján.

Példa

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)

Egy modell (DocumentModelDetails) adatait kéri le azonosító alapján.

Ez a metódus lekérheti az egyéni és az előre összeállított modellekre vonatkozó információkat.

Kompatibilitástörő változás

A Form Recognizer REST API és SDK korábbi verzióiban a getModel metódus bármilyen modellt visszaadhat, még egy olyant is, amelyet hiba miatt nem sikerült létrehozni. Az új szolgáltatásverziókban, getDocumentModel és listDocumentModelscsak sikeresen létrehozott modelleket állít elő (azaz "használatra kész" modelleket). A sikertelen modellek lekérése mostantól az "operations" API-kon keresztül történik, lásd: getOperation és listOperations.

Példa

// 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)

Lekéri egy művelet adatait (OperationDetails) az azonosítója alapján.

A műveletek olyan nem elemzési feladatokat jelölnek, mint a modellek létrehozása, írása vagy másolása.

getResourceDetails(GetResourceDetailsOptions)

Alapvető információk lekérése az ügyfél erőforrásáról.

Példa

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)

Az erőforrás osztályozóinak adatainak listázása. Ez a művelet támogatja a lapozást.

Példák

Aszinkron iteráció

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;
}

Lap szerint

// 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)

Az erőforrás modelljeinek összegzéseinek listázása. A rendszer egyéni és előre összeállított modelleket is tartalmaz. Ez a művelet támogatja a lapozást.

A modell összefoglalása (DocumentModelSummary) csak a modell alapvető adatait tartalmazza, és nem tartalmaz információkat a modell dokumentumtípusairól (például a mezősémákról és a megbízhatósági értékekről).

A modell teljes információinak eléréséhez használja a getDocumentModel parancsot.

Kompatibilitástörő változás

A Form Recognizer REST API és az SDK korábbi verzióiban a listModels metódus az összes modellt visszaadja, még azokat is, amelyeket hibák miatt nem sikerült létrehozni. Az új szolgáltatásverziókban, listDocumentModels és getDocumentModelcsak sikeresen létrehozott modelleket állít elő (azaz "használatra kész" modelleket). A sikertelen modellek lekérése mostantól az "operations" API-kon keresztül történik, lásd: getOperation és listOperations.

Példák

Aszinkron iteráció

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);
}

Lap szerint

// 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)

Modelllétrehozási műveletek listázása az erőforrásban. Ez az összes műveletet létrehozza, beleértve azokat a műveleteket is, amelyek nem sikerült létrehozni a modelleket. Ez a művelet támogatja a lapozást.

Példák

Aszinkron iteráció

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;
}

Lap szerint

// 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;
  }
}

Konstruktor adatai

DocumentModelAdministrationClient(string, KeyCredential, DocumentModelAdministrationClientOptions)

DocumentModelAdministrationClient-példány létrehozása egy erőforrásvégpontból és egy statikus API-kulcsból (KeyCredential),

Példa:

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)

Paraméterek

endpoint

string

egy Azure Cognitive Services-példány végponti URL-címe

credential
KeyCredential

a Cognitive Services-példány előfizetési kulcsát tartalmazó KeyCredential

options
DocumentModelAdministrationClientOptions

választható beállítások az ügyfél összes metódusának konfigurálásához

DocumentModelAdministrationClient(string, TokenCredential, DocumentModelAdministrationClientOptions)

Hozzon létre egy DocumentModelAdministrationClient-példányt egy erőforrásvégpontból és egy Azure-identitásból TokenCredential.

Az Azure Active Directoryval történő hitelesítésről további információt a @azure/identity csomagban talál.

Példa:

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)

Paraméterek

endpoint

string

egy Azure Cognitive Services-példány végponti URL-címe

credential
TokenCredential

TokenCredential-példány a @azure/identity csomagból

options
DocumentModelAdministrationClientOptions

választható beállítások az ügyfél összes metódusának konfigurálásához

Metódus adatai

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

Hozzon létre egy új dokumentumosztályozót a megadott osztályozóazonosítóval és dokumentumtípusokkal.

Az osztályozóazonosítónak egyedinek kell lennie az erőforrás osztályozói között.

A dokumentumtípusok olyan objektumként vannak megadva, amely leképzi a dokumentumtípus nevét az adott dokumentumtípus betanítási adatkészletére. Két betanítási adatbeviteli módszer támogatott:

  • azureBlobSource, amely betanítja az osztályozót az adott Azure Blob Storage tároló adataival.
  • azureBlobFileListSource, amely hasonló azureBlobSource a JSONL-formátumú fájllistához, de lehetővé teszi a betanítási adatokban szereplő fájlok részletesebb szabályozását.

A Form Recognizer szolgáltatás beolvassa a betanítási adatokat egy Azure Storage-tárolóból, amely a tároló URL-címeként van megadva egy SAS-jogkivonattal, amely lehetővé teszi, hogy a szolgáltatás háttérrendszere kommunikáljon a tárolóval. Legalább az "olvasás" és a "lista" engedélyekre van szükség. Ezenkívül az adott tárolóban lévő adatokat egy adott konvenció szerint kell rendszerezni, amelyet a szolgáltatás egyéni dokumentumosztályozók készítésére vonatkozó dokumentációjában dokumentálunk.

Példa

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>

Paraméterek

classifierId

string

a létrehozandó osztályozó egyedi azonosítója

docTypeSources
DocumentClassifierDocumentTypeSources

az osztályozóban és azok forrásaiban szerepeltetni kívánt dokumentumtípusok (a dokumentumtípusnevek térképe a következőre ClassifierDocumentTypeDetails: )

options
BeginBuildDocumentClassifierOptions

az osztályozó buildelési műveletének választható beállításai

Válaszok

egy hosszú ideig futó művelet (poller), amely végül létrehozza a létrehozott osztályozó részleteit vagy hibát

beginBuildDocumentModel(string, DocumentModelSource, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Hozzon létre egy új modellt egy adott azonosítóval a modell tartalomforrásából.

A modellazonosító bármilyen szövegből állhat, amennyiben nem az "előre összeállított" szöveggel kezdődik (mivel ezek a modellek az összes erőforrásra jellemző előre összeállított Form Recognizer modellekre vonatkoznak), és mindaddig, amíg még nem létezik az erőforráson belül.

A tartalomforrás ismerteti azt a mechanizmust, amelyet a szolgáltatás használni fog a bemeneti betanítási adatok olvasásához. További információért tekintse meg a <xref:DocumentModelContentSource> típust.

Példa

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>

Paraméterek

modelId

string

a létrehozandó modell egyedi azonosítója

contentSource
DocumentModelSource

a modell betanítási adatait biztosító tartalomforrás

buildMode

DocumentModelBuildMode

a modell létrehozásakor használni kívánt mód (lásd DocumentModelBuildMode: )

options
BeginBuildDocumentModelOptions

a modell buildelési műveletének választható beállításai

Válaszok

egy hosszú ideig futó művelet (poller), amely végül létrehozza a létrehozott modelladatokat vagy hibát

beginBuildDocumentModel(string, string, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Hozzon létre egy új modellt egy adott azonosítóval a bemeneti dokumentumok és a címkézett mezők készletéből.

A modellazonosító bármilyen szövegből állhat, amennyiben nem az "előre összeállított" szöveggel kezdődik (mivel ezek a modellek az összes erőforrásra jellemző előre összeállított Form Recognizer modellekre vonatkoznak), és mindaddig, amíg még nem létezik az erőforráson belül.

A Form Recognizer szolgáltatás beolvassa a betanítási adatokat egy Azure Storage-tárolóból, amely a tároló URL-címeként van megadva egy SAS-jogkivonattal, amely lehetővé teszi, hogy a szolgáltatás háttérrendszere kommunikáljon a tárolóval. Legalább az "olvasási" és a "listázási" engedélyekre van szükség. Emellett az adott tárolóban lévő adatokat egy adott konvenció szerint kell rendszerezni, amelyet a szolgáltatás egyéni modellek készítésére vonatkozó dokumentációjában dokumentálunk.

Példa

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>

Paraméterek

modelId

string

a létrehozandó modell egyedi azonosítója

containerUrl

string

SAS-kódolású URL-cím a betanítási adatkészletet tartalmazó Azure Storage-tárolóhoz

buildMode

DocumentModelBuildMode

a modell létrehozásakor használandó mód (lásd: DocumentModelBuildMode)

options
BeginBuildDocumentModelOptions

a modell buildelési műveletének választható beállításai

Válaszok

egy hosszú ideig futó művelet (poller), amely végül létrehozza a létrehozott modellinformációkat vagy hibát

beginComposeDocumentModel(string, Iterable<string>, BeginComposeDocumentModelOptions)

Egyetlen összeállított modellt hoz létre több meglévő almodellből.

Az eredményül kapott összeállított modell egyesíti az összetevőmodellek dokumentumtípusait, és beszúr egy besorolási lépést az extrakciós folyamatba annak meghatározásához, hogy az összetevő-almodelljei közül melyik a legmegfelelőbb az adott bemenethez.

Példa

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>

Paraméterek

modelId

string

a létrehozandó modell egyedi azonosítója

componentModelIds

Iterable<string>

a összeállítandó modellek egyedi modellazonosítóit jelölő sztringek iterálható

options
BeginComposeDocumentModelOptions

nem kötelező beállítások a modell létrehozásához

Válaszok

egy hosszú ideig futó művelet (poller), amely végül létrehozza a létrehozott modellinformációkat vagy hibát

beginCopyModelTo(string, CopyAuthorization, BeginCopyModelOptions)

Egy adott azonosítóval rendelkező modellt másol az erőforrásba és egy adott másolási engedély által kódolt modellazonosítóba.

Lásd: CopyAuthorization és getCopyAuthorization.

Példa

// 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>

Paraméterek

sourceModelId

string

a másolandó forrásmodell egyedi azonosítója

authorization
CopyAuthorization

a getCopyAuthorization használatával létrehozott modell másolásának engedélyezése

options
BeginCopyModelOptions

nem kötelező beállítások a következőhöz:

Válaszok

egy hosszú ideig futó művelet (poller), amely végül létrehozza a másolt modellinformációkat vagy hibát

deleteDocumentClassifier(string, OperationOptions)

Törli a megadott azonosítóval rendelkező osztályozót az ügyfél erőforrásából, ha létezik. Ez a művelet NEM állítható vissza.

Példa

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

Paraméterek

classifierId

string

az erőforrásból törölni kívánt osztályozó egyedi azonosítója

options
OperationOptions

nem kötelező beállítások a kérelemhez

Válaszok

Promise<void>

deleteDocumentModel(string, DeleteDocumentModelOptions)

Törli a megadott azonosítóval rendelkező modellt az ügyfél erőforrásából, ha létezik. Ez a művelet NEM állítható vissza.

Példa

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

Paraméterek

modelId

string

az erőforrásból törölni kívánt modell egyedi azonosítója

options
DeleteDocumentModelOptions

nem kötelező beállítások a kérelemhez

Válaszok

Promise<void>

getCopyAuthorization(string, GetCopyAuthorizationOptions)

Létrehoz egy engedélyt, amellyel a metódussal használt modellt másolhat az beginCopyModelTo erőforrásba.

A CopyAuthorization jogosultságot biztosít egy másik Cognitive Service-erőforrásnak arra, hogy modellt hozzon létre az ügyfél erőforrásában az engedélyezésbe kódolt modellazonosítóval és opcionális leírással.

Példa

// 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>

Paraméterek

destinationModelId

string

a célmodell egyedi azonosítója (a modell másolásához használt azonosító)

options
GetCopyAuthorizationOptions

nem kötelező beállítások a másolási engedélyezés létrehozásához

Válaszok

egy másolati hitelesítés, amely a megadott modelId azonosítót és opcionális leírást kódolja

getDocumentClassifier(string, OperationOptions)

Egy osztályozó (DocumentClassifierDetails) adatait kéri le azonosító alapján.

Példa

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>

Paraméterek

classifierId

string

a lekérdezendő osztályozó egyedi azonosítója

options
OperationOptions

nem kötelező beállítások a kérelemhez

Válaszok

információk az osztályozóról a megadott azonosítóval

getDocumentModel(string, GetModelOptions)

Egy modell (DocumentModelDetails) adatait kéri le azonosító alapján.

Ez a metódus lekérheti az egyéni és az előre összeállított modellekre vonatkozó információkat.

Kompatibilitástörő változás

A Form Recognizer REST API és SDK korábbi verzióiban a getModel metódus bármilyen modellt visszaadhat, még egy olyant is, amelyet hiba miatt nem sikerült létrehozni. Az új szolgáltatásverziókban, getDocumentModel és listDocumentModelscsak sikeresen létrehozott modelleket állít elő (azaz "használatra kész" modelleket). A sikertelen modellek lekérése mostantól az "operations" API-kon keresztül történik, lásd: getOperation és listOperations.

Példa

// 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>

Paraméterek

modelId

string

a lekérdezendő modell egyedi azonosítója

options
GetModelOptions

nem kötelező beállítások a kérelemhez

Válaszok

információk a modellről a megadott azonosítóval

getOperation(string, GetOperationOptions)

Lekéri egy művelet adatait (OperationDetails) az azonosítója alapján.

A műveletek olyan nem elemzési feladatokat jelölnek, mint a modellek létrehozása, írása vagy másolása.

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

Paraméterek

operationId

string

a lekérdezési művelet azonosítója

options
GetOperationOptions

nem kötelező beállítások a kérelemhez

Válaszok

Promise<OperationDetails>

a művelettel kapcsolatos információk a megadott azonosítóval

Példa

// 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)

Alapvető információk lekérése az ügyfél erőforrásáról.

Példa

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>

Paraméterek

options
GetResourceDetailsOptions

nem kötelező beállítások a kérelemhez

Válaszok

Promise<ResourceDetails>

alapvető információk az ügyfél erőforrásáról

listDocumentClassifiers(ListModelsOptions)

Az erőforrás osztályozóinak adatainak listázása. Ez a művelet támogatja a lapozást.

Példák

Aszinkron iteráció

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;
}

Lap szerint

// 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>

Paraméterek

options
ListModelsOptions

nem kötelező beállítások az osztályozó kéréseihez

Válaszok

az osztályozó részleteinek aszinkron iterálása, amely támogatja a lapozást

listDocumentModels(ListModelsOptions)

Az erőforrás modelljeinek összegzéseinek listázása. A rendszer egyéni és előre összeállított modelleket is tartalmaz. Ez a művelet támogatja a lapozást.

A modell összefoglalása (DocumentModelSummary) csak a modell alapvető adatait tartalmazza, és nem tartalmaz információkat a modell dokumentumtípusairól (például a mezősémákról és a megbízhatósági értékekről).

A modell teljes információinak eléréséhez használja a getDocumentModel parancsot.

Kompatibilitástörő változás

A Form Recognizer REST API és az SDK korábbi verzióiban a listModels metódus az összes modellt visszaadja, még azokat is, amelyeket hibák miatt nem sikerült létrehozni. Az új szolgáltatásverziókban, listDocumentModels és getDocumentModelcsak sikeresen létrehozott modelleket állít elő (azaz "használatra kész" modelleket). A sikertelen modellek lekérése mostantól az "operations" API-kon keresztül történik, lásd: getOperation és listOperations.

Példák

Aszinkron iteráció

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);
}

Lap szerint

// 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>

Paraméterek

options
ListModelsOptions

a modellkérelmek választható beállításai

Válaszok

a lapozást támogató modellösszegzők aszinkron iterálása

listOperations(ListOperationsOptions)

Modelllétrehozási műveletek listázása az erőforrásban. Ez az összes műveletet létrehozza, beleértve azokat a műveleteket is, amelyek nem sikerült létrehozni a modelleket. Ez a művelet támogatja a lapozást.

Példák

Aszinkron iteráció

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;
}

Lap szerint

// 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>

Paraméterek

options
ListOperationsOptions

nem kötelező beállítások a műveleti kérelmekhez

Válaszok

a lapozást támogató műveletinformációs objektumok aszinkron iterálása