华为云用户手册

  • 响应示例 状态码: 200 OK 非流式问答响应 { "id": "chat-3f7d8e038f244ae5b7cb0cecf352e154", "object": "chat.completion", "created": 1745725506, "model": "pangu-nlp-n1-32k_kpyq10", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "你好!有什么我可以帮助你的吗?", "tool_calls": [] }, "logprobs": null, "finish_reason": "stop", "stop_reason": null } ], "usage": { "prompt_tokens": 64, "total_tokens": 73, "completion_tokens": 9 }, "prompt_logprobs": null } 带有思维链的非流式问答响应 { "id": "4c0dcef2-7f8f-4c57-93c7-484c03b0a216", "object": "chat.completion", "created": 1741937420, "model": "pangu-nlp-n1-32k_kpyq10", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "\n\n你好!很高兴见到你,有什么我可以帮忙的吗?", "reasoning_content": "嗯,用户发来“你好”,这是一个常见的中文问候。我要用中文回应用户,保持友好和亲切。首先要分析用户的需求,可能只是想打个招呼,或者有具体的问题想问。\n\n接下来要考虑用户可能的背景,可能来自不同的地方,但使用简体中文,所以可能是中国大陆的用户。需要保持回答的通用性,适合所有使用中文的人。\n\n还要判断是否有更深层次的需求,用户可能在测试聊天机器人,或者真的需要帮助。这时候需要给出一个开放式的回应,鼓励用户进一步说明需求。例如询问有什么可以帮忙的,这样既回应了问候,又引导用户提出具体问题。\n\n另外要注意语言的流畅和自然,避免过于机械化的回答。保持礼貌和专业,同时适当使用表情符号增加亲和力,比如用[微笑]或者之类的,不过可能根据平台的不同需要调整。\n\n最后要确保回答符合规范,不涉及敏感话题,内容积极健康。检查是否有拼写或语法错误,确保回复准确无误。\n", "tool_calls": [] }, "logprobs": null, "finish_reason": "stop", "stop_reason": null } ], "usage": { "prompt_tokens": 22, "total_tokens": 377, "completion_tokens": 355 }, "prompt_logprobs": null } 流式问答响应 V1推理接口返回体: data:{"id":"chat-59170add0fd1427bbca0388431058d45","object":"chat.completion.chunk","created":1745725837,"model":"pangu-nlp-n1-32k_kpyq10","choices":[{"index":0,"logprobs":null,"finish_reason":null,"message":{"role":"assistant"}}],"usage":{"prompt_tokens":64,"total_tokens":64,"completion_tokens":0}} data:{"id":"chat-59170add0fd1427bbca0388431058d45","object":"chat.completion.chunk","created":1745725837,"model":"pangu-nlp-n1-32k_kpyq10","choices":[{"index":0,"logprobs":null,"finish_reason":null,"message":{"content":"你好"}}],"usage":{"prompt_tokens":64,"total_tokens":65,"completion_tokens":1}} data:{"id":"chat-59170add0fd1427bbca0388431058d45","object":"chat.completion.chunk","created":1745725837,"model":"pangu-nlp-n1-32k_kpyq10","choices":[{"index":0,"logprobs":null,"finish_reason":"stop","stop_reason":null,"message":{"content":"!有什么我可以帮你的吗?"}}],"usage":{"prompt_tokens":64,"total_tokens":73,"completion_tokens":9}} data:{"id":"chat-59170add0fd1427bbca0388431058d45","object":"chat.completion.chunk","created":1745725837,"model":"pangu-nlp-n1-32k_kpyq10","choices":[],"usage":{"prompt_tokens":64,"total_tokens":73,"completion_tokens":9}} event:{"usage":{"completionTokens":9,"promptTokens":64,"totalTokens":73},"tokens":64,"token_number":9} data:[DONE] V2推理接口返回体: data:{"id":"chat-b9417f06b6524362ae09844cc9b0172d","object":"chat.completion.chunk","created":1745725924,"model":"pangu-nlp-n1-32k_kpyq10","choices":[{"index":0,"delta":{"role":"assistant"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":64,"total_tokens":64,"completion_tokens":0}} data:{"id":"chat-b9417f06b6524362ae09844cc9b0172d","object":"chat.completion.chunk","created":1745725924,"model":"pangu-nlp-n1-32k_kpyq10","choices":[{"index":0,"delta":{"content":"你好"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":64,"total_tokens":65,"completion_tokens":1}} data:{"id":"chat-b9417f06b6524362ae09844cc9b0172d","object":"chat.completion.chunk","created":1745725924,"model":"pangu-nlp-n1-32k_kpyq10","choices":[{"index":0,"delta":{"content":"!有什么我可以帮助你的吗?"},"logprobs":null,"finish_reason":"stop","stop_reason":null}],"usage":{"prompt_tokens":64,"total_tokens":73,"completion_tokens":9}} data:{"id":"chat-b9417f06b6524362ae09844cc9b0172d","object":"chat.completion.chunk","created":1745725924,"model":"pangu-nlp-n1-32k_kpyq10","choices":[],"usage":{"prompt_tokens":64,"total_tokens":73,"completion_tokens":9}} data:[DONE] 带有思维链的流式问答响应 V1推理接口返回体: data:{"id":"chat-cfc9f0e8404540af97aa97bfc5c5090f","object":"chat.completion.chunk","created":1747364482,"model":"pangu-nlp-n2-reasoner-32k","choices":[{"index":0,"message":{"role":"assistant"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":23,"total_tokens":23,"completion_tokens":0}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 24, "completion_tokens": 1}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 25, "completion_tokens": 2}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 26, "completion_tokens": 3}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "好的"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 27, "completion_tokens": 4}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": ","}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 28, "completion_tokens": 5}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "用户"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 29, "completion_tokens": 6}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "发"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 30, "completion_tokens": 7}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "来了"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 31, "completion_tokens": 8}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "“"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 32, "completion_tokens": 9}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "你好"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 33, "completion_tokens": 10}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "”"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 34, "completion_tokens": 11}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": ","}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 35, "completion_tokens": 12}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "我需要"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 36, "completion_tokens": 13}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "回复"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 37, "completion_tokens": 14}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "他们"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 38, "completion_tokens": 15}} ... data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "符合"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 178, "completion_tokens": 155}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "要求"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 179, "completion_tokens": 156}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "。"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 180, "completion_tokens": 157}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": "\n"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 181, "completion_tokens": 158}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 182, "completion_tokens": 159}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 183, "completion_tokens": 160}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "\n\n"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 184, "completion_tokens": 161}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "你好"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 185, "completion_tokens": 162}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "!"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 186, "completion_tokens": 163}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "我是"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 187, "completion_tokens": 164}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "华为"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 188, "completion_tokens": 165}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "云"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 189, "completion_tokens": 166}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "开发的"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 190, "completion_tokens": 167}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "盘"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 191, "completion_tokens": 168}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "古"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 192, "completion_tokens": 169}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "大"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 193, "completion_tokens": 170}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "语言"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 194, "completion_tokens": 171}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "模型"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 195, "completion_tokens": 172}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "。"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 196, "completion_tokens": 173}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "有什么"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 197, "completion_tokens": 174}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "可以"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 198, "completion_tokens": 175}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "帮"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 199, "completion_tokens": 176}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "您的"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 200, "completion_tokens": 177}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": "?"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 201, "completion_tokens": 178}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "message": {"content": ""}, "logprobs": null, "finish_reason": "stop", "stop_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 202, "completion_tokens": 179}} data:{"id":"chat-cfc9f0e8404540af97aa97bfc5c5090f","object":"chat.completion.chunk","created":1747364482,"model":"pangu-nlp-n2-reasoner-32k","choices":[],"usage":{"prompt_tokens":23,"total_tokens":202,"completion_tokens":179}} data:[DONE] V2推理接口返回体: data:{"id":"chat-cfc9f0e8404540af97aa97bfc5c5090f","object":"chat.completion.chunk","created":1747364482,"model":"pangu-nlp-n2-reasoner-32k","choices":[{"index":0,"delta":{"role":"assistant"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":23,"total_tokens":23,"completion_tokens":0}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 24, "completion_tokens": 1}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 25, "completion_tokens": 2}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 26, "completion_tokens": 3}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "好的"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 27, "completion_tokens": 4}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": ","}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 28, "completion_tokens": 5}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "用户"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 29, "completion_tokens": 6}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "发"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 30, "completion_tokens": 7}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "来了"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 31, "completion_tokens": 8}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "“"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 32, "completion_tokens": 9}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "你好"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 33, "completion_tokens": 10}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "”"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 34, "completion_tokens": 11}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": ","}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 35, "completion_tokens": 12}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "我需要"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 36, "completion_tokens": 13}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "回复"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 37, "completion_tokens": 14}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "他们"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 38, "completion_tokens": 15}} ... data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "符合"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 178, "completion_tokens": 155}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "要求"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 179, "completion_tokens": 156}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "。"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 180, "completion_tokens": 157}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": "\n"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 181, "completion_tokens": 158}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 182, "completion_tokens": 159}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"reasoning_content": ""}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 183, "completion_tokens": 160}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "\n\n"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 184, "completion_tokens": 161}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "你好"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 185, "completion_tokens": 162}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "!"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 186, "completion_tokens": 163}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "我是"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 187, "completion_tokens": 164}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "华为"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 188, "completion_tokens": 165}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "云"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 189, "completion_tokens": 166}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "开发的"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 190, "completion_tokens": 167}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "盘"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 191, "completion_tokens": 168}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "古"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 192, "completion_tokens": 169}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "大"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 193, "completion_tokens": 170}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "语言"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 194, "completion_tokens": 171}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "模型"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 195, "completion_tokens": 172}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "。"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 196, "completion_tokens": 173}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "有什么"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 197, "completion_tokens": 174}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "可以"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 198, "completion_tokens": 175}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "帮"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 199, "completion_tokens": 176}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "您的"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 200, "completion_tokens": 177}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": "?"}, "logprobs": null, "finish_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 201, "completion_tokens": 178}} data:{"id": "chat-cfc9f0e8404540af97aa97bfc5c5090f", "object": "chat.completion.chunk", "created": 1747364482, "model": "pangu-nlp-n2-reasoner-32k", "choices": [{"index": 0, "delta": {"content": ""}, "logprobs": null, "finish_reason": "stop", "stop_reason": null}], "usage": {"prompt_tokens": 23, "total_tokens": 202, "completion_tokens": 179}} data:{"id":"chat-cfc9f0e8404540af97aa97bfc5c5090f","object":"chat.completion.chunk","created":1747364482,"model":"pangu-nlp-n2-reasoner-32k","choices":[],"usage":{"prompt_tokens":23,"total_tokens":202,"completion_tokens":179}} data:[DONE]
  • 请求示例 单轮问答 V1推理接口: POST https://{endpoint}/v1/{project_id}/deployments/{deployment_id}/chat/completions Request Header: Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "model": "pangu-nlp-n1-32k", // 仅V2接口需要此参数 "messages": [ { "role":"user", "content": "介绍下长江,以及长江中典型的鱼类" } ], "temperature": 0.9, "max_tokens": 600 } V2推理接口: POST https://{endpoint}/api/v2/chat/completions Request Header: Content-Type: application/json Authorization: Bearer 201ca68f-45f9-4e19-8fa4-831e... Request Body: { "model": "pangu-nlp-n1-32k", // 仅V2接口需要此参数 "messages": [ { "role":"user", "content": "介绍下长江,以及长江中典型的鱼类" } ], "temperature": 0.9, "max_tokens": 600 } 单轮流式问答(stream参数值为true) { "model": "pangu-nlp-n1-32k", // 仅V2接口需要此参数 "messages": [ { "role":"user", "content": "五岳分别是哪些山" } ], "temperature": 0.9, "max_tokens": 600, "stream": "true" } 带有人设的单轮问答(role参数值为system) { "model": "pangu-nlp-n1-32k", // 仅V2接口需要此参数 "messages": [ { "role": "system", "content": "你的名字叫智子,是一名幼儿园老师,请用幼儿园老师的口吻回答问题,注意语气温和亲切,通过提问、引导、赞美等方式,激发学生的思维和想象力。" }, { "role": "user", "content": "介绍下长江,以及长江中典型的鱼类" } ], "temperature": 0.9, "max_tokens": 600 } 带有人设的单轮流式问答(role参数值为system,stream参数值为true) { "model": "pangu-nlp-n1-32k", // 仅V2接口需要此参数 "messages": [ { "role": "system", "content": "你的名字叫智子,是一名幼儿园老师,请用幼儿园老师的口吻回答问题,注意语气温和亲切,通过提问、引导、赞美等方式,激发学生的思维和想象力。" }, { "role": "user", "content": "写一首诗" } ], "temperature": 0.9, "max_tokens": 600, "stream": "true" } 多轮问答 # 多轮问答传参方法:在完成第一轮问答,进行第二轮问答时,需要将第一轮的问题和答案、第二轮问题作为参数传入……依次类推,完成多轮对话。 { "model": "pangu-nlp-n1-32k", // 仅V2接口需要此参数 "messages": [ { "role":"user", "content": "介绍下长江,以及长江中典型的鱼类" //第一轮问题 }, { "role":"assistant", "content": "长江是中国第一大河,全长6300多公里。它发源于青藏高原的唐古拉山脉南麓,流经中国11个省市自治区和两个特别行政区,最终注入东海。\n长江中典型的鱼类有:鲢鱼、鳙鱼、草鱼、鲤鱼等。" //第一轮答案 }, { "role":"user", "content": "途径的省份列2个,并说明有哪些人文风景" //第二轮问题 }, { "role":"assistant", "content": "1. 湖南 - 长沙岳麓山、张家界天门山等\n2. 四川 - 九寨沟、峨眉山等" //第二轮答案 }, { "role":"user", "content": "提到的湖南景点,详细说明下" //第三轮问题 } ], "temperature": 0.9, "max_tokens": 600 } 多轮流式问答(stream参数值为true) # 多轮问答传参方法:在完成第一轮问答,进行第二轮问答时,需要将第一轮的问题和答案、第二轮问题作为参数传入……依次类推,完成多轮对话。 { "model": "pangu-nlp-n1-32k", // 仅V2接口需要此参数 "messages": [ { "role":"user", "content": "介绍下长江,以及长江中典型的鱼类" //第一轮问题 }, { "role":"assistant", "content": "长江是中国第一大河,全长6300多公里。它发源于青藏高原的唐古拉山脉南麓,流经中国11个省市自治区和两个特别行政区,最终注入东海。\n长江中典型的鱼类有:鲢鱼、鳙鱼、草鱼、鲤鱼等。" //第一轮答案 }, { "role":"user", "content": "途径的省份列2个,并说明有哪些人文风景" //第二轮问题 }, { "role":"assistant", "content": "1. 湖南 - 长沙岳麓山、张家界天门山等\n2. 四川 - 九寨沟、峨眉山等" //第二轮答案 }, { "role":"user", "content": "张家界具体在哪里" //第三轮问题 } ], "temperature": 0.9, "max_tokens": 600, "stream": "true" }
  • URI 获取URI方式请参见请求URI。 NLP推理服务提供两种推理接口调用: 盘古推理接口(V1推理接口) 业界通用的OpenAI格式接口(V2推理接口) 两种接口定义如表1所示。 表1 NLP服务推理接口 API分类 API访问路径(URI) V1推理接口 POST /v1/{project_id}/deployments/{deployment_id}/chat/completions V2推理接口 POST /api/v2/chat/completions V1推理接口URI需要输入额外参数,参数说明如表2 V1推理接口路径参数所示: 表2 V1推理接口路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID,获取方法请参见获取项目ID。 deployment_id 是 String 模型的部署ID,获取方法请参见获取模型部署ID。
  • 请求示例 POST https://{endpoint}/v1/{project_id}/agent-run/workflows/{workflow_id}/conversations/{conversation_id} Request Header: Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... stream: true Request Body: { "inputs": { "query": "你好" }, "plugin_configs": [ { "plugin_id": "xxxxxxxxx", "config": { "key": "value" } } ] }
  • 响应示例 非流式(Header中的stream参数为false) 输入节点返回: { "conversation_id": "2c90493f-803d-431d-a197-57543d414317", "messages": [ { "role": "assistant", "content": "{\"inputs\": [{\"actualType\": \"string\", \"sourceType\": \"null\", \"description\": \"姓名\", \"name\": \"name\", \"type\": \"string\", \"required\": true}]}", "nodeId": "node_1745928389632", "nodeType": "Input", "nodeName": "输入" } ], "status": { "code": 3, "desc": "waiting" }, "start_time": 1734336269313, "end_time": 1734336270908 } 提问器节点返回: { "conversation_id": "f9a5540f-0c92-4f28-bd6e-f96ce04f5cc81", "messages": [ { "role": "assistant", "content": "请您提供姓名, 年龄相关的信息", "nodeId": "node_1745929628452", "nodeType": "Questioner", "nodeName": "提问器" } ], "status": { "code": 3, "desc": "waiting" }, "start_time": 1745929778250, "end_time": 1745929779951 } 结束节点返回: { "conversation_id": "2c90493f-803d-431d-a197-57543d414317", "outputs": { "responseContent": "你好!有什么我可以帮助你的吗?" }, "messages": [], "status": { "code": 1, "desc": "succeeded" }, "start_time": 1734337068533, "end_time": 1734337082545 } 流式(Header中的stream参数为true或不传) 输入节点返回: data:{"event":"workflow_started","data":{"start_time":1745929087614}} data:{"event":"message","data":{"text":"{\"inputs\": [{\"actualType\": \"string\", \"sourceType\": \"null\", \"description\": \"姓名\", \"name\": \"name\", \"type\": \"string\", \"required\": true}]}","index":0,"node_id":"node_1745928389632","node_type":"Input","node_name":"输入"}} data:{"event":"message","data":{"text":"","node_id":"node_1745928389632","node_type":"Input","node_name":"输入","is_finished":true}} data:{"event":"end"} 提问器节点返回: data:{"event":"workflow_started","data":{"start_time":1745929709955}} data:{"event":"message","data":{"text":"请您提供姓名, 年龄相关的信息","index":0,"node_id":"node_1745929628452","node_type":"Questioner","node_name":"提问器"}} data:{"event":"message","data":{"text":"","node_id":"node_1745929628452","node_type":"Questioner","node_name":"提问器","is_finished":true}} data:{"event":"end"} 结束节点返回: data:{"event":"workflow_started","data":{"start_time":1745929897770}} data:{"event":"message","data":{"text":"","index":0,"node_id":"node_end","node_type":"End","node_name":"结束"}} data:{"event":"message","data":{"text":"你好","index":1,"node_id":"node_end","node_type":"End","node_name":"结束"}} data:{"event":"message","data":{"text":"!","index":2,"node_id":"node_end","node_type":"End","node_name":"结束"}} data:{"event":"message","data":{"text":"有什么我可以帮助你的吗?","index":3,"node_id":"node_end","node_type":"End","node_name":"结束"}} data:{"event":"message","data":{"text":"","node_id":"node_end","node_type":"End","node_name":"结束","is_finished":true}} data:{"event":"workflow_finished","data":{"status":{"code":1,"desc":"succeeded"},"outputs":{"responseContent":"你好!有什么我可以帮助你的吗?"},"start_time":1745929897770,"end_time":1745929898600}} data:{"event":"end"}
  • 概述 盘古大模型整合华为云强大的计算和数据资源,将先进的AI算法集成在预训练大模型中,打造出具有深度语义理解与生成能力的人工智能大语言模型。可进行对话互动、回答问题、协助创作。 盘古大模型在ModelArts Studio大模型开发平台部署后,可以通过API调用推理接口。 表1 API清单 类别 模型 API 功能 模型推理接口 NLP大模型 文本对话 基于对话问答功能,用户可以与模型进行自然而流畅的对话和交流。 科学计算大模型 创建推理作业 支持调用科学计算大模型创建气象/降水模型的推理作业。 查询推理作业详情 根据创建推理作业的作业ID获取科学计算大模型的结果数据。 CV大模型 Pangu-CV-图像分类-2.1.0 根据在图像信息中所反映的不同特征,对图像进行定量分析,把图像划归为若干个类别中的某一种。适用于动植物分类、车辆类型分类、车牌分类、废钢定级、零部件分类等任务。 Pangu-CV-物体检测-S-2.1.0 找出图像中所有感兴趣的目标,确定它们的位置和类别。物体检测-S模型特点是小参数量,适合在资源有限的环境中使用,提供较快的检测速度和合理的精度。 Pangu-CV-物体检测-N-2.1.0 找出图像中所有感兴趣的目标,确定它们的位置和类别。物体检测-N模型特点是参数量适中,适合在资源有限的环境中使用,提供较快的检测速度和合理的精度。 预测大模型 盘古时序预测分类大模型 基于时序预测基模型实现分类预测能力。时序分类预测有很多应用场景,例如:基于工业设备传感器一段时间采集的连续数据,实现设备正常或异常状态的预测。 盘古时序预测回归大模型 2025年3月首次发布的模型,基于时序预测基模型实现对未来一组观测值的预测,最多支持128个未来时间点的预测。 盘古融合推荐异常检测大模型 针对特定场景的异常检测任务,用户传入异常检测数据,使用模型对指定的预测目标进行异常检测预测。 数据分类预测-盘古融合推荐分类大模型 针对特定场景的分类任务,用户传入分类数据,使用模型对指定的预测目标进行分类预测。 排列特征重要性-盘古融合推荐分类大模型 支持用户传入一批数据样本,并据此计算各个特征的排列重要性(permutation importance)。 数据回归预测-盘古融合推荐回归大模型 针对特定场景的回归任务,用户传入回归数据,使用模型对指定的预测目标进行回归预测。 排列特征重要性-盘古融合推荐回归大模型 支持用户传入一批数据样本,并据此计算各个特征的排列重要性(permutation importance)。 向量&重排专业大模型 Embedding模型服务 Embedding模型服务在创建知识库中,文本处理阶段,用于对文本文档进行前片,转换成向量化表示。在知识检索阶段,根据用户输入的query对切片进行召回。 Rerank模型服务 Rerank模型服务用于对召回的切片,按照query与切片的相关度进行精细化排序,以确保召回相关度top切片。 专业大模型 Embedding模型 Pangu-EmbeddingRank模型,用于RAG场景,提供文本向量化。 Rerank模型 Pangu-EmbeddingRank模型,用于RAG场景,提供精排。 Search Plan模型 Pangu-SearchPlan模型,用于RAG场景,提供通用意图分类/多轮查询改写/复杂查询分解/时间抽取等功能,在RAG任务中生产用于检索的query,以及根据query分类路由到后续不同的流程。 行业大模型 医学NLP大模型 基于文本对话功能,用户可以与医学行业大模型进行自然而流畅的对话和交流,实现医学领域的文本生成、行业推理等场景 三方大模型 DeepSeeK DeepSeek API是基于DeepSeek大模型推出的接口服务,它支持多场景文本交互,能够快速生成高质量对话、文案、故事等内容,可用于文本摘要、智能问答、内容创作等场景。 数据工程接口 - 查询数据血缘 客户通过obs导入原始数据集,可基于该obs路径查询所有基于该路径创建的原始数据集及后续的血缘信息。 - 数据集彻底删除 只针对从obs上传的数据,在删除数据集的时候要关联删除OBS下对应的原始数据,客户认为原始数据应该在客户侧大数据中心长期归档,不应该在OBS长期保留。 Agent应用接口 - 调用应用 通过调用创建好的应用API,输入问题,将得到应用执行的结果。 - 调用工作流 通过调用创建好的工作流API,输入问题,将得到工作流执行的结果。 Token计算器 - Token计算器 为了帮助用户更好地管理和优化Token消耗,平台提供了Token计算器工具。Token计算器可以帮助用户在模型推理前评估文本的Token数量,提供费用预估,并优化数据预处理策略。 用户在部署服务的过程中,建议开启“安全护栏”功能,以保证内容的安全性。 父主题: 使用前必读
  • 请求示例 { "data": [ { "feature_1": xx, "feature_2": xx, ... "feature_n": xx }, ... { "feature_1": xx, "feature_2": xx, ... "feature_n": xx } ], "predict_proba": true }
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 result Object 预测结果信息。 pred_proba Array 预测结果对应的置信度,每条结果为一个Dict,Dict的键值对分别表示预测结果、置信度。 说明:请求字段predict_proba配置为true时,响应body才返回pred_proba子项,否则无该子项 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码。 error_msg String 错误信息。
  • 请求参数 使用Token认证方式的请求Header参数见表2。 表2 请求Header参数(Token认证) 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 用于获取操作API的权限。 获取Token 接口响应消息头中X-Subject-Token的值即为Token。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 使用API Key认证方式的请求Header参数见表3。 表3 请求Header参数(API Key认证) 参数 是否必选 参数类型 描述 X-Apig-AppCode 是 String API Key值。 用于获取操作API的权限。API Key认证响应消息头中X-Apig-AppCode的值即为API Key。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 表4 请求Body参数 参数 是否必选 参数类型 描述 data 是 Array 参数解释: 待进行预测的数据,从输入的特征数据中检测是否存在异常值。 约束限制: data为一个数组,数组中包含多个对象,每个对象是一组完整的特征数据。 待预测特征名需要与训练数据中的特征名保持一致。例如,训练数据中特征列按照feature_1、feature_2……进行命名,在调用推理接口时,特征名也需要保持相同。同时推理接口中特征数量需要与训练数据中的特征数保持一致。一组特征数据填写完成后再填写剩余待预测数据,格式详见请求示例。 取值范围: 输入数据中的一组数据。 默认取值: 预测大模型在训练完成后,可以在训练日志页面,“模型训练”日志节点中获取推理api所用的示例数据。填写请求Body时可以参考该示例填写。 predict_proba 否 boolean 参数解释: 是否输出置信度 约束限制: 无 取值范围: true或false 默认取值: 非必填项,默认false。
  • 响应示例 { "result": [ "0", "1", ... "0" ], "pred_proba": [ { “0”: 0.791, “1”: 0.209 }, { “0”: 0.103, “1”: 0.897 }, ... { “0”: 0.665, “1”: 0.335 }, ] }
  • 响应示例 { "result": [ { "Box": { "Angle": 0, "Height": 60, "Width": 106, "X": 852, "Y": 182 }, "Score": 0.88427734375, "label": "car" }, { "Box": { "Angle": 0, "Height": 114, "Width": 55, "X": 800, "Y": 170 }, "Score": 0.70556640625, "label": "person" } ] }
  • 请求参数 使用Token认证方式的请求Header参数见表1。 表2 请求Header参数(Token认证) 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 用于获取操作API的权限。获取Token接口响应消息头中X-Subject-Token的值即为Token。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 使用API Key认证方式的请求Header参数见表2。 表3 请求Header参数(API Key认证) 参数 是否必选 参数类型 描述 X-Apig-AppCode 是 String API Key值。 用于获取操作API的权限。API Key认证响应消息头中X-Apig-AppCode的值即为API Key。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 表4 请求Body参数 参数 是否必选 参数类型 描述 images 是 String 参数解释:被检测图片的base64编码。 约束限制: 取值范围:建议整个请求体大小不超过4M,建议使用JPG、PNG、JPEG、BMP格式的图片。 默认取值:默认只支持RGB三通道图片数据,其他通道的数据暂不支持。 threshold 否 Float 参数解释:检测框置信度阈值。 约束限制: 取值范围:最小0.0,最大1.0。 默认取值:默认0.25。
  • 响应参数 状态码: 200 表5 响应成功Body参数 参数 参数类型 描述 result Array of objects 识别结果信息。 Score Float 置信度。 label String 检测类别。 Box Dict 检测到的目标主体信息。 表6 Box 参数 参数类型 描述 X Int 矩形框左上角横坐标。 Y Int 矩形框左上角纵坐标。 With Int 矩形框宽度。 Height Int 矩形框高度。 Angle Int 检测到的目标主体区域的角度。 状态码: 400 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码。 error_msg String 错误信息。
  • 响应消息体 响应消息体通常以结构化格式返回,与响应消息头中Content-Type对应,传递除响应消息头之外的内容。 接口调用成功后将返回如下响应体。 { "id": "180f5745-4ee4-42a9-9869-23f829654bb7", "created": 1724915285, "choices": [ { "index": 0, "text": "故事标题:《穿越宋朝的奇妙之旅》在一个阴雨绵绵的夜晚,一个名叫李晓的年轻人正在阅读一本关于宋朝的历史书籍。突然,他感到一阵眩晕,当他再次睁开眼睛时,他发现自己身处一个完全陌生的地方。李晓发现自己穿越到了宋朝。他身处一座繁华的城市,人们穿着古代的服饰,用着他听不懂的语言交谈。他意识到自己真的穿越了。李晓在宋朝的生活充满了挑战。他必须学习如何使用新的语言,适应新的生活方式。他开始学习宋朝的礼仪,尝试理解这个时代的文化。在宋朝,李晓遇到了许多有趣的人。他遇到了一位名叫赵敏拿来的小女孩,她聪明伶俐,让李晓对她产生了深深的喜爱。他还遇到了一位名叫王安石的大儒,他的智慧和博学让李晓深感敬佩。在宋朝的生活中,李晓也遇到了许多困难。他必须适应新的食物,新的气候,甚至新的疾病。但是,他从未放弃,他始终坚信,只要他坚持下去,他就能适应这个新的世界。在宋朝的生活中,李晓也找到了新的目标。他开始学习宋朝的书法,尝试理解这个时代的艺术。他还开始学习宋朝的医学,尝试理解这个时代的科学。在宋朝的生活中,李晓也找到了新的爱情。他与赵敏拿来建立了深厚的感情,他们的conseillé情深深地打动了李晓。最后,李晓决定留在宋朝。他发现,他已经深深地爱上了这个时代,爱上了这里的人,爱上了这里的食物,爱上了这里的一切。这就是李晓在宋朝的hesion之旅,一个充满挑战和机遇的旅程。虽然他来自未来,但他已经成为了宋朝的一部分,成为了这个时代的一部分。", "ppl": 1.77809815678146e-36 } ], "usage": { "completion_tokens": 365, "prompt_tokens": 9, "total_tokens": 374 } } 当接口调用出错时,会返回错误码及错误信息说明。 token有效期为24小时,下面的报错表示token过期。 { "error_msg": "Incorrect IAM authentication information: token expires, expires_at:2023-06-29T02:16:41.581000Z", "error_code": "APIG.0301", "request_id": "469967f55e6b225xxx" } 其中,error_code表示错误码,error_msg表示错误描述信息。
  • 从控制台获取项目ID 登录管理控制台。 在页面右上角的用户名的下拉列表中选择“我的凭证”。 图1 我的凭证 在“我的凭证”页面,获取项目ID(project_id),以及账号名、账号ID、IAM用户名和IAM用户ID。 在调用盘古API时,获取的项目id需要与盘古服务部署区域一致,例如盘古大模型当前部署在“西南-贵阳一”区域,需要获取与贵阳一区域的对应的项目id。 图2 查看项目ID 多项目时,展开“所属区域”,从“项目ID”列获取子项目ID。
  • 调用API获取项目ID 项目ID还可通过调用查询指定条件下的项目信息API获取。 获取项目ID的接口为“GET https://{Endpoint}/v3/projects”,其中{Endpoint}为IAM的终端节点,可以从地区和终端节点获取。接口的认证鉴权请参见认证鉴权。 响应示例如下,例如, 对话机器人服务 部署的区域为“cn-north-4”,响应消息体中查找“name”为“cn-north-4”,其中projects下的“id”即为项目ID。 { "projects": [ { "domain_id": "65382450e8f64ac0870cd180d14e684b", "is_domain": false, "parent_id": "65382450e8f64ac0870cd180d14e684b", "name": "project_name", "description": "", "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f897d6b99" }, "id": "a4a5d4098fb4474fa22cd05f897d6b99", "enabled": true } ], "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects" } }
  • 响应参数 状态码: 200 响应成功返回的结构体是一个Dict,由本次请求的多张输入图像的预测结果组成,图像与图像之间通过编号(键)区分。 表5 单/多标签分类响应成功Body参数 参数 参数类型 描述 键 String 输入图像的顺序编号,从"0"开始,最大不超过"23"。 值 List[Dict] 当前编号的图像对应的预测结果。 dataset_id String 训练数据集ID。 其中,每张图像的预测结果参数类型为List[Dict],表示预测得到的一个或多个类别,每个Dict的参数内容请参考表6。 表6 单张图像的单个类别预测结果参数 参数 参数类型 描述 label String 预测的类别,与训练数据中定义的类别相同。 score String 预测的置信度结果,输出每个标签对应的预测得分,得分区间为0至1。 状态码: 400 表7 响应失败Body参数 参数 参数类型 描述 error_code String 错误码。 error_msg String 错误信息。
  • 请求示例 单图请求示例 { "images": "/9j/4Vr2RXhpZgAASUkqAAgAAA.....", } 批量请求示例(单次请求批次上限为24张图) { "images": ["/9j/4Vr2RXhpZgAASUkqAAgAAA.....", "/9j/4RIrRXhpZgAATU......"] } 带高级参数的单标签分类请求示例 { "images": ["/9j/4Vr2RXhpZgAASUkqAAgAAA.....", "/9j/4RIrRXhpZgAATU......"], "top": 3 } 带高级参数的多标签分类请求示例 { "images": ["/9j/4Vr2RXhpZgAASUkqAAgAAA.....", "/9j/4RIrRXhpZgAATU......"], "threshold": { "bird": 0.33, "blackbird": 0.44 } }
  • 响应示例 响应返回一个字典,键为本次请求的输入图像的编号,对输入的图像按顺序从0开始编号;值为一个列表,列表里为该图像的预测结果,每张图像可能存在多个预测结果(例如多标签分类模式)。 { "0": [ { "label": "bird", "score": "0.95511043" }, { "label": "blackbird", "score": "0.75241840" }, ], "1": [ { "label": "bird", "score": "0.36211243" } ], "dataset_id": "1341002014632579072" }
  • 请求参数 使用Token认证方式的请求Header参数见表1。 表2 请求Header参数(Token认证) 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 用于获取操作API的权限。获取Token接口响应消息头中X-Subject-Token的值即为Token。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 使用API Key认证方式的请求Header参数见表2。 表3 请求Header参数(API Key认证) 参数 是否必选 参数类型 描述 X-Apig-AppCode 是 String API Key值。 用于获取操作API的权限。API Key认证响应消息头中X-Apig-AppCode的值即为API Key。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 表4 请求Body参数 参数 是否必选 参数类型 描述 images 是 String/List[String] 参数解释:被检测图片的base64编码。 约束限制:单张图片请求时,参数类型为String,为图片的base64编码;批量请求时,参数类型为List[String],以列表形式存放各图片的base64编码,单次请求不超过24张。 取值范围:建议整个请求体大小不超过4M,建议使用JPG、PNG、JPEG、BMP格式的图片。 默认取值:默认只支持RGB三通道图片数据,其他通道的数据暂不支持。 mode 否 String 参数解释:取值为"single"或者"multiple",分别表示单标签分类和多标签分类模式,二者取一。 约束限制: 取值范围:取值为"single"或者"multiple"。 默认取值:默认设置为训练得到的模型对应的模式 threshold 否 dict 参数解释:多标签分类时,各标签对应的预测得分阈值,预测得分小于阈值的预测结果将会被过滤。 约束限制:仅在多标签分类模式下有效。 取值范围: 默认取值: top 否 int 参数解释:单标签分类时,用于规定输出top N的预测得分对应的预测结果。 约束限制:仅在单标签分类模式下有效。 取值范围: 默认取值:
  • 错误码 当您调用API时,如果遇到“APIGW”开头的错误码,请参见API网关错误码进行处理。遇到“APIG”开头的错误码,请参考本文档进行处理。 表1 错误码 模块 错误码 错误信息 说明 建议解决方法 模型推理 PANGU.0010 parameter illegal. 请求参数错误。 请参考《API文档》输入正确的请求参数,并重新调试API。 PANGU.0011 Authentication failed. 认证失败。 认证鉴权失败,请参考《API文档》认证鉴权章节重新进行认证。 PANGU.0012 The authentication information is missing. 缺少身份验证信息。 请检查调用API时是否有传入认证鉴权信息。 PANGU.0031 Inner service exception. 服务内部异常。 请联系服务技术支持协助解决。 PANGU.3254 The requested inference service does not exist. 资源不存在。 请检查调用API时projectId和deploymentId是否填写正确,推理服务状态是否可用。 PANGU.3267 The number of service invoking requests exceeds the project limit. 用户调用过于频繁。 请降低请求频率。 PANGU.3278 required api parameter is not present. 请求参数丢失。 请检查调用API时请求参数是否填写完整、是否有拼写错误、取值是否正确。 PANGU.3318 The total length of the question should be between 1 and 4096. Content长度不合法 请参考《API文档》检查请求参数中输入的Content参数长度是否不在范围内,并重新调试API。 PANGU.3320 The parameter [n] can only be 1 or 2 when calling non-streaming. 非流式调用推理服务传的参数只能是1或者2。 请使用正确的取值:1或者2。 PANGU.3321 The parameter [n] can only be 1 when calling streaming. 流式调用推理服务n只能取1。 请使用正确的取值:1。 PANGU.3342 Failed to invoke the inference service. please check the details field. 调用推理服务失败,请查看错误详情。 调用推理服务失败,请查看错误详情。 IIT.0201 The input param is invalid!/The input param is invalid, please check your key! 请求参数不合法。 请检查请求参数是否填写正确。 IIT.0202 Interval Server Error! 内部错误。 请联系服务技术支持协助解决。 IIT.0203 The input param is invalid, the input data lens is less than the train data lens! 请求参数不合法,输入参数中的数据长度小于训练所用数据长度。 请确认请求body中特征名称、特征数量是否与训练数据中的特征一致。 PREDICT.0102 Json format is wrong!或者其他与数据相关的特定报错信息 请求数据非JSON格式 或者其他与数据相关的特定错误 请将请求体设置为JSON格式 或者根据数据相关的特定报错信息调整请求体 PREDICT.0201 The input param is invalid!/The input param is invalid, please check your key! 请求参数不合法。 请检查请求参数是否填写正确。 PREDICT.0202 Interval Server Error! 内部错误。 请联系服务技术支持协助解决。 PREDICT.0203 The input param is invalid, the input data lens is less than the train data lens! 请求参数不合法,输入参数中的数据长度小于训练所用数据长度。 请确认请求body中特征名称、特征数量是否与训练数据中的特征一致。 APIG.0101 The API does not exist or has not been published in the environment. 访问的API不存在或尚未在环境中发布。 请检查API的URL是否拼写正确,例如,URL中是否缺少project_id。 HTTP请求方法(POST,GET等)是否正确。 APIG.0201 Backend timeout. 请求超时。 请检查原调用请求是否过于频繁,如果是并发过大,可以通过重试机制解决,在代码里检查返回值,碰到这个并发错误可以延时一小段时间(如2-5s)重试请求;也可以后端检查上一个请求结果,上一个请求返回之后再发送下一个请求,避免请求过于频繁。 请与技术支持确认,API是否已完成部署。 APIG.0301 Incorrect IAM authentication information. IAM身份验证信息不正确: decrypt token fail:token解析失败。 token expires:token过期。 verify aksk signature fail:AK/SK认证失败。 x-auth-token not found:未找到x-auth-token参数。 token解析失败,请检查获取token的方法,请求体信息是否填写正确,token是否正确;检查获取token的环境与调用的环境是否一致。 token超时(token expires) ,请重新获取token,使用不过期的token。 请检查AK/SK是否正确(AK对应的SK错误,不匹配;AK/SK中多填了空格)。 AK/SK频繁出现鉴权出错,连续错误5次以上,被锁定5分钟(5分钟内,则一直认为其是异常的鉴权请求),5分钟后解锁重新认证。 检查账号权限,是否欠费,被冻结等。 检查调用API时,请求header参数X-Auth-Token是否拼写正确。 APIG.0308 The throttling threshold has been reached: policy user over ratelimit,limit:XX,time:1 minute. 发送请求超过了服务的默认配置限流。 通过重试机制,在代码里检查返回值,碰到并发错误可以延时一小段时间(如2-5s)重试请求。 后端检查上一个请求结果,上一个请求返回之后再发送下一个请求,避免请求过于频繁。 父主题: 附录
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 用于获取操作API的权限。获取Token接口响应消息头中X-Subject-Token的值即为Token。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 stream 是 Boolean 是否开启流式调用,默认开启。 true:开启 false:不开启 说明: 当前Agent只支持流式调用,需设置为true。 表3 请求Body参数 参数 是否必选 参数类型 描述 query 是 String 用户问题,作为运行Agent的输入。
  • 响应参数 流式(Header中的stream参数为true) 状态码: 200 表4 流式输出的数据单元 参数 参数类型 描述 data String stream=true时,执行Agent的消息以流式形式返回。 生成的内容以增量的方式逐步发送回来,每个data字段均包含一部分生成的内容,直到所有data返回,响应结束。 表5 流式输出的数据单元 参数 参数类型 描述 event String 数据单元类型,有以下几种类型: start,开始节点,表示开始调用模型进行会话。 message,消息节点,表示模型返回的消息。 plugin_start,插件调用请求节点,表示调用插件的请求信息。 plugin_end,插件调用响应节点,表示调用插件的响应信息。 statistic_data,执行数据节点,包含本次调用的耗时信息。 summary_response,消息总结节点,包含本次调用的全量响应信息。 done,流式调用结束节点,表示流式响应结束。 content Object 消息块内容,不同event的消息块内容不同。 createdTime long 消息块返回的时间戳,如1733817348963。 latency Object 耗时,包括以下三个元素: plugin,插件调用耗时 model,模型调用耗时 overall,总耗时 plugin Object 插件请求信息,包括以下两个元素: name,插件名 arguments,插件入参名
  • 请求示例 流式(Header中的stream参数为true) POST https://{endpoint}/v1/{project_id}/agent-run/agents/{agent_id}/conversations/{conversation_id} Request Header: Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... stream: true Request Body: { "query": "查询A12会议室在9:00到10:00的状态" }
  • 响应示例 data:{"event":"start","createdTime":1735558575017} data:{"event":"message","content":"好的","createdTime":1735558576300} data:{"event":"message","content":",","createdTime":1735558576301} data:{"event":"message","content":"我将","createdTime":1735558576301} data:{"event":"message","content":"调用","createdTime":1735558576302} data:{"event":"message","content":"query","createdTime":1735558576302} data:{"event":"message","content":"_","createdTime":1735558576302} data:{"event":"message","content":"meeting","createdTime":1735558576302} data:{"event":"message","content":"_","createdTime":1735558576302} data:{"event":"message","content":"room","createdTime":1735558576303} data:{"event":"message","content":"_status","createdTime":1735558576303} data:{"event":"message","content":"工具","createdTime":1735558576303} data:{"event":"message","content":"来","createdTime":1735558576304} data:{"event":"message","content":"查询","createdTime":1735558576304} data:{"event":"message","content":"A","createdTime":1735558576304} data:{"event":"message","content":"12","createdTime":1735558576304} data:{"event":"message","content":"会议室","createdTime":1735558576305} data:{"event":"message","content":"在","createdTime":1735558576305} data:{"event":"message","content":"9","createdTime":1735558576305} data:{"event":"message","content":":00","createdTime":1735558576305} data:{"event":"message","content":"到","createdTime":1735558576306} data:{"event":"message","content":"10","createdTime":1735558576306} data:{"event":"message","content":":00","createdTime":1735558576306} data:{"event":"message","content":"的状态","createdTime":1735558576306} data:{"event":"message","content":"。","createdTime":1735558576306} data:{"event":"message","content":"请","createdTime":1735558576307} data:{"event":"message","content":"稍","createdTime":1735558576307} data:{"event":"message","content":"等","createdTime":1735558576307} data:{"event":"message","content":"。","createdTime":1735558576307} data:{"event":"message","content":" ","createdTime":1735558576307} data:{"event":"message","content":" query","createdTime":1735558576307} data:{"event":"message","content":"_","createdTime":1735558576308} data:{"event":"message","content":"meeting","createdTime":1735558576308} data:{"event":"message","content":"_","createdTime":1735558576308} data:{"event":"message","content":"room","createdTime":1735558576308} data:{"event":"message","content":"_status","createdTime":1735558576308} data:{"event":"message","content":"|","createdTime":1735558576308} data:{"event":"message","content":"{\"","createdTime":1735558576309} data:{"event":"message","content":"meeting","createdTime":1735558576309} data:{"event":"message","content":"Room","createdTime":1735558576309} data:{"event":"message","content":"\":","createdTime":1735558576309} data:{"event":"message","content":"{\"","createdTime":1735558576309} data:{"event":"message","content":"number","createdTime":1735558576310} data:{"event":"message","content":"\":","createdTime":1735558576310} data:{"event":"message","content":" 12","createdTime":1735558576310} data:{"event":"message","content":"}","createdTime":1735558576310} data:{"event":"message","content":",\"","createdTime":1735558576310} data:{"event":"message","content":"start","createdTime":1735558576310} data:{"event":"message","content":"\":\"","createdTime":1735558576311} data:{"event":"message","content":"9","createdTime":1735558576311} data:{"event":"message","content":":00","createdTime":1735558576311} data:{"event":"message","content":"\",\"","createdTime":1735558576311} data:{"event":"message","content":"end","createdTime":1735558576311} data:{"event":"message","content":"\":\"","createdTime":1735558576311} data:{"event":"message","content":"10","createdTime":1735558576311} data:{"event":"message","content":":00","createdTime":1735558576312} data:{"event":"message","content":"\"}","createdTime":1735558576312} data:{"event":"message","content":" ","createdTime":1735558576312} data:{"event":"plugin_start","type":"plugin","latency":{"overall":1.3},"plugin":{"name":"query_meeting_room_status","arguments":"{\"meetingRoom\": {\"number\": 12}, \"start\": \"9:00\", \"end\": \"10:00\"}"},"createdTime":1735558576316} data:{"event":"plugin_end","content":{"result":"空闲"},"role":"function","latency":{"overall":1.51,"plugin":0.0},"createdTime":1735558576521} data:{"event":"start","createdTime":1735558576522} data:{"event":"message","content":"A","createdTime":1735558576976} data:{"event":"message","content":"12","createdTime":1735558576977} data:{"event":"message","content":"会议室","createdTime":1735558576977} data:{"event":"message","content":"在","createdTime":1735558576977} data:{"event":"message","content":"9","createdTime":1735558576978} data:{"event":"message","content":":00","createdTime":1735558576978} data:{"event":"message","content":"到","createdTime":1735558576978} data:{"event":"message","content":"10","createdTime":1735558576978} data:{"event":"message","content":":00","createdTime":1735558576978} data:{"event":"message","content":"的时间","createdTime":1735558576978} data:{"event":"message","content":"段","createdTime":1735558576979} data:{"event":"message","content":"内","createdTime":1735558576979} data:{"event":"message","content":"是","createdTime":1735558576979} data:{"event":"message","content":"空闲","createdTime":1735558576979} data:{"event":"message","content":"的","createdTime":1735558576979} data:{"event":"message","content":"。","createdTime":1735558576980} data:{"event":"statistic_data","latency":{"overall":1.97},"createdTime":1735558576986} data:{"event":"summary_response","content":"A12会议室在9:00到10:00的时间段内是空闲的。","role":"assistant","createdTime":1735558576987} data:{"event":"done","createdTime":1735558577011}
  • 响应示例 { "result": [ { "RegisterMatrix": [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] }, { "Box": { "Y": 0, "Width": 100, "Angle": 0, "X": 0, "Height": 100 }, "Score": 0.9, "label": "person" } ] }
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 result List 物体检测的识别结果。 表6 响应Body参数 参数 参数类型 描述 RegisterMatrix List 默认为[[1, 0, 0], [0, 1, 0], [0, 0, 1]],表示图片特征矩阵。 Label String 预测类别。 Score Float 置信度。 Box Dict 检测到的目标主体信息,格式为{"x":x1,"y":y1,"width":w,"height":h,'Angle':angle}。 x:检测到的目标主体区域的左上角x坐标。 y:检测到的目标主体区域的左上角y坐标。 width:检测到的目标主体区域的宽度。 height:检测到的目标主体区域的高度。 angle: 检测到的目标主体区域的角度。 状态码: 400 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码。 error_msg String 错误信息。
  • URI 图片接口:POST /v1/{project_id}/infer-api/proxy/service/{deployment_id}/ 获取URI方式请参见请求URI。 表1 推理接口路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID,获取方法请参见获取项目ID。 deployment_id 是 String 模型的部署ID,获取方法请参见获取模型部署ID。
  • 请求参数 使用Token认证方式的请求Header参数见表1。 表2 请求Header参数(Token认证) 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 用于获取操作API的权限。获取Token接口响应消息头中X-Subject-Token的值即为Token。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 使用API Key认证方式的请求Header参数见表2。 表3 请求Header参数(API Key认证) 参数 是否必选 参数类型 描述 X-Apig-AppCode 是 String API Key值。 用于获取操作API的权限。API Key认证响应消息头中X-Apig-AppCode的值即为API Key。 Content-Type 是 String 发送的实体的MIME类型,参数值为“application/json”。 表4 图片请求Body参数 参数 是否必选 参数类型 描述 images 是 String 参数解释:被检测图片的base64编码。 约束限制:建议使用PNG、JPEG、BMP、JPG、WEBP格式的图片。只支持单张图片输入,分辨率范围为1px-10000px,且长短边比例不能高于5。并且base64编码后的图片大小不超过10MB。支持RGB三通道格式的图像 取值范围: 默认取值: nms_iou_thr 是 Float 参数解释:极大值抑制阈值。 约束限制: 取值范围:范围在0.0~1.0之间。 默认取值: agnositc_nms 是 Bool 参数解释:是否进行类间nms。 约束限制: 取值范围:是填写true,不是填写false。 默认取值:
  • 请求示例 单轮问答 POST https://{endpoint}/v1/{project_id}/deployments/{deployment_id}/chat/completions Request Header: Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "messages": [ { "content": "高血压需要注意什么?" } ], "temperature": 0.9, "max_tokens": 600 } 单轮流式问答(stream参数值为true) { "messages": [ { "content": "心血管疾病的范围有哪些?" } ], "temperature": 0.9, "max_tokens": 600, "stream": "true" } 带有人设的单轮问答(role参数值为system) { "messages": [ { "role": "system", "content": "你的名字叫智子,是一名智能健康管理师,擅长医学知识科普、健康问题解答。" }, { "role": "user", "content": "肚子疼该挂什么科室?" } ], "temperature": 0.9, "max_tokens": 600 } 带有人设的单轮流式问答(role参数值为system,stream参数值为true) { "messages": [ { "role": "system", "content": "你的名字叫智子,是一名智能健康管理师,擅长医学知识科普、健康问题解答。" }, { "role": "user", "content": "肚子疼该挂什么科室?" } ], "temperature": 0.9, "max_tokens": 600, "stream": "true" } 多轮问答 # 多轮问答传参方法:在完成第一轮问答,进行第二轮问答时,需要将第一轮的问题和答案、第二轮问题作为参数传入……依次类推,完成多轮对话。 { "messages": [ { "content": "有点咳嗽" //第一轮问题 }, { "content": "您咳嗽的症状有多久了?有没有伴随其他症状,比如发热、咳痰?" //第一轮答案 }, { "content": "一周了,没有痰,没有发热,喉咙有点痛" //第二轮问题 }, { "content": " 您最近有没有接触过感冒或其他呼吸道感染的人?另外,您是否吸烟或有其他呼吸系统疾病史?" //第二轮答案 }, { "content": "以前没有相关疾病,不确定有没有接触过感冒的患者" //第三轮问题 } ], "temperature": 0.9, "max_tokens": 600 } 多轮流式问答(stream参数值为true) # 多轮问答传参方法:在完成第一轮问答,进行第二轮问答时,需要将第一轮的问题和答案、第二轮问题作为参数传入……依次类推,完成多轮对话。 { "messages": [ { "content": "有点咳嗽" //第一轮问题 }, { "content": "您咳嗽的症状有多久了?有没有伴随其他症状,比如发热、咳痰?" //第一轮答案 }, { "content": "一周了,没有痰,没有发热,喉咙有点痛" //第二轮问题 }, { "content": "您最近有没有接触过感冒或其他呼吸道感染的人?另外,您是否吸烟或有其他呼吸系统疾病史?" //第二轮答案 }, { "content": "以前没有相关疾病,不确定有没有接触过感冒的患者" //第三轮问题 } ], "temperature": 0.9, "max_tokens": 600, "stream": "true" }
共100000条
提示

您即将访问非华为云网站,请注意账号财产安全