communications-mining
latest
false
- API 文档
- CLI
- 集成指南
- 博客
重要 :
请注意,此内容已使用机器翻译进行了本地化。
Communications Mining 开发者指南
Last updated 2024年11月19日
数据集
/api/v1/datasets
所需权限:查看标签
- 重击
curl -X GET 'https://<my_api_endpoint>/api/v1/datasets' \ -H "Authorization: Bearer $REINFER_TOKEN"
curl -X GET 'https://<my_api_endpoint>/api/v1/datasets' \ -H "Authorization: Bearer $REINFER_TOKEN" - 节点
const request = require("request"); request.get( { url: "https://<my_api_endpoint>/api/v1/datasets", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } );
const request = require("request"); request.get( { url: "https://<my_api_endpoint>/api/v1/datasets", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } ); - Python
import json import os import requests response = requests.get( "https://<my_api_endpoint>/api/v1/datasets", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True))
import json import os import requests response = requests.get( "https://<my_api_endpoint>/api/v1/datasets", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True)) - 响应
{ "datasets": [ { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "18ba5ce699f8da1f", "last_modified": "2018-10-15T15:48:49.603000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Example Dataset" } ], "status": "ok" }
{ "datasets": [ { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "18ba5ce699f8da1f", "last_modified": "2018-10-15T15:48:49.603000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Example Dataset" } ], "status": "ok" }
/api/v1/datasets/<project>/<dataset_name>
所需权限:查看标签
- 重击
curl -X GET 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN"
curl -X GET 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN" - 节点
const request = require("request"); request.get( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } );
const request = require("request"); request.get( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } ); - Python
import json import os import requests response = requests.get( "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True))
import json import os import requests response = requests.get( "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True)) - 响应
{ "dataset": { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "18ba5ce699f8da1f", "last_modified": "2018-10-15T15:48:49.603000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Example Dataset" }, "status": "ok" }
{ "dataset": { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "18ba5ce699f8da1f", "last_modified": "2018-10-15T15:48:49.603000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Example Dataset" }, "status": "ok" }
/api/v1/datasets/<project>/<dataset>/model-tags
所需权限:模型管理员
- 重击
curl -X GET 'https://<my_api_endpoint>/api/v1/datasets/<project>/model-tags' \ -H "Authorization: Bearer $REINFER_TOKEN"
curl -X GET 'https://<my_api_endpoint>/api/v1/datasets/<project>/model-tags' \ -H "Authorization: Bearer $REINFER_TOKEN" - 节点
const request = require("request"); request.get( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/model-tags", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } );
const request = require("request"); request.get( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/model-tags", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } ); - Python
import json import os import requests response = requests.get( "https://<my_api_endpoint>/api/v1/datasets/<project>/model-tags", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True))
import json import os import requests response = requests.get( "https://<my_api_endpoint>/api/v1/datasets/<project>/model-tags", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True)) - 响应
{ "model_tags": [ { "name": "prod", "updated_at": "2021-11-16T12:31:00.123Z", "version": 5 }, { "name": "staging", "updated_at": "2021-11-15T12:30:00.123Z", "version": 7 } ], "status": "ok" }
{ "model_tags": [ { "name": "prod", "updated_at": "2021-11-16T12:31:00.123Z", "version": 5 }, { "name": "staging", "updated_at": "2021-11-15T12:30:00.123Z", "version": 7 } ], "status": "ok" }
/api/v1/datasets/<project>/<dataset>
所需权限: Datasets admin
- 重击
curl -X PUT 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dataset": { "description": "An optional long form description.", "model_family": "english", "source_ids": [ "18ba5ce699f8da1f" ], "title": "An Example Dataset" } }'
curl -X PUT 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dataset": { "description": "An optional long form description.", "model_family": "english", "source_ids": [ "18ba5ce699f8da1f" ], "title": "An Example Dataset" } }' - 节点
const request = require("request"); request.put( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, json: true, body: { dataset: { description: "An optional long form description.", model_family: "english", source_ids: ["18ba5ce699f8da1f"], title: "An Example Dataset", }, }, }, 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/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, json: true, body: { dataset: { description: "An optional long form description.", model_family: "english", source_ids: ["18ba5ce699f8da1f"], title: "An Example Dataset", }, }, }, 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/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, json={ "dataset": { "title": "An Example Dataset", "description": "An optional long form description.", "source_ids": ["18ba5ce699f8da1f"], "model_family": "english", } }, ) 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/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, json={ "dataset": { "title": "An Example Dataset", "description": "An optional long form description.", "source_ids": ["18ba5ce699f8da1f"], "model_family": "english", } }, ) print(json.dumps(response.json(), indent=2, sort_keys=True)) - 响应
{ "dataset": { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "b9a1fd75f6133bce", "last_modified": "2018-10-15T15:48:49.603000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Example Dataset" }, "status": "ok" }
{ "dataset": { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "b9a1fd75f6133bce", "last_modified": "2018-10-15T15:48:49.603000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Example Dataset" }, "status": "ok" }
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
title | 字符串 | 否 | 数据集的单行人类可读标题。 |
description | 字符串 | 否 | 数据集的详细说明。 |
source_ids | array<string> | 否 | 要包含在此数据集中的源 ID 数组。 |
model_family | 字符串 | 否 | 数据集模型系列,可以是英语或多语种。 默认为English 。 请在此处查看多语言模型系列支持的语言。 |
has_sentiment | boolean | 否 | 数据集中的标签是否应与情感一起应用。 默认为true 。 |
/api/v1/datasets/<project>/<dataset>
所需权限: Datasets admin
- 重击
curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dataset": { "title": "An Alternative Title" } }'
curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dataset": { "title": "An Alternative Title" } }' - 节点
const request = require("request"); request.post( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, json: true, body: { dataset: { title: "An Alternative Title" } }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } );
const request = require("request"); request.post( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, json: true, body: { dataset: { title: "An Alternative Title" } }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } ); - Python
import json import os import requests response = requests.post( "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, json={"dataset": {"title": "An Alternative Title"}}, ) print(json.dumps(response.json(), indent=2, sort_keys=True))
import json import os import requests response = requests.post( "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, json={"dataset": {"title": "An Alternative Title"}}, ) print(json.dumps(response.json(), indent=2, sort_keys=True)) - 响应
{ "dataset": { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "b9a1fd75f6133bce", "last_modified": "2018-10-15T15:53:08.479000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Alternative Title" }, "status": "ok" }
{ "dataset": { "created": "2018-10-15T15:48:49.603000Z", "description": "An optional long form description.", "has_sentiment": true, "id": "b9a1fd75f6133bce", "last_modified": "2018-10-15T15:53:08.479000Z", "model_family": "english", "name": "example", "owner": "<project>", "source_ids": ["18ba5ce699f8da1f"], "title": "An Alternative Title" }, "status": "ok" }
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
title | 字符串 | 否 | 数据集的单行人类可读标题。 |
description | 字符串 | 否 | 数据集的详细说明。 |
source_ids | array<string> | 否 | 要包含在此数据集中的源 ID 数组。 |
/api/v1/datasets/<project>/<dataset_name>
所需权限: Datasets admin
- 重击
curl -X DELETE 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN"
curl -X DELETE 'https://<my_api_endpoint>/api/v1/datasets/<project>/example' \ -H "Authorization: Bearer $REINFER_TOKEN" - 节点
const request = require("request"); request.delete( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } );
const request = require("request"); request.delete( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } ); - Python
import json import os import requests response = requests.delete( "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True))
import json import os import requests response = requests.delete( "https://<my_api_endpoint>/api/v1/datasets/<project>/example", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, ) print(json.dumps(response.json(), indent=2, sort_keys=True)) - 响应
{ "status": "ok" }
{ "status": "ok" }
/api/v1/datasets/<project>/<dataset_name>/export
所需权限:导出数据集
- 重击
curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/example/export' \ -H "Authorization: Bearer $REINFER_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "limit": 1 }'
curl -X POST 'https://<my_api_endpoint>/api/v1/datasets/<project>/example/export' \ -H "Authorization: Bearer $REINFER_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "limit": 1 }' - 节点
const request = require("request"); request.post( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example/export", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, json: true, body: { limit: 1 }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } );
const request = require("request"); request.post( { url: "https://<my_api_endpoint>/api/v1/datasets/<project>/example/export", headers: { Authorization: "Bearer " + process.env.REINFER_TOKEN, }, json: true, body: { limit: 1 }, }, function (error, response, json) { // digest response console.log(JSON.stringify(json, null, 2)); } ); - Python
import json import os import requests response = requests.post( "https://<my_api_endpoint>/api/v1/datasets/<project>/example/export", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, json={"limit": 1}, ) print(json.dumps(response.json(), indent=2, sort_keys=True))
import json import os import requests response = requests.post( "https://<my_api_endpoint>/api/v1/datasets/<project>/example/export", headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]}, json={"limit": 1}, ) print(json.dumps(response.json(), indent=2, sort_keys=True)) - 响应
{ "comments": [ { "annotations": { "labels": { "assigned": [ { "name": "Parent Label", "sentiment": "positive" }, { "name": "Parent Label > Child Label", "sentiment": "positive" } ] } }, "comment": { "context": "1596721237668", "created_at": "2020-08-06T13:20:28.531000Z", "has_annotations": true, "id": "0123456789abcdef", "last_modified": "2020-08-06T13:40:37.668000Z", "messages": [ { "body": { "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob" }, "from": "bob@organisation.org", "sent_at": "2011-12-11T11:05:10Z", "subject": { "text": "Today's figures" }, "to": ["alice@company.com"] } ], "source_id": "47194279497e141e", "text_format": "plain", "thread_id": "123456", "timestamp": "2011-12-11T11:05:10Z", "uid": "47194279497e141e.0123456789abcdef", "user_properties": { "string:Recipient Domain": "company.com", "string:Sender Domain": "organisation.org" } }, "predictions": { "labels": [ { "name": "Another Parent Label", "probability": 0.954979807138443, "sentiment": -0.4281917143125379 }, { "name": "Another Parent Label > Another Child Label", "probability": 0.7726812064647675, "sentiment": -0.6603664430231163 } ] } } ], "continuation": "2021-02-16T10:55:05Z.c060a787c0b2bbf95526ad5cf28bf582", "status": "ok" }
{ "comments": [ { "annotations": { "labels": { "assigned": [ { "name": "Parent Label", "sentiment": "positive" }, { "name": "Parent Label > Child Label", "sentiment": "positive" } ] } }, "comment": { "context": "1596721237668", "created_at": "2020-08-06T13:20:28.531000Z", "has_annotations": true, "id": "0123456789abcdef", "last_modified": "2020-08-06T13:40:37.668000Z", "messages": [ { "body": { "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob" }, "from": "bob@organisation.org", "sent_at": "2011-12-11T11:05:10Z", "subject": { "text": "Today's figures" }, "to": ["alice@company.com"] } ], "source_id": "47194279497e141e", "text_format": "plain", "thread_id": "123456", "timestamp": "2011-12-11T11:05:10Z", "uid": "47194279497e141e.0123456789abcdef", "user_properties": { "string:Recipient Domain": "company.com", "string:Sender Domain": "organisation.org" } }, "predictions": { "labels": [ { "name": "Another Parent Label", "probability": 0.954979807138443, "sentiment": -0.4281917143125379 }, { "name": "Another Parent Label > Another Child Label", "probability": 0.7726812064647675, "sentiment": -0.6603664430231163 } ] } } ], "continuation": "2021-02-16T10:55:05Z.c060a787c0b2bbf95526ad5cf28bf582", "status": "ok" }
此路由用于导出数据集。 它会返回带有已分配标签的注释列表和最新的可用预测。 导出数据集的其他方法包括在浏览器中下载 CSV 以及通过 CLI 下载 JSONL。 有关详细比较,请参阅比较表。
请求格式
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
comment_uids | array<string> | 否 | 至多包含 256 个注释 UID 的列表 (格式为 source_id.comment_id)。 如果提供,则响应中将仅包含这些注释。 不能使用comment_uids 传递其他筛选条件。
|
source_ids | array<string> | 否 | 至多包含 1024 个来源 ID 的列表。 如果提供,则响应中将仅包含这些来源的注释。 |
order_by | 字符串 | 否 | created_at 或timestamp 之一。 如果提供,则返回按注释的 API 创建日期 ( created_at ) 或用户定义的注释时间戳 ( timestamp ) 排序的注释。 默认值为timestamp 。
|
from | 字符串 | 否 | ISO-8601 时间戳。 如果提供,则仅返回此时间戳之后的注释。 相关的order_by 字段控制将用于筛选的时间戳。
|
to | 字符串 | 否 | ISO-8601 时间戳。 如果提供,则仅返回此时间戳 (含) 之前的注释。 相关的order_by 字段控制将用于筛选的时间戳。
|
continuation | 字符串 | 否 | 分页令牌(在响应中提供)。 应该用于获取接下来的limit 条注释。
|
limit | 数字 | 否 | 每个响应返回的注释数,最大值为 256。 默认值: 64。 |
响应格式
名称 | 类型 | 说明 |
---|---|---|
comments | array<Comment> | 注释列表,其中包含分配的标签和预测的标签。 |
continuation | 字符串 | 用于获取接下来limit 条注释的分页令牌。 如果没有进一步的注释,则响应中将不会显示此字段。
|
其中
Comment
具有以下格式: