Dify 生成提示词的 Prompt

news2025/4/19 3:27:03

Dify 生成提示词的 Prompt

  • **第1次提示词**
  • **第2次提示词**
  • **第3次提示词**
      • 总结

Dify 生成提示词是,会和LLM进行3次交互,下面是和LLM进行交互是的Prompt。

以下是每次提示词的概要、目标总结以及原始Prompt:


第1次提示词

概要
请求创建一个高质量的中译英助手提示词模板,要求模板结构清晰,包含变量、指令、示例等部分,并使用XML格式输出。

目标

  1. 根据任务描述(中译英助手)创建结构化的提示词模板。
  2. 使用{{变量}}格式定义变量名(仅包含字母、数字和下划线)。
  3. 包含清晰的指令(用<instructions>标签),说明如何完成任务,并避免输出XML标签。
  4. 提供相关示例(用<example>标签)。
  5. 输出语言与任务描述一致(中文)。
  6. 最终输出为XML格式,以<instruction>开头。

原始 Prompt

user\n\n

Here is a task description for which I would like you to create a high-quality prompt template for:\n
<task_description>\n
你是一个中译英 的助手\n
</task_description>\n
Based on task description, please create a well-structured prompt template that another AI could use to consistently complete the task. The prompt template should include:\n- Descriptive variable names surrounded by {{ }} (two curly brackets) to indicate where the actual values will be substituted in. Choose variable names that clearly indicate the type of value expected. Variable names have to be composed of number, english alphabets and underline and nothing else. \n
- Clear instructions for the AI that will be using this prompt, demarcated with <instructions> tags. The instructions should provide step-by-step directions on how to complete the task using the input variables. Also Specifies in the instructions that the output should not contain any xml tag. \n
- Relevant examples if needed to clarify the task further, demarcated with <example> tags. Do not use curly brackets any other than in <instruction> section. \n
- Any other relevant sections demarcated with appropriate XML tags like <input>, <output>, etc.\n
- Use the same language as task description. \n
- Output in ```xml ```and start with <instruction>\n
Please generate the full prompt template and output only the prompt template.\n

第2次提示词

概要
从输入文本中提取变量名(格式为{{变量}}),并输出为JSON列表格式。若无变量则返回空列表。

目标

  1. 从输入文本中提取所有{{变量}}格式的变量名。
  2. 变量名需符合规范(仅字母、数字、下划线)。
  3. 输出为严格JSON列表格式(如["variable_1", "variable_2"])。
  4. 若无变量则返回空列表[]
  5. 禁止输出XML标签或其他内容。
  6. 输入文本是一个XML格式的中译英助手模板,需从中提取变量名(如{{chinese_text}}{{english_translation}})。

原始 Prompt

user\n\n

I need to extract the following information from the input text. The <information to be extracted> tag specifies the \'type\', \'description\' and \'required\' of the information to be extracted. \n
<information to be extracted>\n
variables name bounded two double curly brackets. Variable name has to be composed of number, english alphabets and underline and nothing else. \n
</information to be extracted>\n\n

Step 1: Carefully read the input and understand the structure of the expected output.\n
Step 2: Extract relevant parameters from the provided text based on the name and description of object. \n
Step 3: Structure the extracted parameters to JSON object as specified in <structure>.\n
Step 4: Ensure that the list of variable_names is properly formatted and valid. The output should not contain any XML tags. Output an empty list if there is no valid variable name in input text. \n\n

### Structure\nHere is the structure of the expected output, I should always follow the output structure. \n
["variable_name_1", "variable_name_2"]\n\n

### Input Text\nInside <text></text> XML tags, there is a text that I should extract parameters and convert to a JSON object.\n
<text>\n
```xml\n
<instruction>\n
你是一个中译英的助手。请将以下中文文本翻译成英文。\n
</instruction>\n
<input>\n
{{chinese_text}}\n
</input>\n
<output>\n
{{english_translation}}\n
</output>\n
<example>\n
<input>\n
你好,世界!\n
</input>
\n<output>\n
Hello, world!\n
</output>\n
</example>\n
<example>\n
<input>\n
这是一个测试句子。\n
</input>\n<output>\n
This is a test sentence.\n
</output>\n
</example>\n
```\n
</text>\n\n

### Answer\n
I should always output a valid list. Output nothing other than the list of variable_name. Output an empty list if there is no variable name in input text.\n

第3次提示词

概要
根据任务描述(中译英助手)生成聊天机器人的开场白,要求符合助手角色,语气友好且语言与用户输入一致。

目标

  1. 从变量你是一个中译英的助手推断助手的角色和语气(如专业或友好)。
  2. 生成连贯、吸引人的开场白,明确说明助手功能。
  3. 语言需与用户输入一致(中文输入用中文,英文输入用英文)。
  4. 禁止输出XML标签。
  5. 示例输入为任务描述(中译英模板),需生成类似示例输出的欢迎语(如“欢迎!我是中译英助手,可帮您翻译中文文本……”)。

原始 Prompt

user\n\n

