Share via


DocumentModelAdministrationClient class

modelleri oluşturma, okuma, listeleme, silme ve kopyalama gibi Form Tanıma hizmetinin model yönetimi özellikleriyle etkileşime yönelik bir istemci.

Örnekler:

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 Anahtarı (Abonelik Anahtarı)

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

Oluşturucular

DocumentModelAdministrationClient(string, KeyCredential, DocumentModelAdministrationClientOptions)

Kaynak uç noktasından ve statik API anahtarından DocumentModelAdministrationClient örneği oluşturma (KeyCredential),

Örnek:

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)

Kaynak uç noktasından ve Azure Identity'den TokenCredentialDocumentModelAdministrationClient örneği oluşturun.

@azure/identity Azure Active Directory ile kimlik doğrulaması hakkında daha fazla bilgi için pakete bakın.

Örnek:

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

Yöntemler

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

Verilen sınıflandırıcı kimliği ve belge türleriyle yeni bir belge sınıflandırıcı oluşturun.

Sınıflandırıcı kimliği, kaynak içindeki sınıflandırıcılar arasında benzersiz olmalıdır.

Belge türleri, belge türünün adını bu belge türü için eğitim veri kümesiyle eşleyen bir nesne olarak verilir. İki eğitim verisi giriş yöntemi desteklenir:

  • azureBlobSource, verilen Azure Blob Depolama kapsayıcıdaki verileri kullanarak sınıflandırıcıyı eğiter.
  • azureBlobFileListSourcebenzer ancak azureBlobSource JSONL biçimli bir dosya listesi kullanarak eğitim veri kümesine dahil edilen dosyalar üzerinde daha ayrıntılı denetim sağlar.

Form Tanıma hizmeti, hizmet arka ucun kapsayıcıyla iletişim kurmasını sağlayan SAS belirtecine sahip kapsayıcının URL'si olarak verilen azure depolama kapsayıcısından eğitim veri kümesini okur. En azından "okuma" ve "liste" izinleri gereklidir. Ayrıca, belirli bir kapsayıcıdaki verilerin, hizmetin özel belge sınıflandırıcıları oluşturmaya yönelik belgelerinde belgelenen belirli bir kurala göre düzenlenmesi gerekir.

Örnek

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)

Model içerik kaynağından belirli bir kimlikle yeni bir model oluşturun.

Model Kimliği, "önceden oluşturulmuş-" ile başlamadığı sürece (bu modeller tüm kaynaklar için ortak olan önceden oluşturulmuş Form Tanıma modellerini ifade eder) ve kaynak içinde mevcut olmadığı sürece herhangi bir metinden oluşabilir.

İçerik kaynağı, hizmetin giriş eğitim verilerini okumak için kullanacağı mekanizmayı açıklar. Daha fazla bilgi için türüne <xref:DocumentModelContentSource> bakın.

Örnek

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)

Bir dizi giriş belgesinden ve etiketlenmiş alanlardan belirli bir kimliğe sahip yeni bir model oluşturun.

Model Kimliği, "önceden oluşturulmuş-" ile başlamadığı sürece (bu modeller tüm kaynaklar için ortak olan önceden oluşturulmuş Form Tanıma modellerini ifade eder) ve kaynak içinde mevcut olmadığı sürece herhangi bir metinden oluşabilir.

Form Tanıma hizmeti, hizmet arka ucun kapsayıcıyla iletişim kurmasını sağlayan SAS belirtecine sahip kapsayıcının URL'si olarak verilen azure depolama kapsayıcısından eğitim veri kümesini okur. En azından "okuma" ve "liste" izinleri gereklidir. Ayrıca, verilen kapsayıcıdaki verilerin, hizmetin özel modeller oluşturmaya yönelik belgelerinde belgelenen belirli bir kurala göre düzenlenmesi gerekir.

Örnek

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)

Önceden var olan birkaç alt modelden tek bir oluşturulmuş model oluşturur.

Elde edilen oluşturulan model, bileşen modellerinin belge türlerini birleştirir ve bileşen alt modellerinden hangisinin verilen giriş için en uygun olduğunu belirlemek için ayıklama işlem hattına bir sınıflandırma adımı ekler.

Örnek

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)

Verilen kimliğe sahip bir modeli, belirli bir kopyalama yetkilendirmesi tarafından kodlanmış kaynağa ve model kimliğine kopyalar.

Bkz . CopyAuthorization ve getCopyAuthorization.

Örnek

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

