DocumentModelAdministrationClient class

모델 만들기, 읽기, 나열, 삭제 및 복사와 같은 Form Recognizer 서비스의 모델 관리 기능과 상호 작용하기 위한 클라이언트입니다.

예제:

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 키(구독 키)

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, KeyCredential, DocumentModelAdministrationClientOptions)

리소스 엔드포인트 및 정적 API 키(KeyCredential)에서 DocumentModelAdministrationClient instance 만듭니다.

예제:

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)

리소스 엔드포인트 및 Azure ID 에서 DocumentModelAdministrationClient instance 만듭니다TokenCredential.

@azure/identity 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);

메서드

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

지정된 분류자 ID 및 문서 형식을 사용하여 새 문서 분류자를 빌드합니다.

분류자 ID는 리소스 내의 분류자 간에 고유해야 합니다.

문서 형식은 문서 형식의 이름을 해당 문서 형식의 학습 데이터 집합에 매핑하는 개체로 제공됩니다. 두 가지 학습 데이터 입력 메서드가 지원됩니다.

  • azureBlobSource지정된 Azure Blob Storage 컨테이너의 데이터를 사용하여 분류자를 학습합니다.
  • azureBlobFileListSource는 JSONL azureBlobSource 형식의 파일 목록을 사용하여 학습 데이터 집합에 포함된 파일을 보다 세밀하게 제어할 수 있도록 합니다.

Form Recognizer 서비스는 서비스 백 엔드가 컨테이너와 통신할 수 있도록 하는 SAS 토큰을 사용하여 컨테이너에 대한 URL로 지정된 Azure Storage 컨테이너에서 학습 데이터 집합을 읽습니다. 최소한 "읽기" 및 "목록" 권한이 필요합니다. 또한 지정된 컨테이너의 데이터는 사용자 지정 문서 분류자를 빌드하기 위한 서비스의 설명서에 설명된 특정 규칙에 따라 구성되어야 합니다.

예제

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)

모델 콘텐츠 원본에서 지정된 ID로 새 모델을 빌드합니다.

모델 ID는 "prebuilt-"(이러한 모델은 모든 리소스에 공통적인 미리 빌드된 Form Recognizer 모델을 참조함)로 시작되지 않고 리소스 내에 아직 없는 한 모든 텍스트로 구성됩니다.

콘텐츠 원본은 서비스에서 입력 학습 데이터를 읽는 데 사용할 메커니즘을 설명합니다. 자세한 내용은 형식을 <xref:DocumentModelContentSource> 참조하세요.

예제

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)

입력 문서 및 레이블이 지정된 필드 집합에서 지정된 ID로 새 모델을 빌드합니다.

모델 ID는 "prebuilt-"(이러한 모델은 모든 리소스에 공통적인 미리 빌드된 Form Recognizer 모델을 참조함)로 시작되지 않고 리소스 내에 아직 없는 한 모든 텍스트로 구성됩니다.

Form Recognizer 서비스는 서비스 백 엔드가 컨테이너와 통신할 수 있도록 하는 SAS 토큰을 사용하여 컨테이너에 대한 URL로 지정된 Azure Storage 컨테이너에서 학습 데이터 집합을 읽습니다. 최소한 "읽기" 및 "목록" 권한이 필요합니다. 또한 지정된 컨테이너의 데이터는 사용자 지정 모델을 빌드하기 위한 서비스 설명서에 설명된 특정 규칙에 따라 구성되어야 합니다.

예제

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)

여러 기존 하위 모델에서 단일 구성된 모델을 만듭니다.

결과로 구성된 모델은 구성 요소 모델의 문서 형식을 결합하고 추출 파이프라인에 분류 단계를 삽입하여 지정된 입력에 가장 적합한 구성 요소 하위 모델을 결정합니다.

예제

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)

지정된 ID가 있는 모델을 지정된 복사 권한 부여로 인코딩된 리소스 및 모델 ID에 복사합니다.

CopyAuthorizationgetCopyAuthorization을 참조하세요.

예제

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

