communications-mining
latest
false
UiPath logo, featuring letters U and I in white

Communications Mining Developer Guide

Last updated Dec 20, 2024

Tag an exception

docs image
/api/v1/datasets/<project>/<dataset_name>/streams/<stream_name>/exceptions/api/v1/datasets/<project>/<dataset_name>/streams/<stream_name>/exceptions
Permissions required: Consume streams, View sources.
  • Bash
    curl -X PUT 'https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "exceptions": [
        {
          "metadata": {
            "type": "No Prediction"
          },
          "uid": "18ba5ce699f8da1f.abcdef0123456789"
        },
        {
          "metadata": {
            "type": "Wrong Prediction"
          },
          "uid": "18ba5ce699f8da1f.0123456789abcdef"
        }
      ]
    }'curl -X PUT 'https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "exceptions": [
        {
          "metadata": {
            "type": "No Prediction"
          },
          "uid": "18ba5ce699f8da1f.abcdef0123456789"
        },
        {
          "metadata": {
            "type": "Wrong Prediction"
          },
          "uid": "18ba5ce699f8da1f.0123456789abcdef"
        }
      ]
    }'
  • Node
    const request = require("request");
    
    request.put(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          exceptions: [
            {
              metadata: { type: "No Prediction" },
              uid: "18ba5ce699f8da1f.abcdef0123456789",
            },
            {
              metadata: { type: "Wrong Prediction" },
              uid: "18ba5ce699f8da1f.0123456789abcdef",
            },
          ],
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.put(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          exceptions: [
            {
              metadata: { type: "No Prediction" },
              uid: "18ba5ce699f8da1f.abcdef0123456789",
            },
            {
              metadata: { type: "Wrong Prediction" },
              uid: "18ba5ce699f8da1f.0123456789abcdef",
            },
          ],
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.put(
        "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "exceptions": [
                {
                    "uid": "18ba5ce699f8da1f.abcdef0123456789",
                    "metadata": {"type": "No Prediction"},
                },
                {
                    "uid": "18ba5ce699f8da1f.0123456789abcdef",
                    "metadata": {"type": "Wrong Prediction"},
                },
            ]
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.put(
        "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "exceptions": [
                {
                    "uid": "18ba5ce699f8da1f.abcdef0123456789",
                    "metadata": {"type": "No Prediction"},
                },
                {
                    "uid": "18ba5ce699f8da1f.0123456789abcdef",
                    "metadata": {"type": "Wrong Prediction"},
                },
            ]
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Response
    {
      "status": "ok"
    }{
      "status": "ok"
    }

This endpoint allows you to tag comments as exceptions in the platform, so that a model trainer can review and label them in order to improve the model. We recommend to tag the comments for which the model returned no predictions, and comments for which the model returned wrong predictions. (For help with designing the exception handling flow, please check the Integration Guide).

NAMETYPEREQUIREDDESCRIPTION
exceptionsarray<Exception>yesA list of exceptions.
Where Exception has the following format:
NAMETYPEREQUIREDDESCRIPTION
uidstringyesThe uid of the comment that should be tagged as exception.
metadataMetadatayesAn object containing exception metadata.
Where Metadata has the following format:
NAMETYPEREQUIREDDESCRIPTION
typestringyesThe exception type will be available as a filter property in the Communications Mining UI. The value can be an arbitrary string. Please choose a short, easy-to-understand string such as "No Prediction" and "Wrong Prediction".

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.