记录些实际应用开发过程中的prompt

Text2SQL

假设你是{dbType}的专家,需要通过问题描述和指令语句两部分内容帮忙生成对应查询SQL语句。第一部分问题说明:
{queryContent}
第二部分指令内容:
1,不能幻觉出现新的字段,schema字段、表名称、表字段名称必须使用提供的元数据内容信息,元数据信息json格式数据 {schemaInfo}
2,可能需要关联表的查询SQL才满足问题内容的要求,关联的表和表字段一定存在已经提供的元数据内容。
3,生产的sql语句使用json格式返回,返回数据格式要求{querySQL: $生成的结果SQL}。
Given the below input question and list of potential tables, output a comma separated list of the table names that may be necessary to answer this question.
Question: {query} 
Table Names: {table_names} 
Relevant Table Names:
I will give you a list of ${dataSourceType} tables schemas in JSON format, and some instructions.
Then I will ask you some questions about tables provided like Question: {question}. You might need to join tables to answer the questions.Below is the format:Table Schema: (JSON array)Instructions: (sentences)Table Schema:${JSON.stringify(tableSchemas)}Instructions:* The table in the where clause appear in the tables or temp tables you selected from.* Use FORMAT_DATE(), DO NOT use DATE_TRUNC().* Convert TIMESTAMP to DATE using DATE().* Use full column name including the table name.* You can ONLY read, cannot UPDATE or DELETE or MAKE ANY CHANGES to the data.* It is Okay to make assumptions to answer the question.* DO NOT use any field not included in schemas.* Keep the assumptions concise.* You should return assumptions and PLAIN TEXT ${dataSourceType} query for the question ONLY, NO explanation, NO markdown.* Use UNNEST() for ARRAY field.* Wrap table name with \`\`* NO content after the query.* Table name in the query should be without database name.Use the following format for response:Database: (string)Table Name: (string)Assumptions: (bullets)Query: (query)Respond I understand to start the conversation.

图表数据分析

You are the best assistant in the world for data visualization using vega-lite. I will give you metadatas which contain field name and data type for the dataset in JSON format, and some instructions.
And I will ask you some questions like Question: {question}. You should generate the vega-lite specification based on the question.Below is the format:Instructions: (sentences)Metadatas: (JSON array)Instructions:* You should return vega-lite specification for the question ONLY, NO explanation, NO markdown.* You can aggregate the field if it is quantitative and the chart type is one of bar, line, area.* You need to use more than one field in the metadatas for encoding field.* Do not ask for more information.* You can make assumptions to answer the question.* You can use any chart type and encoding.* You can image the data depends on the metadatas.Use the following format for response:Vega-lite specification: \`\`\`(JSON string)\`\`\`
Metadatas:${JSON.stringify(fields)}Respond I understand to start the conversation.
{question} 
请帮忙解析这句话中含有的维度与指标。解析要求:
1,语句中除了指标名词外,默认其他名词为维度。
2,最后的返回结果采用json数据格式,指定返回格式为{dimensions:array[$维度名称],metrics:array[$指标名称]}。

意图识别

{question} 
请帮忙判断这句话的意图是需要知识库还是数据查询。如果意图是知识库的话result返回值是1,是数据查询的话result返回值是2。
最后返回值采用json数据格式,返回值格式为{result:result_$返回值}

数学问题转换

Translate a math problem into a expression that can be executed using Python's numexpr library. Use the output of running this code to answer the question.Question: ${{Question with math problem.}}
```text
${{single line mathematical expression that solves the problem}}
```
...numexpr.evaluate(text)...
```output
${{Output of running the code}}
```
Answer: ${{Answer}}Begin.Question: What is 37593 * 67?
```text
37593 * 67
```
...numexpr.evaluate("37593 * 67")...
```output
2518731
```
Answer: 2518731Question: 37593^(1/5)
```text
37593**(1/5)
```
...numexpr.evaluate("37593**(1/5)")...
```output
8.222831614237718
```
Answer: 8.222831614237718Question: {question}

Human AI 对话

The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.Current conversation:
{history}
Human: {input}
AI:                        

ReAct-推理行动

Use the following format:Question: the input question you must answer
Thought: you should always think about what to do
Action: the action to take, should be one of [{tool_names}]
Action Input: the input to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
Thought: I now know the final answer
Final Answer: the final answer to the original input question
Begin!Question: {input}
Thought:{agent_scratchpad}

Agent-智能代理

Answer the following questions as best you can. You have access to the following tools:
Tool("Calculator", "Useful for when you need to answer questions about math.");
Tool("Search", "A search engine. Useful for when you need to answer questions about current events. Input should be a search query.");
The way you use the tools is by specifying a json blob.
Specifically, this json should have a `action` key (with the name of the tool to use) and a `action_input` key (with the input to the tool going here).The only values that should be in the "action" field are: {tool_names}The $JSON_BLOB should only contain a SINGLE action, do NOT return a list of multiple actions. Here is an example of a valid $JSON_BLOB:```
{"action": $TOOL_NAME,"action_input": $INPUT
}
```ALWAYS use the following format:Question: the input question you must answer
Thought: you should always think about what to do
Action:
```
$JSON_BLOB
```
Observation: the result of the action
... (this Thought/Action/Observation can repeat N times)
Thought: I now know the final answer
Final Answer: the final answer to the original input question
Begin! Reminder to always use the exact characters `Final Answer` when responding.

Tools-函数Calling

{"content": "Lyrics of a song","attributes": {"artist": {"type": "string","description": "Name of the song artist"},"length": {"type": "integer","description": "Length of the song in seconds"},"genre": {"type": "string","description": "The song genre, one of \"pop\", \"rock\" or \"rap\""}}
}
{"query": "teenager love","filter": "and(or(eq(\\"artist\\", \\"Taylor Swift\\"), eq(\\"artist\\", \\"Katy Perry\\")), lt(\\"length\\", 180), eq(\\"genre\\", \\"pop\\"))","limit": 2
}

Markdown schema 

<< Structured Request Schema >>
When responding use a markdown code snippet with a JSON object formatted in the \
following schema:```json
{"query": string \\ text string to compare to document contents"filter": string \\ logical condition statement for filtering documents"limit": int \\ the number of documents to retrieve
}
```The query string should contain only text that is expected to match the contents of \
documents. Any conditions in the filter should not be mentioned in the query as well.A logical condition statement is composed of one or more comparison and logical \
operation statements.A comparison statement takes the form: `comp(attr, val)`:
- `comp` ({allowed_comparators}): comparator
- `attr` (string):  name of attribute to apply the comparison to
- `val` (string): is the comparison valueA logical operation statement takes the form `op(statement1, statement2, ...)`:
- `op` ({allowed_operators}): logical operator
- `statement1`, `statement2`, ... (comparison statements or logical operation \
statements): one or more statements to apply the operation toMake sure that you only use the comparators and logical operators listed above and \
no others.
Make sure that filters only refer to attributes that exist in the data source.
Make sure that filters only use the attributed names with its function names if there are functions applied on them.
Make sure that filters only use format `YYYY-MM-DD` when handling timestamp data typed values.
Make sure that filters take into account the descriptions of attributes and only make \
comparisons that are feasible given the type of data being stored.
Make sure that filters are only used as needed. If there are no filters that should be \
applied return "NO_FILTER" for the filter value.
Make sure the `limit` is always an int value. It is an optional parameter so leave it blank if it is does not make sense.
Your goal is to structure the user's query to match the request schema provided below.{schema}
<< Example {i}. >>
Data Source:
```json
{"content": "{content}","attributes": {attributes}
}
```User Query:
{{query}}Structured Request:
{structured_request}
The output should be a markdown code snippet formatted in the following schema, including the leading and trailing "```json" and "```":```json
{
{format}
}

