Dify 生成提示词的 Prompt

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\nHere 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\nI 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\nStep 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\nYou just need to generate the output\n

总结

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

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

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

相关文章

sqli-labs靶场 less4

文章目录 sqli-labs靶场less 4 联合注入 sqli-labs靶场 每道题都从以下模板讲解&#xff0c;并且每个步骤都有图片&#xff0c;清晰明了&#xff0c;便于复盘。 sql注入的基本步骤 注入点注入类型 字符型&#xff1a;判断闭合方式 &#xff08;‘、"、’、“”&#xf…

【什么是动态链接?这里的动态是什么意思?链接了什么?】

动态链接&#xff08;Dynamic Linking&#xff09;详解 1. 什么是动态链接&#xff1f; 动态链接是 Java 虚拟机&#xff08;JVM&#xff09;在运行时将字节码中的符号引用&#xff08;Symbolic Reference&#xff09;转换为直接引用&#xff08;Direct Reference&#xff09;…

AWS S3深度剖析:云存储的瑞士军刀

1. 引言 在当今数据驱动的世界中,高效、可靠、安全的数据存储解决方案至关重要。Amazon Simple Storage Service (S3)作为AWS生态系统中的核心服务之一,为企业和开发者提供了一个强大而灵活的对象存储平台。本文将全面解析S3的核心特性,帮助读者深入理解如何充分利用这一&q…

【Game】Powerful——Martial Arts Challenge(6)

文章目录 攻略关卡一&#xff08;虎子&#xff09;关卡二关卡三关卡四关卡五关卡六——奇穷 攻略 关卡一&#xff08;虎子&#xff09; 参战选手 出手顺序 关卡二 参战选手 出手顺序 关卡三 参战选手 出手顺序 关卡四 参战选手 出手顺序 关卡五 参战选手 出手顺序 关卡六…

PPIO × UI-TARS:用自然语言操控电脑,AI Agent 的极致体验

Manus的爆火预示着AI 正在从单纯的文本生成和图像识别迈向更复杂的交互场景。字节跳动近期推出的开源项目 UI-TARS Desktop 为我们展示了一种全新的可能性&#xff1a;能够通过自然语言理解和处理来控制计算机界面。这款工具代表了人工智能与人机交互领域的重大突破&#xff0c…

电脑屏保壁纸怎么设置 桌面壁纸设置方法详解

电脑桌面壁纸作为我们每天面对的第一视觉元素&#xff0c;不仅能够彰显个人品味&#xff0c;还能营造舒适的工作或娱乐氛围。电脑桌面壁纸怎么设置呢&#xff1f;下面本文将为大家介绍Windows和macOS两大主流操作系统中设置电脑桌面壁纸的方法&#xff0c;帮助大家快速设置个性…

popupwindow拦截返回点击

目的&#xff1a;弹窗只有点击按钮可以关闭。 前提&#xff1a;弹窗内有输入框 试了网上的一些方法 设置弹窗焦点 setFocusable(false) &#xff08;会导致软键盘无法显示&#xff09;重写 onBackPressed 方法 &#xff08;不会走这里&#xff09;为 popupwindow 设置 onKey…

数学知识——矩阵乘法

使用矩阵快速幂优化递推问题 对于一个递推问题&#xff0c;如递推式的每一项系数都为常数&#xff0c;我们可以使用矩阵快速幂来对算法进行优化。 一般形式为&#xff1a; F n F 1 A n − 1 F_nF_1A^{n-1} Fn​F1​An−1 由于递推式的每一项系数都为常数&#xff0c;因此对…

GitHub 趋势日报 (2025年04月07日)

GitHub 趋势日报 (2025年04月07日) 本日报由 TrendForge 系统生成 https://trendforge.devlive.org/ &#x1f4c8; 今日整体趋势 Top 10 排名项目名称项目描述今日获星语言1microsoft/markitdownPython tool for converting files and office documents to Markdown.⭐ 1039P…

ROS多设备交互

ROS多设备连接同一个Master&#xff1a;ROS Master多设备连接-CSDN博客 在多个PC端连接同一个ROS Master后&#xff0c;接下来就可以实现不同设备之间的话题交流&#xff0c;Master主机端启动不同PC端的功能包等功能了 尽管多个PC端拥有不同的ROS工作空间&#xff0c;但是只要…