클라이언트의 리소스에서 지정된 ID가 있는 분류자를 삭제합니다(있는 경우). 이 작업은 되돌릴 수 없습니다.

예제

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

클라이언트의 리소스에서 지정된 ID가 있는 모델을 삭제합니다(있는 경우). 이 작업은 되돌릴 수 없습니다.

예제

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

메서드와 함께 사용되는 리소스에 모델을 복사하는 권한 부여를 beginCopyModelTo 만듭니다.

CopyAuthorization 다른 Cognitive Service 리소스에 권한 부여로 인코딩된 모델 ID 및 선택적 설명을 사용하여 이 클라이언트 리소스에 모델을 만들 수 있는 권한을 부여합니다.

예제

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

ID별로 분류자(DocumentClassifierDetails)에 대한 정보를 검색합니다.

예제

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)

ID별로 모델에 대한 정보(DocumentModelDetails)를 검색합니다.

이 메서드는 미리 빌드된 모델뿐만 아니라 사용자 지정에 대한 정보를 검색할 수 있습니다.

호환성이 손상되는 변경:

이전 버전의 Form Recognizer REST API 및 SDK에서 메서드는 getModel 오류로 인해 만들지 못한 모델도 반환할 수 있었습니다. 새 서비스 버전에서는 성공적으로 생성된 모델(즉, getDocumentModellistDocumentModels 사용할 준비가 된 모델)만 생성합니다. 이제 실패한 모델이 "작업" API를 통해 검색됩니다. getOperationlistOperations를 참조하세요.

예제

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

ID로 작업(OperationDetails)에 대한 정보를 검색합니다.

작업은 모델 빌드, 구성 또는 복사와 같은 비분석 작업을 나타냅니다.

getResourceDetails(GetResourceDetailsOptions)

이 클라이언트의 리소스에 대한 기본 정보를 검색합니다.

예제

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)

리소스의 분류자 세부 정보를 나열합니다. 이 작업은 페이징을 지원합니다.

예제

비동기 반복

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

페이지별

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

리소스의 모델 요약을 나열합니다. 사용자 지정 및 미리 빌드된 모델이 포함됩니다. 이 작업은 페이징을 지원합니다.

모델 요약(DocumentModelSummary)에는 모델에 대한 기본 정보만 포함되며 모델의 문서 형식에 대한 정보(예: 필드 스키마 및 신뢰도 값)는 포함되지 않습니다.

모델에 대한 전체 정보에 액세스하려면 getDocumentModel을 사용합니다.

호환성이 손상되는 변경:

이전 버전의 Form Recognizer REST API 및 SDK listModels 에서 메서드는 오류로 인해 만들지 못한 모델도 모두 반환합니다. 새 서비스 버전에서는 성공적으로 생성된 모델(즉, listDocumentModelsgetDocumentModel 사용할 준비가 된 모델)만 생성합니다. 이제 실패한 모델이 "작업" API를 통해 검색됩니다. getOperationlistOperations를 참조하세요.

예제

비동기 반복

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

페이지별

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

리소스에서 모델 만들기 작업을 나열합니다. 이렇게 하면 모델을 성공적으로 만들지 못한 작업을 포함하여 모든 작업이 생성됩니다. 이 작업은 페이징을 지원합니다.

예제

비동기 반복

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

페이지별

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

생성자 세부 정보

DocumentModelAdministrationClient(string, KeyCredential, DocumentModelAdministrationClientOptions)

리소스 엔드포인트 및 정적 API 키(KeyCredential)에서 DocumentModelAdministrationClient instance 만듭니다.

예제:

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)

매개 변수

endpoint

string

Azure Cognitive Services instance 엔드포인트 URL

credential
KeyCredential

Cognitive Services instance 구독 키가 포함된 KeyCredential

options
DocumentModelAdministrationClientOptions

클라이언트의 모든 메서드를 구성하기 위한 선택적 설정

DocumentModelAdministrationClient(string, TokenCredential, DocumentModelAdministrationClientOptions)

리소스 엔드포인트 및 Azure ID 에서 DocumentModelAdministrationClient instance 만듭니다TokenCredential.