<instruction>\n
Step 1: Identify the purpose of the chatbot from the variable 你是一个中译英的助手 and infer chatbot's tone  (e.g., friendly, professional, etc.) to add personality traits. \n
Step 2: Create a coherent and engaging opening statement.\n
Step 3: Ensure the output is welcoming and clearly explains what the chatbot is designed to do. Do not include any XML tags in the output.\n
Please use the same language as the user's input language. If user uses chinese then generate opening statement in chinese,  if user uses english then generate opening statement in english. \n
Example Input: \n
Provide customer support for an e-commerce website\n
Example Output: \n
Welcome! I'm here to assist you with any questions or issues you might have with your shopping experience. Whether you're looking for product information, need help with your order, or have any other inquiries, feel free to ask. I'm friendly, helpful, and ready to support you in any way I can.\n
<Task>\n
Here is the task description: ```xml\n
<instruction>\n
你是一个中译英的助手。请将以下中文文本翻译成英文。\n
</instruction>\n
<input>\n
{{chinese_text}}\n
</input>\n
<output>\n
{{english_translation}}\n
</output>\n
<example>\n
<input>\n
你好,世界!\n
</input>\n
<output>\n
Hello, world!\n
</output>\n
</example>\n
<example>\n
<input>\n
这是一个测试句子。\n
</input>\n
<output>\n
This is a test sentence.\n
</output>\n
</example>\n
```\n\n

You just need to generate the output\n

总结

  • 第1次:创建结构化提示词模板(XML格式)。
  • 第2次:从文本中提取变量名(JSON列表格式)。
  • 第3次:生成角色适配的开场白(自然语言)。
    共同点:均围绕“中译英助手”任务,强调格式规范(无XML标签、变量命名规则等)。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2332786.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【学生管理系统升级版】

学生管理系统升级版 需求分析&#xff1a;注册功能:登录功能&#xff1a;验证码规则&#xff1a;忘记密码&#xff1a; 实操&#xff1a;系统主页面注册功能登录功能忘记密码效果演示 需求 为学生管理系统书写一个登陆、注册、忘记密码的功能。     只有用户登录成功之后&…

Web3 的云基础设施正在成型,Polkadot 2.0 用三项技术改写“上链成本”

在Web3基础设施内卷加剧的今天&#xff0c;“如何以更低成本、更大灵活性部署一条高性能应用链”正成为开发者们最关心的问题。而刚刚走出“技术慢热”误区的Polkadot&#xff0c;正在用一套名为 Polkadot 2.0 的架构升级方案&#xff0c;重新定义这一问题的解法。 这套升级最…

机器学习——ROC曲线、PR曲线

一、ROC曲线简介 1.1 ROC曲线的构成 1.横轴&#xff08;假正率&#xff0c;FPR&#xff09;&#xff1a; 表示负样本被错误分类为正的比例&#xff08;越小越好&#xff09; 2.纵轴&#xff08;真正率&#xff0c;TPR&#xff0c;即召回率&#xff09;&#xff1a; 表示正样…

我为女儿开发了一个游戏网站

大家好&#xff0c;我是星河。 自从协助妻子为女儿开发了算数射击游戏后&#xff0c;星河就一直有个想法&#xff1a;为女儿打造一个专属的学习游戏网站。之前的射击游戏虽然有趣&#xff0c;但缺乏难度分级&#xff0c;无法根据女儿的学习进度灵活调整。而且&#xff0c;仅仅…

【Spring Cloud Netflix】GateWay服务网关

1.基本概述 GateWay用于在微服务架构中提供统一的入口点&#xff0c;对请求进行路由&#xff0c;过滤和处理。它就像是整个微服务系统的大门&#xff0c;所有外部请求都要通过它才能访问到后端的各个微服务。 2.核心概念 2.1路由(Route) 路由是Spring Cloud gateWay中最基本…

Docker部署Jenkins服务

文章目录 1.下载Jenkins服务2.部署Java21&#xff08;可选&#xff09;2.1 安装Java21 3.Maven3.9.9安装4.启动Jenkins5.初始化Jenkins5.1 入门5.2 安装推荐的插件5.3 创建第一个管理员用户5.4 实例配置5.5 Jenkins已就绪5.6 开始使用Jenkins5.7 重启Jenkins 6.配置Jenkins6.1 …

[ctfshow web入门] web40

信息收集 怎么一下子多这么多过滤啊&#xff0c;我以为跳过了好几题 这又能eval了&#xff0c;但是连$也不能用了 不能用. * ?&#xff0c;所以打不出fla*或者fla?????了 不能用/&#xff0c;构造不出日志注入和伪协议包含 仔细观察&#xff0c;禁的是中文的括号&#x…

蓝桥杯c ++笔记(含算法 贪心+动态规划+dp+进制转化+便利等)

蓝桥杯 #include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; //常使用的头文件动态规划 小蓝在黑板上连续写下从 11 到 20232023 之间所有的整数&#xff0c;得到了一个数字序列&#xff1a; S12345…

Qt问题之 告别软件因系统默认中文输入法导致错误退出的烦恼

