coze如何对文档智能总结 coze创建知识库 上传文件到知识库 通过对话总结知识库文档 详细接口

1.首先创建一个智能体,发布,勾选api;获取智能体id;获取授权信息

参考文档:https://docs.coze.cn/developer_guides/preparation

2.接口

说明:所有接口请求头都需要传授权信息

2.1.创建知识库

接口:https://api.coze.cn/v1/datasets

请求参数示例:

复制代码
{
    "name": "产品文档",
    "description": "产品文档",
    "space_id": "7524871304085356583",
    "format_type": 2

}

2.2创建知识库文件

接口:https://api.coze.cn/open_api/knowledge/document/create

请求头必须传:Agw-Js-Conv:str

请求参数示例:

复制代码
{
    "dataset_id": "7617756792320131107",
    "format_type": 0,
    "document_bases": [
        {
            "name": "测试担保有限公司.docx",
            "source_info": {
                "file_base64": "xxx",
                "file_type": "docx"
            }
        }
    ],
    "chunk_strategy": {
        "separator": "\n\n",
        "max_tokens": 800,
        "remove_extra_spaces": false,
        "remove_urls_emails": false,
        "chunk_type": 1
    }
}

响应示例:

复制代码
{
    "code": 0,
    "detail": {
        "logid": "20260316194941189A72C5ABD4DBC2BAC2"
    },
    "document_infos": [
        {
            "char_count": 0,
            "chunk_strategy": {},
            "create_time": 0,
            "document_id": "xxx",
            "document_id_new": "xxx",
            "format_type": 0,
            "hit_count": 0,
            "name": "测试担xxx.docx",
            "size": 0,
            "slice_count": 0,
            "source_type": 0,
            "status": 0,
            "type": "",
            "update_interval": 0,
            "update_time": 0,
            "update_type": 0
        }
    ],
    "msg": ""
}

2.3发起对话

接口路径:https://api.coze.cn/v3/chat

请求参数示例:

复制代码
{
    "bot_id": "7617473388323356698", 
    "user_id": "1", 
    "stream": false,
    "auto_save_history": true, 
    "additional_messages": [ 
        {
            "role": "user",
            "content": "总结知识库中《xxx.docx》的核心内容,结构为:文档主题+核心要点3点+关键结论,分点清晰", 
            "content_type": "text",
            "type": "question" 
        }
    ]
}

响应示例:

复制代码
{
    "data": {
        "id": "7617814329392857114",
        "conversation_id": "7617814329392807962",
        "bot_id": "7617473388323356698",
        "created_at": 1773660614,
        "last_error": {
            "code": 0,
            "msg": ""
        },
        "status": "in_progress"
    },
    "code": 0,
    "msg": ""
}

2.4查看对话消息详情

接口路径:https://api.coze.cn/v3/chat/message/list?conversation_id=7xxx&chat_id=xxx

响应结果示例:

复制代码
{
    "code": 0,
    "data": [
        {
            "bot_id": "7617473388323356698",
            "chat_id": "7617813593530138662",
            "content": "xxx",
            "content_type": "text",
            "conversation_id": "7617813593530105894",
            "created_at": 1773660443,
            "id": "7617813594654244910",
            "reasoning_content": "用户让我总结《测试x.docx》的核心内容,x",
            "role": "assistant",
            "type": "answer",
            "updated_at": 1773660461
        },
        {
            "bot_id": "7617473388323356698",
            "chat_id": "7617813593530138662",
            "content": "{\"msg_type\":\"generate_answer_finish\",\"data\":\"{\\\"finish_reason\\\":0,\\\"FinData\\\":\\\"\\\"}\",\"from_module\":null,\"from_unit\":null}",
            "content_type": "text",
            "conversation_id": "7617813593530105894",
            "created_at": 1773660464,
            "id": "7617813684799078446",
            "role": "assistant",
            "type": "verbose",
            "updated_at": 1773660463
        },
        {
            "bot_id": "7617473388323356698",
            "chat_id": "7617813593530138662",
            "content": "文档中提到的"xxx体是怎样运作的?",
            "content_type": "text",
            "conversation_id": "7617813593530105894",
            "created_at": 1773660464,
            "id": "7617813684799143982",
            "role": "assistant",
            "type": "follow_up",
            "updated_at": 1773660463
        },
        {
            "bot_id": "7617473388323356698",
            "chat_id": "7617813593530138662",
            "content": "xxx对行业有何影响?",
            "content_type": "text",
            "conversation_id": "7617813593530105894",
            "created_at": 1773660464,
            "id": "7617813684799160366",
            "role": "assistant",
            "type": "follow_up",
            "updated_at": 1773660463
        },
        {
            "bot_id": "7617473388323356698",
            "chat_id": "7617813593530138662",
            "content": "休闲鞋体系?",
            "content_type": "text",
            "conversation_id": "7617813593530105894",
            "created_at": 1773660464,
            "id": "7617813684799176750",
            "role": "assistant",
            "type": "follow_up",
            "updated_at": 1773660463
        }
    ],
    "detail": {
        "logid": "20260316192801EBDBDE5E6EA875F0BB6E"
    },
    "msg": ""
}
相关推荐
星释14 天前
鸿蒙智能体开发实战:2.创建单Agent
harmonyos·智能体
MicrosoftReactor14 天前
技术速递|从一次性提示到标准化工作流:如何在 GitHub Copilot CLI 中使用自定义智能体
github·copilot·cli·智能体
星释14 天前
鸿蒙智能体开发实战:3.创建工作流
华为·harmonyos·智能体
-山中问答-15 天前
【智能体工具使用实战08】实战项目:代码仓库健康度分析Agent
人工智能·智能体·工具调用·工程实战
-山中问答-15 天前
【智能体工具使用实战06】工具增强型Agent的评测体系
人工智能·智能体·工具调用·测评体系
带娃的IT创业者15 天前
GitHub 热门: coleam00/Archon —— 当 AI Agent 学会自我进化
人工智能·github·开源项目·ai agent·智能体·自我进化
渡众机器人15 天前
智能体对抗挑战赛和空地协同侦排挑战赛的报名流程
人工智能·自动驾驶·无人机·智能体·报名流程
Tbisnic15 天前
AI大模型学习第十四天:Coze项目实战中的分治智慧
人工智能·python·学习·大模型·工作流·智能体·coze
码哥字节15 天前
码哥用扣子搭了一套自动跟进工作流,每天省2小时这不是夸张
工作流引擎·coze
-山中问答-15 天前
【智能体工具使用实战07】让Agent给自己造工具
人工智能·智能体·工具调用