Formatted output

The output should be formatted as a JSON instance that conforms to the JSON schema below.As an example, for the schema {{"properties": {{"foo": {{"title": "Foo", "description": "a list of strings", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}}}
the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of the schema. The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.Here is the output schema:
```
{schema}
```
Your response should be a list of comma-separated values, e.g., `foo, bar, baz`

Summary refine & Question Answer

Write a concise summary of the following:"{text}"CONCISE SUMMARY:
Your job is to produce a final summary
We have provided an existing summary up to a certain point: {existing_answer}
We have the opportunity to refine the existing summary
(only if needed) with some more context below.
------------
{text}
------------
Given the new context, refine the original summary
If the context isn't useful, return the original summary.
Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.{context}Question: {question}
Helpful Answer:

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

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

相关文章

Vue组件中引入jQuery

两种在vue中引入jQuery的方式 1、普通html中使用jQuery 将jQuer的文件导入到项目中&#xff0c;然后直接使用<script src"jQuery.js"></script>即可。 <script src"jQuery.js"></script> 2、vue组件中使用jQuery 安装依赖 c…

KGCN---pytorch代码(2)---aggregator

代码&#xff1a; import torch import torch.nn.functional as Fclass Aggregator(torch.nn.Module):Aggregator classMode in [sum, concat, neighbor]#最后一个 neighbor 的聚合器直接就是利用邻域表示来代替 v 结点的表示def __init__(self, batch_size, dim, aggregator)…

vue组件基础及注册

1、组件的命名 kebab-case&#xff08;短横线&#xff09;命名法&#xff1a;字母全小写且必须包含一个连字符&#xff1b;例&#xff1a;my-component-namePascalCase&#xff08;帕斯卡&#xff09;命名法&#xff1a;首字符大写&#xff1b;例&#xff1a;MyComponentName …

C语言数据结构基础笔记——树、二叉树简介

1.树 树是一种 非线性 的数据结构&#xff0c;它是由 n &#xff08; n>0 &#xff09;个有限结点组成一个具有层次关系的集合。 把它叫做树是因 为它看起来像一棵倒挂的树&#xff0c;也就是说它是根朝上&#xff0c;而叶朝下的。 &#xff08;图片来源于网络&#xff09;…

【OJ】string类题目

个人主页 &#xff1a; zxctscl 如有转载请先通知 题目 1. 415字符串相加1.1 分析1.2 代码 2. 344反转字符串2.1 分析2.2 代码 3. HJ1字符串最后一个单词的长度3.1 分析3.2 代码 4. 387.字符串中的第一个唯一字符4.1 分析4.2 代码 5. 125验证回文串5.1 分析5.2 代码 1. 415字符…

【python小技能】使用Python发送电子邮件的完整指南(适合零基础)

前言 在现代通信中&#xff0c;电子邮件是一种不可或缺的工具。使用Python编程语言&#xff0c;我们可以轻松地编写代码来发送电子邮件。本文将为零基础的读者提供一个完整的指南&#xff0c;教你如何使用Python发送电子邮件 安装库 首先&#xff0c;我们需要安装smtplib库。…

wordpress被恶意搜索攻击(网址/?s=****)解决方法。

源地址&#xff1a;https://www.ctvol.com/seoomethods/1413686.html 什么叫恶意搜索攻击&#xff1f; wordpress恶意搜索攻击并不是像病毒一样的攻击&#xff0c;而是一种seo分支黑帽手段&#xff0c;通过被攻击网站搜索功能中长尾关键词来实现攻击&#xff0c;通过网址不断…

Clickhouse MergeTree原理(二)—— 表和分区的维护

作者&#xff1a;俊达 引言 MergeTree是Clickhouse中最核心的存储引擎。上一篇文章中&#xff0c;我们介绍了MergeTree的基本结构。 1、MergeTree由分区&#xff08;partiton&#xff09;和part组成。 2、Part是MergeTree可操作的基本数据单元。 当插入数据时&#xff0c;会…

MySQL 中的“两阶段提交”机制

在MySQL数据库中&#xff0c;为了确保redo log&#xff08;重做日志&#xff09;和binlog&#xff08;二进制日志&#xff09;之间的数据安全性和一致性&#xff0c;引入了“两阶段提交”这一重要概念。MySQL将redo log的写入过程细分为“prepare”和“commit”两个步骤&#x…

【LeetCode热题100】146. LRU 缓存(链表)

一.题目要求 请你设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。 实现 LRUCache 类&#xff1a; LRUCache(int capacity) 以 正整数 作为容量 capacity 初始化 LRU 缓存int get(int key) 如果关键字 key 存在于缓存中&#xff0c;则返回关键字的值&#xff0c…

Jenkins插件Parameterized Scheduler用法

Jenkins定时触发构建的同时设定参数。可以根据不同的定时构建器设置不同参数或环境变量的值。可以设置多个参数。并结合when控制stage流程的执行。结合when和triggeredBy区分定时构建的stage和手动执行的stage。 目录 什么是Parameterized Scheduler&#xff1f;如何配置实现呢…

代码随想录训练营Day24:● 理论基础 ● 77. 组合

理论基础 回溯算法解决的问题 回溯法&#xff0c;一般可以解决如下几种问题&#xff1a; 组合问题&#xff1a;N个数里面按一定规则找出k个数的集合 切割问题&#xff1a;一个字符串按一定规则有几种切割方式 子集问题&#xff1a;一个N个数的集合里有多少符合条件的子集 排列…

yolo项目中如何训练自己的数据集

1.收集自己需要标注的图片 2.打开网站在线标注网站 2.1 点击右下角Get Start 2.2点击这里上传自己的图片 上传成功后有英文的显示 点击左边的Object Detection&#xff0c;表示用于目标检测 2.3选择新建标签还是从本地加载标签 如果是本地加载标签&#xff08;左边&#…

基本常用函数help()

Python内置函数 help()函数&#xff1a;查看对象的帮助信息 print()函数&#xff1a;用于打印输出 input()函数&#xff1a;根据输入内容返回所输入的字符串类型 format()函数&#xff1a;格式化显示 len()函数&#xff1a;返回对象的长度或项目个数 slice()函数&#xf…

26-Java访问者模式 ( Visitor Pattern )

Java访问者模式 摘要实现范例 访问者模式&#xff08;Visitor Pattern&#xff09;使用了一个访问者类&#xff0c;它改变了元素类的执行算法&#xff0c;通过这种方式&#xff0c;元素的执行算法可以随着访问者改变而改变访问者模式中&#xff0c;元素对象已接受访问者对象&a…

TouchGFX之MVP

TouchGFX用户接口遵循Model-View-Presenter&#xff08;MVP&#xff09;架构模式&#xff0c;它是Model-View-Controller&#xff08;MVC&#xff09;模式的派生模式。 两者都广泛用于构建用户接口应用。 MVP模式的主要优势是&#xff1a; 关注点分离&#xff1a;将代码分成不…

mysql 排序底层原理解析

前言 本章详细讲下排序&#xff0c;排序在我们业务开发非常常见&#xff0c;有对时间进行排序&#xff0c;又对城市进行排序的。不合适的排序&#xff0c;将对系统是灾难性的&#xff0c;这个不是危言耸听。可能有些人会想&#xff0c;对于排序mysql 是怎么实现的&#xff0c;…

Android 地图SDK 绘制点 删除 指定

问题 Android 地图SDK 删除指定绘制点 详细问题 笔者进行Android 项目开发&#xff0c;对于已标记的绘制点&#xff0c;提供撤回按钮&#xff0c;即删除绘制点&#xff0c;如何实现。 解决方案 新增绘制点 private List<Marker> markerList new ArrayList<>…

Oracle数据库:使用 bash脚本 + 定时任务 自动备份数据

Oracle数据库&#xff1a;使用 bash脚本 定时任务 自动备份数据 1、前言2、为什么需要自动化备份&#xff1f;3、编写备份脚本4、备份脚本授权5、添加定时任务6、重启 crond / 检查 crond 服务状态7、备份文件检查 &#x1f496;The Begin&#x1f496;点点关注&#xff0c;收…

解决:InheritableThreadLocal与线程池共用的问题

回顾一下上篇文章&#xff1a;InheritableThreadLocal和ThreadLocal的区别和使用场景 上篇文章介绍道&#xff0c;InheritableThreadLocal 是 ThreadLocal 的一个子类&#xff0c;它不但继承了ThreadLocal的所有特性&#xff0c;父线程中的 InheritableThreadLocal 变量的值可以…