communications-mining
latest
false
Importante :
Este conteúdo foi traduzido com auxílio de tradução automática.
Guia do desenvolvedor do Communications Mining
Last updated 27 de set de 2024

Criar um fluxo

Criar um fluxo

docs image
/api/v1/datasets/<project>/<dataset_name>/streams
/api/v1/datasets/<project>/<dataset_name>/streams

Permissões necessárias: Administrador de streams, Exibir rótulos

  • Bash
    curl -X PUT 'https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "stream": {
        "comment_filter": {
          "user_properties": {
            "number:Spend": {
              "maximum": 100000,
              "minimum": 100
            },
            "number:Transactions": {
              "one_of": [
                1
              ]
            },
            "string:Country": {
              "one_of": [
                "uk",
                "de"
              ]
            }
          }
        },
        "description": "Used by ACME RPA to create tickets for disputes.",
        "model": {
          "label_thresholds": [
            {
              "name": [
                "Some Label"
              ],
              "threshold": 0.37
            },
            {
              "name": [
                "Another Label"
              ],
              "threshold": 0.46
            },
            {
              "name": [
                "Parent Label",
                "Child Label"
              ],
              "threshold": 0.41
            }
          ],
          "version": 8
        },
        "name": "dispute",
        "title": "Collateral Disputes"
      }
    }'curl -X PUT 'https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "stream": {
        "comment_filter": {
          "user_properties": {
            "number:Spend": {
              "maximum": 100000,
              "minimum": 100
            },
            "number:Transactions": {
              "one_of": [
                1
              ]
            },
            "string:Country": {
              "one_of": [
                "uk",
                "de"
              ]
            }
          }
        },
        "description": "Used by ACME RPA to create tickets for disputes.",
        "model": {
          "label_thresholds": [
            {
              "name": [
                "Some Label"
              ],
              "threshold": 0.37
            },
            {
              "name": [
                "Another Label"
              ],
              "threshold": 0.46
            },
            {
              "name": [
                "Parent Label",
                "Child Label"
              ],
              "threshold": 0.41
            }
          ],
          "version": 8
        },
        "name": "dispute",
        "title": "Collateral Disputes"
      }
    }'
    
  • const request = require("request");
    
    request.put(
      {
        url: "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          stream: {
            comment_filter: {
              user_properties: {
                "number:Spend": { maximum: 100000, minimum: 100 },
                "number:Transactions": { one_of: [1] },
                "string:Country": { one_of: ["uk", "de"] },
              },
            },
            description: "Used by ACME RPA to create tickets for disputes.",
            model: {
              label_thresholds: [
                { name: ["Some Label"], threshold: 0.37 },
                { name: ["Another Label"], threshold: 0.46 },
                { name: ["Parent Label", "Child Label"], threshold: 0.41 },
              ],
              version: 8,
            },
            name: "dispute",
            title: "Collateral Disputes",
          },
        },
      },
      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",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          stream: {
            comment_filter: {
              user_properties: {
                "number:Spend": { maximum: 100000, minimum: 100 },
                "number:Transactions": { one_of: [1] },
                "string:Country": { one_of: ["uk", "de"] },
              },
            },
            description: "Used by ACME RPA to create tickets for disputes.",
            model: {
              label_thresholds: [
                { name: ["Some Label"], threshold: 0.37 },
                { name: ["Another Label"], threshold: 0.46 },
                { name: ["Parent Label", "Child Label"], threshold: 0.41 },
              ],
              version: 8,
            },
            name: "dispute",
            title: "Collateral Disputes",
          },
        },
      },
      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",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "stream": {
                "name": "dispute",
                "title": "Collateral Disputes",
                "description": "Used by ACME RPA to create tickets for disputes.",
                "model": {
                    "version": 8,
                    "label_thresholds": [
                        {"name": ["Some Label"], "threshold": 0.37},
                        {"name": ["Another Label"], "threshold": 0.46},
                        {
                            "name": ["Parent Label", "Child Label"],
                            "threshold": 0.41,
                        },
                    ],
                },
                "comment_filter": {
                    "user_properties": {
                        "string:Country": {"one_of": ["uk", "de"]},
                        "number:Spend": {"minimum": 100, "maximum": 100000},
                        "number:Transactions": {"one_of": [1]},
                    }
                },
            }
        },
    )
    
    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",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "stream": {
                "name": "dispute",
                "title": "Collateral Disputes",
                "description": "Used by ACME RPA to create tickets for disputes.",
                "model": {
                    "version": 8,
                    "label_thresholds": [
                        {"name": ["Some Label"], "threshold": 0.37},
                        {"name": ["Another Label"], "threshold": 0.46},
                        {
                            "name": ["Parent Label", "Child Label"],
                            "threshold": 0.41,
                        },
                    ],
                },
                "comment_filter": {
                    "user_properties": {
                        "string:Country": {"one_of": ["uk", "de"]},
                        "number:Spend": {"minimum": 100, "maximum": 100000},
                        "number:Transactions": {"one_of": [1]},
                    }
                },
            }
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Resposta
    {
      "status": "ok",
      "stream": {
        "context": "0",
        "created_at": "2019-08-03T12:30:00.123456Z",
        "dataset_id": "abcdef0123456789",
        "description": "Used by ACME RPA to create tickets for disputes.",
        "id": "0123456789abcdef",
        "model": {
          "version": 8
        },
        "name": "dispute",
        "title": "Collateral Disputes",
        "updated_at": "2019-08-03T12:30:00.123456Z"
      }
    }{
      "status": "ok",
      "stream": {
        "context": "0",
        "created_at": "2019-08-03T12:30:00.123456Z",
        "dataset_id": "abcdef0123456789",
        "description": "Used by ACME RPA to create tickets for disputes.",
        "id": "0123456789abcdef",
        "model": {
          "version": 8
        },
        "name": "dispute",
        "title": "Collateral Disputes",
        "updated_at": "2019-08-03T12:30:00.123456Z"
      }
    }