Varsa, istemcinin kaynağından verilen kimliğe sahip bir sınıflandırıcıyı siler. Bu işlem geri alınamaz.

Örnek

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

Varsa, verilen kimliğe sahip bir modeli istemcinin kaynağından siler. Bu işlem geri alınamaz.

Örnek

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

Yöntemiyle beginCopyModelTo kullanılan bir modeli kaynağa kopyalamak için bir yetkilendirme oluşturur.

, CopyAuthorization başka bir bilişsel hizmet kaynağına bu istemcinin kaynağında model kimliği ve yetkilendirmeye kodlanmış isteğe bağlı açıklama ile model oluşturma hakkı verir.

Örnek

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

Kimliğine göre bir sınıflandırıcı (DocumentClassifierDetails) hakkındaki bilgileri alır.

Örnek

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)

Model (DocumentModelDetails) hakkındaki bilgileri kimliğine göre alır.

Bu yöntem hem özel hem de önceden oluşturulmuş modeller hakkındaki bilgileri alabilir.

Hataya Neden Olan Değişiklik

Form Tanıma REST API ve SDK'nın önceki sürümlerinde yöntem, getModel hatalar nedeniyle oluşturulamayan herhangi bir modeli bile döndürebiliyor. Yeni hizmet sürümlerinde getDocumentModel ve listDocumentModelsyalnızca başarıyla oluşturulmuş modeller (yani kullanıma "hazır" modeller) üretin. Başarısız modeller artık "işlem" API'leri aracılığıyla alınıyor, bkz. getOperation ve listOperations.

Örnek

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

Kimliğine göre bir işlem (OperationDetails) hakkındaki bilgileri alır.

İşlemler model oluşturma, oluşturma veya kopyalama gibi analiz dışı görevleri temsil ediyor.

getResourceDetails(GetResourceDetailsOptions)

Bu istemcinin kaynağıyla ilgili temel bilgileri alın.

Örnek

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)

Kaynaktaki sınıflandırıcılarla ilgili ayrıntıları listeleyin. Bu işlem disk belleğini destekler.

Örnekler

Zaman Uyumsuz Yineleme

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

Sayfaya Göre

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

Kaynaktaki modellerin özetlerini listeleyin. Özel ve önceden oluşturulmuş modeller dahil edilecek. Bu işlem disk belleğini destekler.

Model özeti (DocumentModelSummary) yalnızca modelle ilgili temel bilgileri içerir ve modeldeki belge türleri (alan şemaları ve güvenilirlik değerleri gibi) hakkında bilgi içermez.

Model hakkındaki tüm bilgilere erişmek için getDocumentModel kullanın.

Hataya Neden Olan Değişiklik

Form Tanıma REST API ve SDK'nın önceki sürümlerinde yöntem, listModels hatalar nedeniyle oluşturulamayan modeller bile olsa tüm modelleri döndürür. Yeni hizmet sürümlerinde listDocumentModels ve getDocumentModelyalnızca başarıyla oluşturulmuş modeller (yani kullanıma "hazır" modeller) üretin. Başarısız modeller artık "işlem" API'leri aracılığıyla alınıyor, bkz. getOperation ve listOperations.

Örnekler

Zaman Uyumsuz Yineleme

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

Sayfaya Göre

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

Kaynaktaki model oluşturma işlemlerini listeleyin. Bu, modelleri başarıyla oluşturamayan işlemler de dahil olmak üzere tüm işlemleri oluşturur. Bu işlem disk belleğini destekler.

Örnekler

Zaman Uyumsuz Yineleme

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

Sayfaya Göre

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

Oluşturucu Ayrıntıları

DocumentModelAdministrationClient(string, KeyCredential, DocumentModelAdministrationClientOptions)

Kaynak uç noktasından ve statik API anahtarından DocumentModelAdministrationClient örneği oluşturma (KeyCredential),

Örnek:

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)

Parametreler

endpoint

string

Azure Bilişsel Hizmetler örneğinin uç nokta URL'si

credential
KeyCredential

Bilişsel Hizmetler örneği abonelik anahtarını içeren bir KeyCredential

options
DocumentModelAdministrationClientOptions

istemcideki tüm yöntemleri yapılandırmak için isteğe bağlı ayarlar

DocumentModelAdministrationClient(string, TokenCredential, DocumentModelAdministrationClientOptions)

Kaynak uç noktasından ve Azure Identity'den TokenCredentialDocumentModelAdministrationClient örneği oluşturun.

