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.Chat (Beta))

      开发环境
      https://api.cohere.ai/v1
      开发环境
      https://api.cohere.ai/v1
      POST
      https://api.cohere.ai/v1/chat
      聊天端点允许用户与 Cohere 的大型语言模型(LLM)进行对话。用户可以使用 conversation_id 参数作为持久对话的一部分发送消息,或者也可以使用 chat_history 参数传入自己的对话历史记录。此端点还具有诸如连接器和文档等额外参数,可通过外部知识丰富对话。我们称之为“检索增强生成”,简称“RAG”。如果您有任何问题或需要支持,我们随时准备提供帮助!请联系您的 Cohere 合作伙伴以启用此 API 的访问。
      请求示例请求示例
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://api.cohere.ai/v1/chat' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "chat_history": [
            {"role": "USER", "message": "Who discovered gravity?"},
            {"role": "CHATBOT", "message": "The man who is widely credited with discovering gravity is Sir Isaac Newton"}
          ],
          "message": "What year was he born?",
          "connectors": [{"id": "web-search"}]
        }'
      响应示例响应示例
      {
          "text": "string",
          "generation_id": "string",
          "citations": [
              {
                  "start": 0,
                  "end": 0,
                  "text": "string",
                  "document_ids": [
                      "string"
                  ]
              }
          ],
          "documents": [
              {
                  "id": "string",
                  "additionalProp": "string"
              }
          ],
          "search_queries": [
              {
                  "text": "string",
                  "generation_id": "string"
              }
          ],
          "search_results": [
              {
                  "search_query": {
                      "role": "string",
                      "message": "string",
                      "user_name": "string"
                  },
                  "connector": {
                      "id": "string",
                      "options": {}
                  },
                  "document_ids": [
                      "string"
                  ]
              }
          ]
      }

      请求参数

      Body 参数application/json

      示例

      返回响应

      🟢200成功
      application/json
      Body

      修改于 2023-10-31 08:01:46
      上一页
      协同嵌入(Co.Embed)
      下一页
      协同分类(Co.Classify)
      Built with