云服务器内容精选

  • 请求消息体 请求消息体通常以结构化格式发出,与请求消息头中Content-Type对应,传递除请求消息头之外的内容。若请求消息体中参数支持中文,则中文字符必须为UTF-8编码。 每个接口的请求消息体内容不同,也并不是每个接口都需要有请求消息体(或者说消息体为空),GET、DELETE操作类型的接口就不需要消息体,消息体具体内容需要根据具体接口而定。 将消息体加入后的请求如下所示,详细参数解释可参考文档API章节。 POST https://{endpoint}/v1/{project_id}/deployments/{deployment_id}/chat/completions Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINOD... { "messages": [ { "content": "介绍下长江,以及长江中典型的鱼类" } ], "temperature": 0.9, "max_tokens": 600 } 综上,您可以使用curl、Postman或直接编写代码等方式发送请求调用API。对于接口,您可以从响应消息部分看到返回参数及参数说明。
  • 请求方法 HTTP请求方法,表示服务正在请求操作类型,包括: GET:请求服务器返回指定资源。 PUT:请求服务器更新指定资源。 POST:请求服务器新增资源或执行特殊操作。 DELETE:请求服务器删除指定资源,如删除对象等。 HEAD:请求服务器资源头部。 PATCH:请求服务器更新资源的部分内容。当资源不存在的时候,PATCH可能会去创建一个新的资源。 在接口的URI部分,请求方法为“POST”,例如: POST https://{endpoint}/v1/{project_id}/deployments/{deployment_id}/chat/completions
  • 请求消息头 附加请求头字段,如指定的URI和HTTP方法所要求的字段。例如,定义消息体类型的请求头“Content-Type”,请求鉴权信息等。 以下公共消息头需要添加到请求中。 Content-Type:消息体的类型(格式),必选,默认取值为“application/json”。 X-Auth-Token:用户Token,可选,当使用Token方式认证时,必须填充该字段。用户Token请参考认证鉴权中的“Token认证”。 公有云API同时支持使用AK/SK认证,AK/SK认证是使用SDK对请求进行签名,签名过程会自动往请求中添加Authorization(签名认证信息)和X-Sdk-Date(请求发送的时间)请求头。AK/SK认证的详细说明请参见:AK/SK。 添加消息头后的请求如下所示: POST https://{endpoint}/v1/{project_id}/deployments/{deployment_id}/chat/completions Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINOD...
  • 请求URI 请求URI由如下部分组成: {URI-scheme} :// {Endpoint} / {resource-path} ? {query-string} 表1 请求URI 参数 说明 URI-scheme 传输请求的协议,当前所有API均采用HTTPS协议。 Endpoint 承载REST服务端点的服务器 域名 或IP。 resource-path 资源路径,即API访问路径。从具体API的URI模块获取。 query-string 查询参数,可选,查询参数前面需要带一个“?”,形式为“参数名=参数取值”。 获取请求URI的步骤详见请求URI,示例如下: https://{endpoint}/v1/{project_id}/deployments/{deployment_id}/chat/completions
  • URL POST /v1/{project_id}/infer-api/proxy/service/{deployment_id}/perm-feat-importance 获取URI方式请参见请求URI。 表1 推理接口路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID,获取方法请参见获取项目ID。 deployment_id 是 String 模型的部署ID,获取方法请参见获取模型部署ID。
  • 请求示例 { "data": [ { "feature_1": xx, "feature_2": xx, ... "feature_n": xx, "target": 0, }, ... { "feature_1": xx, "feature_2": xx, ... "feature_n": xx, "target": 1 } ], "fi_args":{"num_shuffle_sets": 1, "sample_num": 1000 } } 此处data列表的长度至少为1000,建议通过以下代码根据csv文件生成请求体(DATA_NUM为从csv文件中采样数据的数量): import random import json import pandas as pd ENCODING_TYPE = "utf-8" DATA_NUM = 1200 data_path = "path/to/xxx.csv" df = pd.read_csv(data_path, encoding=ENCODING_TYPE) data_list = df.to_dict("records") data_list = random.sample(data_list, DATA_NUM) request_data = { "data": data_list, "fi_args": { "num_shuffle_sets": 1, "sample_num": 1000, } } request_str = json.dumps(request_data) print(request_str)
  • 状态码 HTTP状态码为三位数,分成五个类别:1xx:相关信息;2xx:操作成功;3xx:重定向;4xx:客户端错误;5xx:服务器错误。 状态码如下所示。 状态码 编码 状态说明 100 Continue 继续请求。 这个临时响应用来通知客户端,它的部分请求已经被服务器接收,且仍未被拒绝。 101 Switching Protocols 切换协议。只能切换到更高级的协议。 例如,切换到HTTPS的新版本协议。 200 OK 服务器已成功处理了请求。 201 Created 创建类的请求完全成功。 202 Accepted 已经接受请求,但未处理完成。 203 Non-Authoritative Information 非授权信息,请求成功。 204 No Content 请求完全成功,同时HTTP响应不包含响应体。 在响应OPTIONS方法的HTTP请求时返回此状态码。 205 Reset Content 重置内容,服务器处理成功。 206 Partial Content 服务器成功处理了部分GET请求。 300 Multiple Choices 多种选择。请求的资源可包括多个位置,相应可返回一个资源特征与地址的列表用于用户终端(例如:浏览器)选择。 301 Moved Permanently 永久移动,请求的资源已被永久的移动到新的URI,返回信息会包括新的URI。 302 Found 资源被临时移动。 303 See Other 查看其他地址,使用GET和POST请求查看。 304 Not Modified 所请求的资源未修改,服务器返回此状态码时,不会返回任何资源。 305 Use Proxy 所请求的资源必须通过代理访问。 306 Unused 已经被废弃的HTTP状态码。 400 Bad Request 非法请求。 建议直接修改该请求,不要重试该请求。 401 Unauthorized 在客户端提供认证信息后,返回该状态码,表明服务端指出客户端所提供的认证信息不正确或非法。 402 Payment Required 保留请求。 403 Forbidden 请求被拒绝访问。 返回该状态码,表明请求能够到达服务端,且服务端能够理解用户请求,但是拒绝做更多的事情,因为该请求被设置为拒绝访问,建议直接修改该请求,不要重试该请求。 404 Not Fou 所请求的资源不存在。 建议直接修改该请求,不要重试该请求。 405 Method Not Allowed 请求中带有该资源不支持的方法。 建议直接修改该请求,不要重试该请求。 406 Not Acceptable 服务器无法根据客户端请求的内容特性完成请求。 407 Proxy Authentication Required 请求要求代理的身份认证,与401类似,但请求者应当使用代理进行授权。 408 Request Timeout 服务器等待请求发生超时。 客户端可以随时再次提交该请求而无需进行任何更改。 409 Conflict 服务器在完成请求时发生冲突。 返回该状态码,表明客户端尝试创建的资源已经存在,或者由于冲突请求的更新操作不能被完成。 410 Gone 客户端请求的资源已经不存在。 返回该状态码,表明请求的资源已被永久删除。 411 Length Required 服务器无法处理客户端发送的不带Content-Length的请求信息。 412 Precondition Failed 未满足前提条件,服务器未满足请求者在请求中设置的其中一个前提条件。 413 Request Entity Too Large 由于请求的实体过大,服务器无法处理,因此拒绝请求。为防止客户端的连续请求,服务器可能会关闭连接。如果只是服务器暂时无法处理,则会包含一个Retry-After的响应信息。 414 Request URI Too Long 请求的URI过长(URI通常为网址),服务器无法处理。 415 Unsupported Media Type 服务器无法处理请求附带的媒体格式。 416 Requested Range Not Satisfiable 客户端请求的范围无效。 417 Expectation Failed 服务器无法满足Expect的请求头信息。 422 Unprocessable Entity 请求格式正确,但是由于含有语义错误,无法响应。 429 Too Many Requests 表明请求超出了客户端访问频率的限制或者服务端接收到多于它能处理的请求。建议客户端读取相应的Retry-After首部,然后等待该首部指出的时间后再重试。 500 Internal Server Error 表明服务端能被请求访问到,但是不能理解用户的请求。 501 Not Implemented 服务器不支持请求的功能,无法完成请求。 502 Bad Gateway 充当网关或代理的服务器,从远端服务器接收到了一个无效的请求。 503 Service Unavailable 被请求的服务无效。 建议直接修改该请求,不要重试该请求。 504 Gateway Timeout 请求在给定的时间内无法完成。客户端仅在为请求指定超时(Timeout)参数时会得到该响应。 505 HTTP Version Not Supported 服务器不支持请求的HTTPS协议的版本,无法完成处理。 父主题: 附录
  • 基本概念 账号 用户注册华为云时的账号,账号对其所拥有的资源及云服务具有完全的访问权限,可以重置用户密码、分配用户权限等。由于账号是付费主体,为了确保账号安全,建议您不要直接使用账号进行日常管理工作,而是创建用户并使用他们进行日常管理工作。 用户 由账号在 IAM 中创建的用户,是云服务的使用人员,具有身份凭证(密码和访问密钥)。 在我的凭证下,您可以查看账号ID和用户ID。通常在调用API的鉴权过程中,您需要用到账号、用户和密码等信息。 区域(Region) 从地理位置和网络时延维度划分,同一个Region内共享弹性计算、块存储、对象存储、VPC网络、弹性公网IP、镜像等公共服务。Region分为通用Region和专属Region,通用Region指面向公共租户提供通用云服务的Region;专属Region指只承载同一类业务或只面向特定租户提供业务服务的专用Region。 详情请参见区域和可用区。 可用区(AZ,Availability Zone) 一个AZ是一个或多个物理数据中心的集合,有独立的风火水电,AZ内逻辑上再将计算、网络、存储等资源划分成多个集群。一个Region中的多个AZ间通过高速光纤相连,以满足用户跨AZ构建高可用性系统的需求。 项目 华为云的区域默认对应一个项目,这个项目由系统预置,用来隔离物理区域间的资源(计算资源、存储资源和网络资源),以默认项目为单位进行授权,用户可以访问您账号中该区域的所有资源。如果您希望进行更加精细的权限控制,可以在区域默认的项目中创建子项目,并在子项目中购买资源,然后以子项目为单位进行授权,使得用户仅能访问特定子项目中资源,使得资源的权限控制更加精确。 图1 项目隔离模型 父主题: 使用前必读
  • 响应参数 状态码: 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 错误信息
  • 响应示例 { "result": [ "0", "1", ... "0" ], "pred_proba": [ { “0”: 0.791, “1”: 0.209 }, { “0”: 0.103, “1”: 0.897 }, ... { “0”: 0.665, “1”: 0.335 }, ] }
  • 请求示例 { "data": [ { "feature_1": xx, "feature_2": xx, ... "feature_n": xx }, ... { "feature_1": xx, "feature_2": xx, ... "feature_n": xx } ], "predict_proba": true }
  • 请求参数 使用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。
  • 响应示例 状态码: 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]
  • 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。
  • 请求示例 单轮问答 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" }