Os streams permitem a iteração persistente e com estado por meio de comentários em um conjunto de dados, com rótulos previstos e campos gerais calculados usando um modelo fixado.

Once a stream is created, the and methods can be used to iterate through comments.

NomeTipoRequiredDescrição
nameStringsimNome da API para o fluxo, usado em URLs. Deve ser exclusivo em um conjunto de dados e corresponder a [A-Za-z0-9-_]{1,256}.
titleStringnãoTítulo legível por humanos de uma linha para o fluxo.
descriptionStringnãoUma descrição mais longa do fluxo.
modelModelonãoSe especificado, os comentários buscados deste fluxo conterão previsões de um modelo fixado.
comment_filterCommentFilternãoIf specified, comments not matching the filter will not be returned. See for details on how the comment filter will affect the results returned by the stream.

Onde Model tem o seguinte formato:

NomeTipoRequiredDescrição
versionNúmero inteirosimUma versão do modelo que foi fixada por meio da página Modelos .
label_thresholdsarray<LabelThreshold>nãoSe definido, apenas os valores que correspondam ao label_thresholds fornecido serão retornados. Caso não esteja definido, todos os rótulos e todos os valores de previsão serão retornados.
Onde LabelThreshold tem o seguinte formato:
NomeTipoRequiredDescrição
namearray<string>simO nome do rótulo a ser retornado, formatado como uma lista de rótulos hierárquicos. Por exemplo, o rótulo "Some Label" terá o formato ["Some Label"] e o rótulo "Parent Label > Child Label" terá o formato ["Parent Label", "Child Label"].
thresholdNúmerosimO limite de confiança a ser usado para o rótulo (um número entre 0,0 e 1,0). O rótulo só será retornado para um comentário se a previsão estiver acima desse limite.
Onde CommentFilter tem o seguinte formato:
NomeTipoRequiredDescrição
user_propertiesUserPropertyFilternãoUm filtro que se aplica às propriedades de usuário de um comentário. Para obter mais informações sobre propriedades do usuário, consulte a Referência de comentários.
O UserPropertyFilter é um mapa do nome de propriedade do usuário a ser filtrado. As propriedades de string podem ser filtradas para valores em um conjunto ({"one_of": ["val_1", "val_2"]}). As propriedades numéricas podem ser filtradas para valores em um conjunto ({"one_of": [123, 456]}) ou para um intervalo ({"minimum": 123, "maximum": 456}).
  • Criar um fluxo

Esta página foi útil?

Obtenha a ajuda que você precisa
Aprendendo RPA - Cursos de automação
Fórum da comunidade da Uipath
Uipath Logo White
Confiança e segurança
© 2005-2024 UiPath. Todos os direitos reservados.