Cohere
    Cohere
    • 关于 Cohere
    • 团队和角色
    • 版本控制
    • 错误
    • 协同生成(Co.Generate)
      POST
    • 协同嵌入(Co.Embed)
      POST
    • 协同聊天(Co.Chat (Beta))
      POST
    • 协同分类(Co.Classify)
      POST
    • 协同分词(Co.Tokenize)
      POST
    • 协同合并分词(Co.Detokenize)
      POST
    • 协同语言检测(Co.Detect_language)
      POST
    • 协同摘要(Co.Summarize)
      POST
    • 协同重新排序(Co.Rerank)
      POST

      协同分类(Co.Classify)

      开发环境
      https://api.cohere.ai/v1
      开发环境
      https://api.cohere.ai/v1
      POST
      https://api.cohere.ai/v1/classify
      这个接口可以对给定的文本输入预测最匹配的标签。Classify 通过提供的文本+标签对的示例作为参考,来进行预测。
      注意:在分类示例上训练的自定义模型在进行预测时不需要明确地传递 examples 参数。
      请求示例请求示例
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://api.cohere.ai/v1/classify' \
      --header 'Content-Type: application/json' \
      --data-raw '{
        "truncate": "END",
        "inputs": [
          "Confirm your email address",
          "hey i need u to send some $"
        ],
        "examples": [
          {
            "text": "Dermatologists don'\''t like her!",
            "label": "Spam"
          },
          {
            "text": "Hello, open to this?",
            "label": "Spam"
          },
          {
            "text": "I need help please wire me $1000 right now",
            "label": "Spam"
          },
          {
            "text": "Nice to know you ;)",
            "label": "Spam"
          },
          {
            "text": "Please help me?",
            "label": "Spam"
          },
          {
            "text": "Your parcel will be delivered today",
            "label": "Not spam"
          },
          {
            "text": "Review changes to our Terms and Conditions",
            "label": "Not spam"
          },
          {
            "text": "Weekly sync notes",
            "label": "Not spam"
          },
          {
            "text": "Re: Follow up from today’s meeting",
            "label": "Not spam"
          },
          {
            "text": "Pre-read for tomorrow",
            "label": "Not spam"
          }
        ]
      }'
      响应示例响应示例
      {
          "id": "string",
          "classifications": [
              {
                  "id": "string",
                  "input": "string",
                  "prediction": "string",
                  "predictions": [
                      "string"
                  ],
                  "confidence": 0,
                  "confidences": [
                      0
                  ],
                  "labels": {
                      "Not spam": {
                          "confidence": 0
                      },
                      "Spam": {
                          "confidence": 0
                      }
                  },
                  "classification_type": "string"
              }
          ],
          "meta": {
              "api_version": {
                  "version": "string"
              }
          }
      }

      请求参数

      Body 参数application/json

      示例

      返回响应

      🟢200成功
      application/json
      Body

      修改于 2023-10-31 08:23:52
      上一页
      协同聊天(Co.Chat (Beta))
      下一页
      协同分词(Co.Tokenize)
      Built with