@azure/identity 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);
new DocumentModelAdministrationClient(endpoint: string, credential: TokenCredential, options?: DocumentModelAdministrationClientOptions)

매개 변수

endpoint

string

Azure Cognitive Services instance 엔드포인트 URL

credential
TokenCredential

패키지에서 @azure/identity TokenCredential instance

options
DocumentModelAdministrationClientOptions

클라이언트의 모든 메서드를 구성하기 위한 선택적 설정

메서드 세부 정보

beginBuildDocumentClassifier(string, DocumentClassifierDocumentTypeSources, BeginBuildDocumentClassifierOptions)

지정된 분류자 ID 및 문서 형식을 사용하여 새 문서 분류자를 빌드합니다.

분류자 ID는 리소스 내의 분류자 간에 고유해야 합니다.

문서 형식은 문서 형식의 이름을 해당 문서 형식의 학습 데이터 집합에 매핑하는 개체로 제공됩니다. 두 가지 학습 데이터 입력 메서드가 지원됩니다.

  • azureBlobSource지정된 Azure Blob Storage 컨테이너의 데이터를 사용하여 분류자를 학습합니다.
  • azureBlobFileListSource는 JSONL azureBlobSource 형식의 파일 목록을 사용하여 학습 데이터 집합에 포함된 파일을 보다 세밀하게 제어할 수 있도록 합니다.

Form Recognizer 서비스는 서비스 백 엔드가 컨테이너와 통신할 수 있도록 하는 SAS 토큰을 사용하여 컨테이너에 대한 URL로 지정된 Azure Storage 컨테이너에서 학습 데이터 집합을 읽습니다. 최소한 "읽기" 및 "목록" 권한이 필요합니다. 또한 지정된 컨테이너의 데이터는 사용자 지정 문서 분류자를 빌드하기 위한 서비스의 설명서에 설명된 특정 규칙에 따라 구성되어야 합니다.

예제

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>

매개 변수

classifierId

string

만들 분류자의 고유 ID

docTypeSources
DocumentClassifierDocumentTypeSources

분류자 및 해당 원본에 포함할 문서 형식(에 대한 문서 형식 이름의 ClassifierDocumentTypeDetails맵)

options
BeginBuildDocumentClassifierOptions

분류자 빌드 작업에 대한 선택적 설정

반환

생성된 분류자 세부 정보 또는 오류를 생성할 장기 실행 작업(폴러)입니다.

