发送 Prompt 指令:请用一句话总结文本内容

一、代码实现

python 复制代码
import requests
import json

print("----start----")

url = "https://api.siliconflow.cn/v1/messages"
payload ={
    "model": "deepseek-ai/DeepSeek-V3.1",
    "messages": [
        {
            "role": "user",
            "content": "请用一句话总结以下内容:"
                       "成都是一座充满矛盾与和谐的城市:你可以上午在千年古刹感受禅意,下午在顶级CBD洽谈商务,晚上在沸腾的火锅旁体验市井的烟火气。"
                       "它既包容创新,又坚守传统;既快速发展,又懂得享受生活。这种独特的魅力,使其不仅是一个经济引擎,更是一个令人向往的生活方式目的地。"
        }
    ],
    "max_tokens": 8192
}
headers ={
"Authorization":"Bearer <替换成自己的token>",
"Content-Type":"application/json",
}

response =requests.post(url, json=payload, headers=headers)
print(response.json())

print("----end----")

二、输出内容

python 复制代码
{'content': [{'text': '成都兼具传统韵味与现代活力,在快慢张弛之间融合了历史底蕴与潮流生活,是一座既推动发展又滋养身心的魅力之都。', 'type': 'text'}], 'id': 'msg_qRSfKOVrZUv3Z7xZA4KADLzn', 'model': 'deepseek-ai/DeepSeek-V3.1-Terminus', 'role': 'assistant', 'stop_reason': 'end_turn', 'stop_sequence': None, 'type': 'message', 'usage': {'input_tokens': 86, 'output_tokens': 33}}

三、结果截图展示

相关推荐
金銀銅鐵12 小时前
[Python] 从《千字文》中随机挑选汉字
后端·python
cup1117 小时前
[技术复盘] Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
python·ai·环境变量·ci·nuitka·skill
aqi0019 小时前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵20 小时前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf21 小时前
Agent 流程编排
后端·python·agent
copyer_xyf1 天前
Agent RAG
后端·python·agent
copyer_xyf1 天前
【RAG】向量数据库:milvus
后端·python·agent
copyer_xyf1 天前
Agent 记忆管理
后端·python·agent
星云穿梭2 天前
用Python写一个带图形界面的学生管理系统——完整教程
python