deepseek的对话风格

概述

deepseek的对话风格,比一般的模型的回答多了思考过程,这是它比较可爱的地方,模型的回答有了思考过程,对用户而言大模型的回答不完全是一个黑盒。

deepseek的对话风格

train_prompt_style = """Below is an instruction that describes a task, paired with an input that provides further context.
Write a response that appropriately completes the request.
Before answering, think carefully about the question and create a step-by-step chain of thoughts to ensure a logical and accurate response.


### Instruction:
You are a medical expert with advanced knowledge in clinical reasoning, diagnostics, and treatment planning.
Please answer the following medical question.


### Question:
{}


### Response:
<think>
{}
</think>
{}"""

因此需要有一个程序,将数据集中的内容填充到上面的三个占位符{}中。

### 实现 DeepSeek 语音对话功能在嵌入式系统中的应用 #### 嵌入式系统的特性考量 嵌入式系统通常具有资源受限的特点,包括有限的处理能力、内存和存储空间。因此,在这类环境中部署复杂的AI模型需要特别注意优化性能并减少资源占用[^1]。 #### 集成 DeepSeek 语音对话 API 的步骤概述 对于希望在其设备上启用自然语言交互的应用开发者来说,可以考虑采用如下方案来集成支持多轮对话管理及上下文理解能力的DeepSeek LLM服务: - **硬件准备** - 确认目标平台具备足够的计算能力和网络连接条件以运行所需的服务。 - 对于非常严格的环境,则可能需要预先训练轻量级版本的语言模型或裁剪现有预训练模型至适合的程度。 - **软件配置** - 安装必要的依赖项,比如Python解释器及其相关库文件;如果使用的是特定的操作系统镜像,则应确保其中已经包含了所有必需组件。 - 下载适用于所选架构(如ARM Cortex-M系列MCU)经过编译后的SDK包,并按照官方文档说明完成初始化设置过程。 - **API 调用接口开发** - 使用RESTful风格或其他形式的消息传递协议向云端请求访问权限令牌。 - 构建用于发送音频流数据给远程服务器进行实时识别转换为文本字符串的功能模块。 - 接收来自远端返回的结果后解析JSON格式响应体内的意图信息,并据此执行相应的动作指令集。 - **安全措施实施** - 加密传输通道防止敏感资料泄露风险。 - 应用层面上还需加入身份验证机制保障合法用户的权益受侵害。 ```python import requests from cryptography.hazmat.primitives import serialization, hashes from cryptography.hazmat.backends import default_backend def get_access_token(api_key): url = "https://api.deepseek.com/v1/auth" headers = {"Content-Type": "application/json"} payload = {"apiKey": api_key} response = requests.post(url=url, json=payload, headers=headers).json() return response.get('accessToken') def send_audio_stream(file_path, token): with open(file_path, 'rb') as f: audio_data = f.read() url = "https://api.deepseek.com/v1/transcribe" headers = { "Authorization": f"Bearer {token}", "Content-Type": "audio/wav", } response = requests.post(url=url, data=audio_data, headers=headers) transcription_result = response.json().get('transcription') return transcription_result if __name__ == "__main__": access_token = get_access_token("your_api_key_here") result_text = send_audio_stream("/path/to/audio.wav", access_token) print(f"The recognized text is: {result_text}") ``` 上述代码片段展示了如何利用 Python 编写程序与 DeepSeek 提供的相关 Web Service 进行通信的过程[^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值