更新时间:2025-07-29 GMT+08:00
分享

行业NLP大模型

功能介绍

基于文本对话功能,用户可以与行业大模型进行自然而流畅的对话和交流,实现行业领域的文本生成、行业推理等场景。

URI

URI和NLP大模型一致,具体内容参见URI

请求参数

请求参数和NLP大模型一致,具体内容参见请求参数

响应参数

响应参数和NLP大模型一致,具体内容参见响应参数

请求示例

  • 单轮问答
    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"
     } 
  • 带有人设的多轮流式问答(role参数值为system,stream参数值为true)
    {
        "messages": [
            {
                "content": "你是一名医生,可以根据患者的症状描述进行提问来获取更多信息,并给患者提供合适的就诊建议", //人设
                "role": "system"
            },
            {
                "content": "有点咳嗽" //第一轮问题
            },
            {
                "content": "您咳嗽的症状有多久了?有没有伴随其他症状,比如发热、咳痰?"  //第一轮答案
            },
            {
                "content": "一周了,没有痰,没有发热,喉咙有点痛"  //第二轮问题
            },
            {
                "content": "您最近有没有接触过感冒或其他呼吸道感染的人?另外,您是否吸烟或有其他呼吸系统疾病史?"  //第二轮答案
            },
            {
                "content": "以前没有相关疾病,不确定有没有接触过感冒的患者"  //第三轮问题
            }
        ],
        "temperature": 0.5,
        "max_tokens": 2048,
        "stream": true
    }

响应示例

状态码: 200

OK

  • 单轮问答
    {
        "id": "e7c33de0-1245-42d9-a875-745845ce3b22",
        "created": 1724916022,
        "choices": [
            {
                "index": 0,
                "message": {
                    "role": null,
                    "content": "
    患者入院后,给予疏通血管、改善心脑供血、营养心肌、抗炎、稳定血压、完善相关检查等治疗。检查结果显示脑功能成像及颈部动脉血管成像磁共振检查:脑内多发缺血灶及陈旧性梗死灶,右侧基底节区脑出血软化灶,透明隔间腔,右侧椎动脉局部显影变淡。心电图检查窦性心律,心电轴正常,ST段改变。心脏超声:主动脉瓣轻度反流,左室顺应性减低。甲状腺及颌下超声:甲状腺多发结节,左侧颌下淋巴结肿大。",
                    "ppl": 8.468677045693822e-11
                }
            }
        ],
        "usage": {
            "completion_tokens": 433,
            "prompt_tokens": 10,
            "total_tokens": 443
        }
    }
  • 单轮流式问答
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "造"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "成"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "糖尿病"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "的"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "可"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "能"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "性"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "有"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "很多"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": ","}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "其"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "中"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "最"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "为"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "典"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "型"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "的"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "一"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933186, "choices": [{"message": {"content": "种"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933187, "choices": [{"message": {"content": "是"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933187, "choices": [{"message": {"content": "由"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933187, "choices": [{"message": {"content": "于"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933187, "choices": [{"message": {"content": "患"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933187, "choices": [{"message": {"content": "者"}}]}
    
    data:{"id": "19efea5b-3661-476d-a091-24e2f4432932", "created": 1687933187, "choices": [{"message": {"content": "的"}}]}
    
    data:[DONE]
  • 带有人设的单轮问答(role参数值为system)
    {
        "id": "6f2a7219-f97b-426d-84ba-b7b11c58942a",
        "created": 1724916144,
        "choices": [
            {
                "index": 0,
                "message": {
                    "role": null,
                    "content": "考虑到患者的疾病风险,推荐患者进行低强度的有氧运动,如快走、慢跑、游泳等,以及一些不需要高强度的肌力训练,如使用轻量的哑铃或做一些不需要器械的力量练习。建议一周进行3-5次有氧运动,每次30-45分钟,以及2-3次肌力训练,每次20-30分钟。这样的运动频率和强度有助于患者改善心肺功能,增加肌肉力量,同时对控制体重、血压、血糖、血脂等有积极影响。",
                    "ppl": 1.6271554153410462e-20
                }
            }
        ],
        "usage": {
            "completion_tokens": 220,
            "prompt_tokens": 47,
            "total_tokens": 267
        }
    }
  • 带有人设的单轮流式问答(role参数值为system,stream参数值为true)
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "小朋友们"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": ","}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "今天我们"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "要"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "学习"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "做"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "眼保健操"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "。"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "你们"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933298, "choices": [{"message": {"content": "准备好"}}]}
    
    data:{"id": "cc4dfd25-27d0-41ca-a940-c78313f6785c", "created": 1687933299, "choices": [{"message": {"content": "了吗"}}]}
    ...
    data:[DONE]
  • 多轮问答
    # 多轮请求示例返回的结果如下
    {
        "id": "4e2b7961-c4b2-4263-8e4c-6f0467ebddcb",
        "created": 1724916330,
        "choices": [
            {
                "index": 0,
                "message": {
                    "role": null,
                    "content": "**就诊建议**:1.泌尿系感染: 建议前往泌尿科进行进一步的评估和治疗。2.左肾强回声光点: 建议前往泌尿科或肾内科进行详细检查,以明确是否为肾结石或钙化,并接受相应的治疗。3.子宫疾病: 建议前往妇科进行进一步的诊断和治疗。4.乳腺结节: 建议前往乳腺科进行进一步的检查,以排除恶性病变的可能性。5.甲状腺结节: 建议前往内分泌科进行进一步的评估,可能需要进行细针穿刺活检。6.脂肪肝: 建议前往消化内科或肝病科进行评估,并根据医生建议进行治疗。7.低度鳞状上皮内病变(LSIL)和 HPV 81感染: 建议前往妇科进行阴道镜检查,并咨询医生关于 HPV的治疗和预防策略。8.轻度肝功能异常: 建议前往肝病科进行进一步的检查和治疗。9.幽门螺杆菌感染: 建议前往消化内科接受检测和适当的抗菌治疗。10.糖链抗原72-4升高: 建议前往肿瘤科进行进一步的评估,包括但不限于内窥镜检查、活检等,以明确诊断。11.二尖瓣轻度返流、三尖瓣轻度返流: 建议前往心内科进行评估,可能需要定期跟踪检查。",
                    "ppl": 5.964045702630172e-39
                }
            }
        ],
        "usage": {
            "completion_tokens": 569,
            "prompt_tokens": 117,
            "total_tokens": 686
        }
    }
  • 多轮流式问答(stream参数值为true)
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "造成"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "糖尿病"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "的"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "可能性"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "有"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "很多"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": ","}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "其中"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "最"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "为"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "典型"}}]}
    
    data:{"id": "446ce2d4-0989-4599-960b-9aa61a9cfc68", "created": 1687933826, "choices": [{"message": {"content": "的"}}]}
    
    data:[DONE]

状态码

请参见状态码

错误码

请参见错误码

相关文档