Why is my Document Intelligence Custom Model ID not shown?

Benjamin Koubik 35 Reputation points
2023-10-21T12:50:22.4766667+00:00

I created and trained a self-developed model. Now I want to check a document via the SDK Javascript interface. However, if I try to enter my model ID of the model I created myself, I get a 404 'The requested model was not found'. If I have all model IDs displayed, only the prebuilt IDs appear. What am I doing wrong?

 const document_model_admin_client = new DocumentModelAdministrationClient(
        endpoint,
        new AzureKeyCredential(key)
      );

      for await (const summary of document_model_admin_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 document_model_admin_client.getDocumentModel(
          modelId
        );

        console.log("MODEL: " + model.modelId);

        //MODEL: prebuilt-businessCard
        //MODEL: prebuilt-contract
        //MODEL: prebuilt-document
        //MODEL: prebuilt-healthInsuranceCard.us
        //...
      }

This is the code to analyze a document using my Custom ID, but this throws a 404 error:

  const client = new DocumentAnalysisClient(
        endpoint,
        new AzureKeyCredential(key)
      );

      const poller = await client.beginAnalyzeDocumentFromUrl(
        "All",
        downloadUrl
      );

      const { keyValuePairs } = await poller.pollUntilDone();

      if (!keyValuePairs || keyValuePairs.length <= 0) {
        console.log("No key-value pairs were extracted from the document.");
        setProcessing(false);
      } else {
        console.log("Key-Value Pairs:");
        for (const { key, value, confidence } of keyValuePairs) {
          console.log("- Key  :", `"${key.content}"`);
          console.log(
            "  Value:",
            `"${(value && value.content) || "<undefined>"}" (${confidence})`
          );
        }
        setProcessing(false);
      }
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,436 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ramr-msft 17,621 Reputation points
    2023-10-23T12:24:41.5033333+00:00

    @Benjamin Koubik Thanks for the question, Can you check the status of your model. It might be possible that your model is still training or it failed to train. You can check the status of your model using the getDocumentModel method with your model ID.

    1 person found this answer helpful.
    0 comments No comments