beginBuildDocumentModel(string, DocumentModelSource, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

모델 콘텐츠 원본에서 지정된 ID로 새 모델을 빌드합니다.

모델 ID는 "prebuilt-"(이러한 모델은 모든 리소스에 공통적인 미리 빌드된 Form Recognizer 모델을 참조함)로 시작되지 않고 리소스 내에 아직 없는 한 모든 텍스트로 구성됩니다.

콘텐츠 원본은 서비스에서 입력 학습 데이터를 읽는 데 사용할 메커니즘을 설명합니다. 자세한 내용은 형식을 <xref:DocumentModelContentSource> 참조하세요.

예제

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>

매개 변수

modelId

string

만들 모델의 고유 ID

contentSource
DocumentModelSource

이 모델에 대한 학습 데이터를 제공하는 콘텐츠 원본

buildMode

DocumentModelBuildMode

모델을 빌드할 때 사용할 모드입니다(참조 DocumentModelBuildMode).

options
BeginBuildDocumentModelOptions

모델 빌드 작업에 대한 선택적 설정

반환

생성된 모델 정보 또는 오류를 생성할 장기 실행 작업(폴러)입니다.

beginBuildDocumentModel(string, string, DocumentModelBuildMode, BeginBuildDocumentModelOptions)

입력 문서 및 레이블이 지정된 필드 집합에서 지정된 ID로 새 모델을 빌드합니다.

모델 ID는 "prebuilt-"(이러한 모델은 모든 리소스에 공통적인 미리 빌드된 Form Recognizer 모델을 참조함)로 시작되지 않고 리소스 내에 아직 없는 한 모든 텍스트로 구성됩니다.

Form Recognizer 서비스는 서비스 백 엔드가 컨테이너와 통신할 수 있도록 하는 SAS 토큰을 사용하여 컨테이너에 대한 URL로 지정된 Azure Storage 컨테이너에서 학습 데이터 집합을 읽습니다. 최소한 "읽기" 및 "목록" 권한이 필요합니다. 또한 지정된 컨테이너의 데이터는 사용자 지정 모델을 빌드하기 위한 서비스 설명서에 설명된 특정 규칙에 따라 구성되어야 합니다.

예제

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>

매개 변수

modelId

string

만들 모델의 고유 ID

containerUrl

string

학습 데이터 집합을 보유하는 Azure Storage 컨테이너에 대한 SAS로 인코딩된 URL

buildMode

DocumentModelBuildMode

모델을 빌드할 때 사용할 모드입니다(참조 DocumentModelBuildMode).

options
BeginBuildDocumentModelOptions

모델 빌드 작업에 대한 선택적 설정

반환

생성된 모델 정보 또는 오류를 생성할 장기 실행 작업(폴러)

beginComposeDocumentModel(string, Iterable<string>, BeginComposeDocumentModelOptions)

여러 기존 하위 모델에서 단일 구성된 모델을 만듭니다.

결과로 구성된 모델은 구성 요소 모델의 문서 형식을 결합하고 추출 파이프라인에 분류 단계를 삽입하여 지정된 입력에 가장 적합한 구성 요소 하위 모델을 결정합니다.

예제

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>

매개 변수

modelId

string

만들 모델의 고유 ID

componentModelIds

Iterable<string>

작성할 모델의 고유 모델 ID를 나타내는 문자열 반복 가능

options
BeginComposeDocumentModelOptions

모델 만들기를 위한 선택적 설정

반환

생성된 모델 정보 또는 오류를 생성할 장기 실행 작업(폴러)

beginCopyModelTo(string, CopyAuthorization, BeginCopyModelOptions)

지정된 ID가 있는 모델을 지정된 복사 권한 부여로 인코딩된 리소스 및 모델 ID에 복사합니다.

CopyAuthorizationgetCopyAuthorization을 참조하세요.

예제

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

매개 변수

sourceModelId

string

복사할 원본 모델의 고유 ID

authorization
CopyAuthorization

getCopyAuthorization을 사용하여 만든 모델을 복사하기 위한 권한 부여

options
BeginCopyModelOptions

에 대한 선택적 설정

반환

결국 복사된 모델 정보 또는 오류를 생성하는 장기 실행 작업(폴러)

deleteDocumentClassifier(string, OperationOptions)

클라이언트의 리소스에서 지정된 ID가 있는 분류자를 삭제합니다(있는 경우). 이 작업은 되돌릴 수 없습니다.

예제

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

매개 변수

classifierId

string

리소스에서 삭제할 분류자의 고유 ID

options
OperationOptions

요청에 대한 선택적 설정

반환

Promise<void>

deleteDocumentModel(string, DeleteDocumentModelOptions)

클라이언트의 리소스에서 지정된 ID가 있는 모델을 삭제합니다(있는 경우). 이 작업은 되돌릴 수 없습니다.

예제

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

매개 변수

modelId

string

리소스에서 삭제할 모델의 고유 ID

options
DeleteDocumentModelOptions

요청에 대한 선택적 설정

반환

Promise<void>

getCopyAuthorization(string, GetCopyAuthorizationOptions)

메서드와 함께 사용되는 리소스에 모델을 복사하는 권한 부여를 beginCopyModelTo 만듭니다.

CopyAuthorization 다른 Cognitive Service 리소스에 권한 부여로 인코딩된 모델 ID 및 선택적 설명을 사용하여 이 클라이언트 리소스에 모델을 만들 수 있는 권한을 부여합니다.

예제

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

매개 변수

destinationModelId

string

대상 모델의 고유 ID(모델을 복사할 ID)

options
GetCopyAuthorizationOptions

복사 권한 부여를 만들기 위한 선택적 설정

반환

지정된 modelId 및 선택적 설명을 인코딩하는 복사 권한 부여

getDocumentClassifier(string, OperationOptions)

ID별로 분류자(DocumentClassifierDetails)에 대한 정보를 검색합니다.

예제

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>

매개 변수

classifierId

string

쿼리할 분류자의 고유 ID

options
OperationOptions

요청에 대한 선택적 설정

반환

지정된 ID를 사용하여 분류자 정보

getDocumentModel(string, GetModelOptions)

ID별로 모델에 대한 정보(DocumentModelDetails)를 검색합니다.

이 메서드는 미리 빌드된 모델뿐만 아니라 사용자 지정에 대한 정보를 검색할 수 있습니다.

호환성이 손상되는 변경:

이전 버전의 Form Recognizer REST API 및 SDK에서 메서드는 getModel 오류로 인해 만들지 못한 모델도 반환할 수 있었습니다. 새 서비스 버전에서는 성공적으로 생성된 모델(즉, getDocumentModellistDocumentModels 사용할 준비가 된 모델)만 생성합니다. 이제 실패한 모델이 "작업" API를 통해 검색됩니다. getOperationlistOperations를 참조하세요.

예제

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

매개 변수

modelId

string

쿼리할 모델의 고유 ID

options
GetModelOptions

요청에 대한 선택적 설정

반환

지정된 ID를 사용하여 모델에 대한 정보

getOperation(string, GetOperationOptions)

ID로 작업(OperationDetails)에 대한 정보를 검색합니다.

작업은 모델 빌드, 구성 또는 복사와 같은 비분석 작업을 나타냅니다.

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

매개 변수

operationId

string

쿼리할 작업의 ID

options
GetOperationOptions

요청에 대한 선택적 설정

반환

Promise<OperationDetails>

지정된 ID를 사용하여 작업에 대한 정보

예제

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

이 클라이언트의 리소스에 대한 기본 정보를 검색합니다.

예제

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>

매개 변수

options
GetResourceDetailsOptions

요청에 대한 선택적 설정

반환

Promise<ResourceDetails>

이 클라이언트의 리소스에 대한 기본 정보

listDocumentClassifiers(ListModelsOptions)

리소스의 분류자 세부 정보를 나열합니다. 이 작업은 페이징을 지원합니다.

예제

비동기 반복

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

페이지별

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

매개 변수

options
ListModelsOptions

분류자 요청에 대한 선택적 설정

반환

페이징을 지원하는 분류자 세부 정보의 비동기 반복 가능

listDocumentModels(ListModelsOptions)

리소스의 모델 요약을 나열합니다. 사용자 지정 및 미리 빌드된 모델이 포함됩니다. 이 작업은 페이징을 지원합니다.

모델 요약(DocumentModelSummary)에는 모델에 대한 기본 정보만 포함되며 모델의 문서 형식에 대한 정보(예: 필드 스키마 및 신뢰도 값)는 포함되지 않습니다.

모델에 대한 전체 정보에 액세스하려면 getDocumentModel을 사용합니다.

호환성이 손상되는 변경:

이전 버전의 Form Recognizer REST API 및 SDK listModels 에서 메서드는 오류로 인해 만들지 못한 모델도 모두 반환합니다. 새 서비스 버전에서는 성공적으로 생성된 모델(즉, listDocumentModelsgetDocumentModel 사용할 준비가 된 모델)만 생성합니다. 이제 실패한 모델이 "작업" API를 통해 검색됩니다. getOperationlistOperations를 참조하세요.

예제

비동기 반복

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

페이지별

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

매개 변수

options
ListModelsOptions

모델 요청에 대한 선택적 설정

반환

페이징을 지원하는 모델 요약의 비동기 반복 가능

listOperations(ListOperationsOptions)

리소스에서 모델 만들기 작업을 나열합니다. 이렇게 하면 모델을 성공적으로 만들지 못한 작업을 포함하여 모든 작업이 생성됩니다. 이 작업은 페이징을 지원합니다.

예제

비동기 반복

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

페이지별

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

매개 변수

options
ListOperationsOptions

작업 요청에 대한 선택적 설정

반환

페이징을 지원하는 작업 정보 개체의 비동기 반복 가능