基于国内环境 在Ubuntu 上安装 Docker 指南

前言 在容器化技术主导云原生时代的今天&#xff0c;Docker 凭借其轻量化、高移植性和秒级部署能力&#xff0c;已成为开发与运维的必备工具。然而&#xff0c;国内用户在 Ubuntu 系统上安装 Docker 时&#xff0c;常因 ​官方镜像源访问受限、网络延迟高、依赖包安装失败 等问…

数据结构:二叉树(三)·(重点)

二叉树的存储结构 ⼆叉树⼀般可以使⽤两种结构存储&#xff0c;⼀种顺序结构&#xff0c;⼀种链式结构。 顺序结构 顺序结构存储就是使⽤数组来存储&#xff0c;⼀般使⽤数组只适合表⽰完全⼆叉树&#xff0c;因为不是完全⼆叉树会有 空间的浪费&#xff0c;完全⼆叉树更适合…

EasyExcel实现图片导出功能(记录)

背景&#xff1a;在旧系统的基础上&#xff0c;导出一些工单信息时&#xff0c;现需要新添加处理人的签名或者签章&#xff0c;这就涉及图片的上传、下载、写入等几个操作。 1、EasyExcel工具类 &#xff08;1&#xff09;支持下拉框的导出。 import com.alibaba.excel.Easy…

Android Material Design 3 主题配色终极指南:XML 与 Compose 全解析

最小必要颜色配置 <!-- res/values/themes.xml --> <style name"Theme.MyApp" parent"Theme.Material3.DayNight"><!-- 基础三原色 --><item name"colorPrimary">color/purple_500</item><item name"col…

【Git】“warning: LF will be replaced by CRLF”的解决办法

一、原因分析 不同操作系统的换行符标准不同&#xff1a; • Windows&#xff1a;使用 CRLF&#xff08;\r\n&#xff09;表示换行&#xff1b; • Linux/Mac&#xff1a;使用 LF&#xff08;\n&#xff09;表示换行 Git 检测到本地文件的换行符与仓库设置或目标平台不兼容时…

PyTorch 深度学习实战(33):联邦学习与隐私保护

在上一篇文章中,我们探讨了多模态学习与CLIP模型的应用。本文将深入介绍联邦学习(Federated Learning)这一新兴的分布式机器学习范式,它能够在保护数据隐私的前提下实现多方协作的模型训练。我们将使用PyTorch实现一个基础的联邦学习框架,并在图像分类任务上进行验证。 一…

蓝桥杯 web 展开你的扇子(css3)

普通答案&#xff1a; #box:hover #item1{transform: rotate(-60deg); } #box:hover #item2{transform: rotate(-50deg); } #box:hover #item3{transform: rotate(-40deg); } #box:hover #item4{transform: rotate(-30deg); } #box:hover #item5{transform: rotate(-20deg); }…

LLM驱动的智能体:基于GPT的对话智能体开发指南

前言 大语言模型&#xff08;LLM, Large Language Model&#xff09;正在彻底改变智能体&#xff08;Agent&#xff09;的设计和实现方式。从简单的聊天机器人到复杂的自动化助手&#xff0c;基于GPT等LLM的对话智能体已经在客服、教育、办公自动化、编程助手等领域得到了广泛…

深度解析 C# 中介者模式:设计与实战应用

中介者模式&#xff08;Mediator Pattern&#xff09;是一种行为型设计模式&#xff0c;其核心思想是将多个对象之间的交互集中到一个中介者对象中&#xff0c;从而减少对象之间的直接交互&#xff0c;降低耦合度。在实现复杂系统时&#xff0c;中介者模式有助于提高系统的可维…

每日算法-250408

记录今天解决的两道 LeetCode 算法题&#xff0c;主要涉及二分查找的应用。 1283. 使结果不超过阈值的最小除数 题目描述 思路 核心思路是 二分查找。 解题过程 为什么可以使用二分&#xff1f; 关键在于单调性。对于一个固定的数组 nums&#xff0c;当除数 divisor 增大时&…