@azure/identity Azure Active Directory ile kimlik doğrulaması hakkında daha fazla bilgi için pakete bakın.

Örnek:

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)

Parametreler

endpoint

string

Azure Bilişsel Hizmetler örneğinin uç nokta URL'si

credential
TokenCredential

paketten @azure/identity bir TokenCredential örneği

options
DocumentModelAdministrationClientOptions

istemcideki tüm yöntemleri yapılandırmak için isteğe bağlı ayarlar

Yöntem Ayrıntıları

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

Verilen sınıflandırıcı kimliği ve belge türleriyle yeni bir belge sınıflandırıcı oluşturun.

Sınıflandırıcı kimliği, kaynak içindeki sınıflandırıcılar arasında benzersiz olmalıdır.

Belge türleri, belge türünün adını bu belge türü için eğitim veri kümesiyle eşleyen bir nesne olarak verilir. İki eğitim verisi giriş yöntemi desteklenir:

  • azureBlobSource, verilen Azure Blob Depolama kapsayıcıdaki verileri kullanarak sınıflandırıcıyı eğiter.
  • azureBlobFileListSourcebenzer ancak azureBlobSource JSONL biçimli bir dosya listesi kullanarak eğitim veri kümesine dahil edilen dosyalar üzerinde daha ayrıntılı denetim sağlar.

Form Tanıma hizmeti, hizmet arka ucun kapsayıcıyla iletişim kurmasını sağlayan SAS belirtecine sahip kapsayıcının URL'si olarak verilen azure depolama kapsayıcısından eğitim veri kümesini okur. En azından "okuma" ve "liste" izinleri gereklidir. Ayrıca, belirli bir kapsayıcıdaki verilerin, hizmetin özel belge sınıflandırıcıları oluşturmaya yönelik belgelerinde belgelenen belirli bir kurala göre düzenlenmesi gerekir.

Örnek

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>

Parametreler

classifierId

string

oluşturulacak sınıflandırıcının benzersiz kimliği

docTypeSources
DocumentClassifierDocumentTypeSources

sınıflandırıcıya ve kaynaklarına eklenecek belge türleri (belge türü adlarının ClassifierDocumentTypeDetailseşlemesi )

options
BeginBuildDocumentClassifierOptions

sınıflandırıcı derleme işlemi için isteğe bağlı ayarlar

Döndürülenler

uzun süre çalışan ve sonunda oluşturulan sınıflandırıcı ayrıntılarını veya hatasını oluşturacak bir işlem (poller)