1. 问题 使用Qt进行研发时&#xff0c;遇到一个问题&#xff0c;当在系统默认输入法中文&#xff08;英文输入法或者搜狗就不会触发闪退&#xff09;的情况下&#xff0c;选中QTableWidget控件&#xff08;QTableWidgetItem有焦点&#xff0c;但是不双击&#xff09;&#xff…

AlDente Pro for Mac电脑 充电限制保护工具

AlDente Pro for Mac电脑 充电限制保护工具 一、介绍 AlDente Pro for Mac&#xff0c;是一款充电限制保护工具&#xff0c;是可以限制最大充电百分比来保护电池的工具。锂离子和聚合物电池&#xff08;如 MacBook 中的电池&#xff09;在40&#xff05; 至 80&#xff05; 之…

算法训练之动态规划(一)

♥♥♥~~~~~~欢迎光临知星小度博客空间~~~~~~♥♥♥ ♥♥♥零星地变得优秀~也能拼凑出星河~♥♥♥ ♥♥♥我们一起努力成为更好的自己~♥♥♥ ♥♥♥如果这一篇博客对你有帮助~别忘了点赞分享哦~♥♥♥ ♥♥♥如果有什么问题可以评论区留言或者私信我哦~♥♥♥ ✨✨✨✨✨✨ 个…

Navicat连接远程PostGreSQL失败

问题描述 使用本地Navicat连接Windows远程服务器上部署的PostGreSQL数据库时,出现以下错误: 解决方案 出现以上报错信息,是因为PostGreSQL数据库服务尚未设置允许客户端建立远程连接。可做如下配置, 1. 找到PostGreSQL数据库安装目录下的data子文件夹,重点关注:postgres…

新一代达梦官方管理工具SQLark:可视化建表操作指南

在数据库管理工作中&#xff0c;新建表是一项基础且频繁的操作。SQLark 的可视化建表功能为我们提供了一种高效、便捷且丝滑流畅的建表新体验。一起来了解下吧。 SQLark 官方下载链接&#xff1a;www.sqlark.com 新建表作为常见的功能&#xff0c;相比其他管理工具&#xff0c;…

什么是EXR透视贴图 ?

EXR透视贴图是一种基于 OpenEXR 格式的高动态范围&#xff08;HDR&#xff09;图像技术&#xff0c;主要用于3D建模、渲染和视觉特效领域。它通过高精度图像数据和透视映射功能&#xff0c;为场景创建逼真的光影效果和空间深度。 技术原理 高动态范围&#xff08;HDR&#xf…

每日一题(小白)数组娱乐篇21

由于题意可知我们是要将对应的数字转换为英文&#xff0c;我们要考虑两点一个是进制的转换&#xff0c;也就是类似于我们的十进制一到9就多一位&#xff0c;这里的进制就是Z进制也就是27进制一旦到26下一位则进位&#xff1b;另一方面要考虑数字的转换也就是1~26对应A~Z。解决上…

LINUX的使用(1)-挂载云硬盘

1.磁盘的挂载&#xff1a; 这个输出是来自 fdisk 或类似的工具&#xff0c;它展示了两块磁盘的分区信息。让我们逐个分析&#xff1a; 第一块磁盘 /dev/sda: 磁盘大小: 53.7 GB (约 53687091200 字节)&#xff0c;总共有 104857600 个扇区。扇区单位: 每个扇区大小为 512 字节…

GPT-4o-image模型:开启AI图片编辑新时代

在生成式AI技术爆发式迭代的今天&#xff0c;智创聚合API率先突破多模态创作边界&#xff0c;正式发布集成GPT-4o-image模型的创作平台&#xff0c;以“文生图-图生图-循环编辑”三位一体的技术矩阵&#xff0c;重新定义数字内容生产流程。生成图像效率较传统工具提升300%&…

使用pip3安装PyTorch与PyG,实现NVIDIA CUDA GPU加速

使用python3的pip3命令安装python依赖库。 # python3 -V Python 3.12.3 # # pip3 -V pip 25.0.1 from /root/.pyenv/versions/3.12.3/lib/python3.12/site-packages/pip (python 3.12)Usage: pip3 install [options] <package> ...pip3 install [options] -r <re…

Rust主流框架性能比拼: Actix vs Axum vs Rocket

本内容是对知名性能评测博主 Anton Putra Actix (Rust) vs Axum (Rust) vs Rocket (Rust): Performance Benchmark in Kubernetes 内容的翻译与整理, 有适当删减, 相关指标和结论以原作为准 在以下中&#xff0c;我们将比较 Rust 生态中最受欢迎的几个框架。我会将三个应用程序…

【QT】QT的消息盒子和对话框(自定义对话框)

QT的消息盒子和对话框&#xff08;自定义对话框&#xff09; 一、消息盒子QMessageBox1、弹出警告盒子示例代码&#xff1a;现象&#xff1a; 2、致命错误盒子示例代码&#xff1a;现象&#xff1a; 3、帮助盒子示例代码&#xff1a;现象&#xff1a; 4、示例代码&#xff1a; …