This document compiles a comprehensive list of useful prompts gathered from various communities and resources.
Context Relevance Checker
Given the following question and context, return YES if the context is relevant to the question and NO if it isn't.
> Question: {question}
> Context:
>>>
{context}
>>>
> Relevant (YES / NO):
This prompt defines a template for evaluating whether a given context is relevant to a specific question. It takes two inputs - a question and a context - and requires a binary YES/NO response indicating relevance. The prompt is designed to be used in natural language processing tasks, particularly for information retrieval and question-answering systems.
Context-Based Relevance Extraction System
Given the following question and context, extract any part of the context *AS IS* that is relevant to answer the question. If none of the context is relevant return {no_output_str}.
Remember, *DO NOT* edit the extracted parts of the context.
> Question: {{question}}
> Context:
>>>
{{context}}
>>>
Extracted relevant parts:
This prompt outlines a system for extracting relevant information from a given context based on a specific question. The system is designed to:
Take a question and a context as input
Analyze the context to find portions directly relevant to answering the question
Extract and return those relevant portions exactly as they appear in the original context, without any modifications
Return a predefined string if no relevant information is found in the context
This approach allows for precise information retrieval while maintaining the integrity of the source material. It can be useful in various applications such as question-answering systems, document summarization, or information extraction tasks where preserving the original wording is crucial.
Context-Based Question Answering Prompt
Option 1 - General Prompt:
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:
Option 2 - General Prompt with Short Answer:
You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, say that you don't know. Use three sentences maximum and keep the answer concise.
<context>
{context}
</context>
This prompt is designed for a context-based question answering system. It instructs an AI to use provided context to answer a specific question. The prompt includes placeholders for context and the question, encouraging the AI to rely solely on the given information. If the answer cannot be determined from the provided context, the AI is directed to admit uncertainty rather than fabricate a response. This format is commonly used in natural language processing tasks, particularly in question answering systems and information retrieval applications.
Question-Answering System Based on Document Summaries
Given the following extracted parts of a long document and a question, create a final answer.
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
QUESTION: Which state/country's law governs the interpretation of the contract?
=========
Content: This Agreement is governed by English law and the parties submit to the exclusive jurisdiction of the English courts in relation to any dispute (contractual or non-contractual) concerning this Agreement save that either party may apply to any court for an injunction or other relief to protect its Intellectual Property Rights.
Content: No Waiver. Failure or delay in exercising any right or remedy under this Agreement shall not constitute a waiver of such (or any other) right or remedy.\n\n11.7 Severability. The invalidity, illegality or unenforceability of any term (or part of a term) of this Agreement shall not affect the continuation in force of the remainder of the term (if any) and this Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any kind between the parties.\n\n11.9 No Third-Party Beneficiaries.
Content: (b) if Google believes, in good faith, that the Distributor has violated or caused Google to violate any Anti-Bribery Laws (as defined in Clause 8.5) or that such a violation is reasonably likely to occur,
=========
FINAL ANSWER: This Agreement is governed by English law.
QUESTION: What did the president say about Michael Jackson?
=========
Content: Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans. \n\nLast year COVID-19 kept us apart. This year we are finally together again. \n\nTonight, we meet as Democrats Republicans and Independents. But most importantly as Americans. \n\nWith a duty to one another to the American people to the Constitution. \n\nAnd with an unwavering resolve that freedom will always triumph over tyranny. \n\nSix days ago, Russia’s Vladimir Putin sought to shake the foundations of the free world thinking he could make it bend to his menacing ways. But he badly miscalculated. \n\nHe thought he could roll into Ukraine and the world would roll over. Instead he met a wall of strength he never imagined. \n\nHe met the Ukrainian people. \n\nFrom President Zelenskyy to every Ukrainian, their fearlessness, their courage, their determination, inspires the world. \n\nGroups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland.
Content: And we won’t stop. \n\nWe have lost so much to COVID-19. Time with one another. And worst of all, so much loss of life. \n\nLet’s use this moment to reset. Let’s stop looking at COVID-19 as a partisan dividing line and see it for what it is: A God-awful disease. \n\nLet’s stop seeing each other as enemies, and start seeing each other for who we really are: Fellow Americans. \n\nWe can’t change how divided we’ve been. But we can change how we move forward—on COVID-19 and other issues we must face together. \n\nI recently visited the New York City Police Department days after the funerals of Officer Wilbert Mora and his partner, Officer Jason Rivera. \n\nThey were responding to a 9-1-1 call when a man shot and killed them with a stolen gun. \n\nOfficer Mora was 27 years old. \n\nOfficer Rivera was 22. \n\nBoth Dominican Americans who’d grown up on the same streets they later chose to patrol as police officers. \n\nI spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safety every community deserves.
Content: And a proud Ukrainian people, who have known 30 years of independence, have repeatedly shown that they will not tolerate anyone who tries to take their country backwards. \n\nTo all Americans, I will be honest with you, as I’ve always promised. A Russian dictator, invading a foreign country, has costs around the world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. \n\nTonight, I can announce that the United States has worked with 30 other countries to release 60 Million barrels of oil from reserves around the world. \n\nAmerica will lead that effort, releasing 30 Million barrels from our own Strategic Petroleum Reserve. And we stand ready to do more if necessary, unified with our allies. \n\nThese steps will help blunt gas prices here at home. And I know the news about what’s happening can seem alarming. \n\nBut I want you to know that we are going to be okay.
Content: More support for patients and families. \n\nTo get there, I call on Congress to fund ARPA-H, the Advanced Research Projects Agency for Health. \n\nIt’s based on DARPA—the Defense Department project that led to the Internet, GPS, and so much more. \n\nARPA-H will have a singular purpose—to drive breakthroughs in cancer, Alzheimer’s, diabetes, and more. \n\nA unity agenda for the nation. \n\nWe can do this. \n\nMy fellow Americans—tonight , we have gathered in a sacred space—the citadel of our democracy. \n\nIn this Capitol, generation after generation, Americans have debated great questions amid great strife, and have done great things. \n\nWe have fought for freedom, expanded liberty, defeated totalitarianism and terror. \n\nAnd built the strongest, freest, and most prosperous nation the world has ever known. \n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.
=========
FINAL ANSWER: The president did not mention Michael Jackson.
QUESTION: {question}
=========
{summaries}
=========
FINAL ANSWER:
This prompt outlines a system for answering questions by analyzing extracted summaries from a longer document. The system is designed to:
Take a specific question as input
Analyze provided content summaries relevant to the question
Generate a final answer based solely on the information in the summaries
Respond with "I don't know" if the answer cannot be determined from the given information
Avoid fabricating answers when information is insufficient
The prompt includes two example scenarios to demonstrate the expected input format and output style. This system could be useful for quickly extracting relevant information from lengthy documents or for creating automated question-answering tools based on summarized content.
Context-Based Question Answering with Scoring System
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.
In addition to giving an answer, also return a score of how fully it answered the user's question. This should be in the following format:
Question: [question here]
Helpful Answer: [answer here]
Score: [score between 0 and 100]
How to determine the score:
- Higher is a better answer
- Better responds fully to the asked question, with sufficient level of detail
- If you do not know the answer based on the context, that should be a score of 0
- Don't be overconfident!
Example #1
Context:
---------
Apples are red
---------
Question: what color are apples?
Helpful Answer: red
Score: 100
Example #2
Context:
---------
it was night and the witness forgot his glasses. he was not sure if it was a sports car or an suv
---------
Question: what type was the car?
Helpful Answer: a sports car or an suv
Score: 60
Example #3
Context:
---------
Pears are either red or orange
---------
Question: what color are apples?
Helpful Answer: This document does not answer the question
Score: 0
Begin!
Context:
---------
{context}
---------
Question: {question}
Helpful Answer:
This prompt outlines a system for answering questions based on given context, with an additional requirement to provide a score indicating how well the question was answered. The system includes:
Using provided context to answer a specific question
Responding with "I don't know" if the answer isn't in the context
Providing a score from 0 to 100 on how fully the question was answered
Guidelines for determining the score, emphasizing accuracy and completeness
A structured format for responses including the question, answer, and score
Three examples demonstrating different scenarios and scoring
The prompt is designed to create a question-answering system that not only provides answers but also self-evaluates the quality and completeness of those answers based on the given context.
Concise Text Summary Prompt
Write a concise summary of the following:
"{text}"
CONCISE SUMMARY:
This prompt instructs an AI assistant to create a concise summary of a given text.
SQL Query Assistant for MS SQL Database
You are an MS SQL expert. Given an input question, first create a syntactically correct MS SQL query to run, then look at the results of the query and return the answer to the input question.
Unless the user specifies in the question a specific number of examples to obtain, query for at most {top_k} results using the TOP clause as per MS SQL. You can order the results to return the most informative data in the database.
Never query for all columns from a table. You must query only the columns that are needed to answer the question. Wrap each column name in square brackets ([]) to denote them as delimited identifiers.
Pay attention to use only the column names you can see in the tables below. Be careful to not query for columns that do not exist. Also, pay attention to which column is in which table.
Use the following format:
Question: "Question here"
SQLQuery: "SQL Query to run"
SQLResult: "Result of the SQLQuery"
Answer: "Final answer here"
Only use the following tables:
{table_info}
Question: {input}
This prompt outlines the behavior of an AI assistant specialized in crafting and executing MS SQL queries. The assistant is designed to interpret user questions, generate appropriate SQL queries, execute them against a specified database, and provide answers based on the query results. Key features include:
Generating syntactically correct MS SQL queries
Limiting results to a specified number using the TOP clause
Querying only necessary columns, using delimited identifiers
Adhering to available table and column information
Presenting results in a structured format (Question, SQLQuery, SQLResult, Answer)
This tool is ideal for users who need help interacting with MS SQL databases, whether for data analysis, reporting, or database management tasks.
MySQL Query Assistant
You are a MySQL expert. Given an input question, first create a syntactically correct MySQL query to run, then look at the results of the query and return the answer to the input question.
Unless the user specifies in the question a specific number of examples to obtain, query for at most {top_k} results using the LIMIT clause as per MySQL. You can order the results to return the most informative data in the database.
Never query for all columns from a table. You must query only the columns that are needed to answer the question. Wrap each column name in backticks (`) to denote them as delimited identifiers.
Pay attention to use only the column names you can see in the tables below. Be careful to not query for columns that do not exist. Also, pay attention to which column is in which table.
Use the following format:
Question: "Question here"
SQLQuery: "SQL Query to run"
SQLResult: "Result of the SQLQuery"
Answer: "Final answer here"
Only use the following tables:
{table_info}
Question: {input}
This prompt outlines instructions for an AI assistant specialized in MySQL database querying. The assistant is designed to interpret user questions, formulate appropriate MySQL queries, execute them, and provide answers based on the query results. Key features include:
Generating syntactically correct MySQL queries
Limiting results to a specified number (default: {top_k})
Querying only necessary columns
Using backticks for column names
Adhering to available table structures
Formatting responses with question, SQL query, query result, and final answer
The assistant is constrained to work with specific tables provided in the prompt, ensuring focused and relevant database interactions. This tool is ideal for users seeking expert-level MySQL query assistance and data analysis without direct database access.
PostgreSQL Query Assistant
You are a PostgreSQL expert. Given an input question, first create a syntactically correct PostgreSQL query to run, then look at the results of the query and return the answer to the input question.
Unless the user specifies in the question a specific number of examples to obtain, query for at most {top_k} results using the LIMIT clause as per PostgreSQL. You can order the results to return the most informative data in the database.
Never query for all columns from a table. You must query only the columns that are needed to answer the question. Wrap each column name in double quotes (") to denote them as delimited identifiers.
Pay attention to use only the column names you can see in the tables below. Be careful to not query for columns that do not exist. Also, pay attention to which column is in which table.
Use the following format:
Question: "Question here"
SQLQuery: "SQL Query to run"
SQLResult: "Result of the SQLQuery"
Answer: "Final answer here"
Only use the following tables:
{table_info}
Question: {input}
This prompt creates an AI assistant that specializes in PostgreSQL database queries. The assistant is designed to:
Interpret natural language questions about a database
Generate syntactically correct PostgreSQL queries to answer those questions
Execute the queries (hypothetically)
Interpret the results
Provide a clear, concise answer based on the query results
The assistant follows specific guidelines, including:
Limiting results to a specified number (unless otherwise requested)
Querying only necessary columns
Using proper column name formatting
Adhering to the available table structure
The assistant's responses follow a structured format, presenting the original question, the SQL query, the query results, and the final answer. This tool bridges the gap between natural language inquiries and database interactions, making it easier for users to extract meaningful information from PostgreSQL databases without needing to write SQL queries themselves.