beginBuildDocumentModel(string, DocumentModelSource, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Model içerik kaynağından belirli bir kimlikle yeni bir model oluşturun.

Model Kimliği, "önceden oluşturulmuş-" ile başlamadığı sürece (bu modeller tüm kaynaklar için ortak olan önceden oluşturulmuş Form Tanıma modellerini ifade eder) ve kaynak içinde mevcut olmadığı sürece herhangi bir metinden oluşabilir.

İçerik kaynağı, hizmetin giriş eğitim verilerini okumak için kullanacağı mekanizmayı açıklar. Daha fazla bilgi için türüne <xref:DocumentModelContentSource> bakın.

Örnek

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>

Parametreler

modelId

string

oluşturulacak modelin benzersiz kimliği

contentSource
DocumentModelSource

bu model için eğitim verilerini sağlayan bir içerik kaynağı

buildMode

DocumentModelBuildMode

modeli oluştururken kullanılacak mod (bkz DocumentModelBuildMode. )

options
BeginBuildDocumentModelOptions

model derleme işlemi için isteğe bağlı ayarlar

Döndürülenler

uzun süre çalışan ve sonunda oluşturulan model bilgilerini veya bir hatayı oluşturacak bir işlem (poller)

beginBuildDocumentModel(string, string, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

Bir dizi giriş belgesinden ve etiketlenmiş alanlardan belirli bir kimliğe sahip yeni bir model oluşturun.

Model Kimliği, "önceden oluşturulmuş-" ile başlamadığı sürece (bu modeller tüm kaynaklar için ortak olan önceden oluşturulmuş Form Tanıma modellerini ifade eder) ve kaynak içinde mevcut olmadığı sürece herhangi bir metinden oluşabilir.

Form Tanıma hizmeti, hizmet arka ucun kapsayıcıyla iletişim kurmasını sağlayan SAS belirtecine sahip kapsayıcının URL'si olarak verilen azure depolama kapsayıcısından eğitim veri kümesini okur. En azından "okuma" ve "liste" izinleri gereklidir. Ayrıca, verilen kapsayıcıdaki verilerin, hizmetin özel modeller oluşturmaya yönelik belgelerinde belgelenen belirli bir kurala göre düzenlenmesi gerekir.

Örnek

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>

Parametreler

modelId

string

oluşturulacak modelin benzersiz kimliği

containerUrl

string

Eğitim veri kümesini barındıran Azure Depolama kapsayıcısının SAS ile kodlanmış URL'si

buildMode

DocumentModelBuildMode

modeli oluştururken kullanılacak mod (bkz DocumentModelBuildMode. )

options
BeginBuildDocumentModelOptions

model derleme işlemi için isteğe bağlı ayarlar

Döndürülenler

uzun süre çalışan ve sonunda oluşturulan model bilgilerini veya bir hatayı oluşturacak bir işlem (poller)

beginComposeDocumentModel(string, Iterable<string>, BeginComposeDocumentModelOptions)

Önceden var olan birkaç alt modelden tek bir oluşturulmuş model oluşturur.

Elde edilen oluşturulan model, bileşen modellerinin belge türlerini birleştirir ve bileşen alt modellerinden hangisinin verilen giriş için en uygun olduğunu belirlemek için ayıklama işlem hattına bir sınıflandırma adımı ekler.

Örnek

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>

Parametreler

modelId

string

oluşturulacak modelin benzersiz kimliği

componentModelIds

Iterable<string>

oluşturacak modellerin benzersiz model kimliklerini temsil eden bir Yinelenebilir dize

options
BeginComposeDocumentModelOptions

model oluşturma için isteğe bağlı ayarlar

Döndürülenler

uzun süre çalışan ve sonunda oluşturulan model bilgilerini veya bir hatayı oluşturacak bir işlem (poller)

beginCopyModelTo(string, CopyAuthorization, BeginCopyModelOptions)

Verilen kimliğe sahip bir modeli, belirli bir kopyalama yetkilendirmesi tarafından kodlanmış kaynağa ve model kimliğine kopyalar.

Bkz . CopyAuthorization ve getCopyAuthorization.

Örnek

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

Parametreler

sourceModelId

string

kopyalanacak kaynak modelin benzersiz kimliği

authorization
CopyAuthorization

getCopyAuthorization kullanılarak oluşturulan modeli kopyalama yetkisi

options
BeginCopyModelOptions

için isteğe bağlı ayarlar

Döndürülenler

kopyalanan model bilgilerini veya bir hatayı oluşturacak uzun süre çalışan bir işlem (poller)

deleteDocumentClassifier(string, OperationOptions)

Varsa, istemcinin kaynağından verilen kimliğe sahip bir sınıflandırıcıyı siler. Bu işlem geri alınamaz.

Örnek

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

Parametreler

classifierId

string

kaynaktan silinecek sınıflandırıcının benzersiz kimliği

options
OperationOptions

isteğe bağlı ayarlar

Döndürülenler

Promise<void>

deleteDocumentModel(string, DeleteDocumentModelOptions)

Varsa, verilen kimliğe sahip bir modeli istemcinin kaynağından siler. Bu işlem geri alınamaz.

Örnek

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

Parametreler

modelId

string

kaynaktan silinecek modelin benzersiz kimliği

options
DeleteDocumentModelOptions

isteğe bağlı ayarlar

Döndürülenler

Promise<void>

getCopyAuthorization(string, GetCopyAuthorizationOptions)

Yöntemiyle beginCopyModelTo kullanılan bir modeli kaynağa kopyalamak için bir yetkilendirme oluşturur.

, CopyAuthorization başka bir bilişsel hizmet kaynağına bu istemcinin kaynağında model kimliği ve yetkilendirmeye kodlanmış isteğe bağlı açıklama ile model oluşturma hakkı verir.

Örnek

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

Parametreler

destinationModelId

string

hedef modelin benzersiz kimliği (modeli kopyalanacak kimlik)

options
GetCopyAuthorizationOptions

kopyalama yetkilendirmesi oluşturmak için isteğe bağlı ayarlar

Döndürülenler

verilen modelId değerini ve isteğe bağlı açıklamayı kodlayan kopyalama yetkilendirmesi

getDocumentClassifier(string, OperationOptions)

Kimliğine göre bir sınıflandırıcı (DocumentClassifierDetails) hakkındaki bilgileri alır.

Örnek

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>

Parametreler

classifierId

string

sorgu için sınıflandırıcının benzersiz kimliği

options
OperationOptions

isteğe bağlı ayarlar

Döndürülenler

verilen kimlikle sınıflandırıcı hakkında bilgi

getDocumentModel(string, GetModelOptions)

Model (DocumentModelDetails) hakkındaki bilgileri kimliğine göre alır.

Bu yöntem hem özel hem de önceden oluşturulmuş modeller hakkındaki bilgileri alabilir.

Hataya Neden Olan Değişiklik

Form Tanıma REST API ve SDK'nın önceki sürümlerinde yöntem, getModel hatalar nedeniyle oluşturulamayan herhangi bir modeli bile döndürebiliyor. Yeni hizmet sürümlerinde getDocumentModel ve listDocumentModelsyalnızca başarıyla oluşturulmuş modeller (yani kullanıma "hazır" modeller) üretin. Başarısız modeller artık "işlem" API'leri aracılığıyla alınıyor, bkz. getOperation ve listOperations.

Örnek

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

Parametreler

modelId

string

sorguya almak için modelin benzersiz kimliği

options
GetModelOptions

isteğe bağlı ayarlar

Döndürülenler

verilen kimlikle model hakkında bilgi

getOperation(string, GetOperationOptions)

Kimliğine göre bir işlem (OperationDetails) hakkındaki bilgileri alır.

İşlemler model oluşturma, oluşturma veya kopyalama gibi analiz dışı görevleri temsil ediyor.

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

Parametreler

operationId

string

sorguya yönelik işlemin kimliği

options
GetOperationOptions

isteğe bağlı ayarlar

Döndürülenler

Promise<OperationDetails>

verilen kimlikle işlem hakkında bilgi

Örnek

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

Bu istemcinin kaynağıyla ilgili temel bilgileri alın.

Örnek

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>

Parametreler

options
GetResourceDetailsOptions

isteğe bağlı ayarlar

Döndürülenler

Promise<ResourceDetails>

bu istemcinin kaynağı hakkında temel bilgiler

listDocumentClassifiers(ListModelsOptions)

Kaynaktaki sınıflandırıcılarla ilgili ayrıntıları listeleyin. Bu işlem disk belleğini destekler.

Örnekler

Zaman Uyumsuz Yineleme

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

Sayfaya Göre

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

Parametreler

options
ListModelsOptions

sınıflandırıcı istekleri için isteğe bağlı ayarlar

Döndürülenler

disk belleğini destekleyen sınıflandırıcı ayrıntılarının zaman uyumsuz yinelenebilir olması

listDocumentModels(ListModelsOptions)

Kaynaktaki modellerin özetlerini listeleyin. Özel ve önceden oluşturulmuş modeller dahil edilecek. Bu işlem disk belleğini destekler.

Model özeti (DocumentModelSummary) yalnızca modelle ilgili temel bilgileri içerir ve modeldeki belge türleri (alan şemaları ve güvenilirlik değerleri gibi) hakkında bilgi içermez.

Model hakkındaki tüm bilgilere erişmek için getDocumentModel kullanın.

Hataya Neden Olan Değişiklik

Form Tanıma REST API ve SDK'nın önceki sürümlerinde yöntem, listModels hatalar nedeniyle oluşturulamayan modeller bile olsa tüm modelleri döndürür. Yeni hizmet sürümlerinde listDocumentModels ve getDocumentModelyalnızca başarıyla oluşturulmuş modeller (yani kullanıma "hazır" modeller) üretin. Başarısız modeller artık "işlem" API'leri aracılığıyla alınıyor, bkz. getOperation ve listOperations.

Örnekler

Zaman Uyumsuz Yineleme

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

Sayfaya Göre

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

Parametreler

options
ListModelsOptions

model istekleri için isteğe bağlı ayarlar

Döndürülenler

disk belleğini destekleyen model özetlerinin zaman uyumsuz yinelenebilir olması

listOperations(ListOperationsOptions)

Kaynaktaki model oluşturma işlemlerini listeleyin. Bu, modelleri başarıyla oluşturamayan işlemler de dahil olmak üzere tüm işlemleri oluşturur. Bu işlem disk belleğini destekler.

Örnekler

Zaman Uyumsuz Yineleme

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

Sayfaya Göre

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

Parametreler

options
ListOperationsOptions

işlem istekleri için isteğe bağlı ayarlar

Döndürülenler

disk belleğini destekleyen işlem bilgisi nesnelerinin zaman uyumsuz yinelenebilir olması