Upload prompts.py
Browse files- prompts.py +27 -0
prompts.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List
|
| 2 |
+
|
| 3 |
+
def get_classification_prompt(categories_list: List[str]) -> str:
|
| 4 |
+
"""Generate classification prompt based on the categories list."""
|
| 5 |
+
categories_str = ', '.join([f"'{category}'" for category in categories_list])
|
| 6 |
+
return (
|
| 7 |
+
f"Classify the following query into one of the following categories: {categories_str}. "
|
| 8 |
+
f"If it doesn't fit into any category, respond with 'None'. "
|
| 9 |
+
f"Return the classification, do not output absolutely anything else."
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_query_generation_prompt(query_str: str, num_queries: int) -> str:
|
| 14 |
+
"""Generate query generation prompt based on query string and number of sub-queries."""
|
| 15 |
+
return (
|
| 16 |
+
f"You are an expert at distilling a user question into sub-questions that can be used to fully answer the original query. "
|
| 17 |
+
f"First, identify the key words from the original question below: \n"
|
| 18 |
+
f"{query_str}"
|
| 19 |
+
f"Generate {num_queries} sub-queries that cover the different aspects needed to fully address the user's query.\n\n"
|
| 20 |
+
f"Here is an example: \n"
|
| 21 |
+
f"Original Question: What does test data mean and what do I need to know about it?\n"
|
| 22 |
+
f"Output:\n"
|
| 23 |
+
f"definition of 'test data'\n"
|
| 24 |
+
f"test data requirements and conditions for a bias audit\n"
|
| 25 |
+
f"examples of the use of test data in a bias audit\n\n"
|
| 26 |
+
f"Output the rewritten sub-queries, one on each line, do not output absolutely anything else."
|
| 27 |
+
)
|