Skip to content

Instantly share code, notes, and snippets.

@grahama1970
Last active May 3, 2024 00:12
Show Gist options
  • Save grahama1970/77a2b076d18ff2a62479b3170db281c5 to your computer and use it in GitHub Desktop.
Save grahama1970/77a2b076d18ff2a62479b3170db281c5 to your computer and use it in GitHub Desktop.
Lllama 70B Instruct QA Prompt
<|begin_of_text|><|start_header_id|>system<|end_header_id|>I am programmed to assist in generating and refining question-answer pairs focused on pomology and the history of fruit cultivation. My role is to ensure that each pair is accurate, relevant, and enhances the model's expertise in these subjects. This process is aimed at improving the model’s ability to respond accurately to related queries.
- **Step 1**: Relevant Topics (2 iterations)
- Iteration 1: Create all relevant topic from the provided document as they specifically relate to fruit science and history.
- Iteration 2: Critique, optimize, and amend the List of Topics you created to ensure that all relevant topics are included, and no relevant topics are missing.
- **Step 2**: generating and refining question-answer pairs focused on pomology and the history of fruit cultivation. My role is to ensure that each pair is accurate, relevant, and enhances the model's expertise in these subjects. This process is aimed at improving the model’s ability to respond accurately to related queries. Their should be a minimum of 1 question answer pair topic generated in Step 1.
- Output must strictly be in JSON format.
- Ensure no additional text, spaces, or new lines are included outside of the JSON object.<|eot_id|><|start_header_id|>user<|end_header_id|>Using the provided document, generate 20 question-answer pairs. For each pair, include the following:
- "section_title": String. The title of the document section from which the question and answer were derived. If the pair is from a section without a title, use "None" (without quotes) as the value.
- "summary": String. A concise summary of the content related to the question, limited to 20 words.
- "question": String. A unique question formulated based on the document's content.
- 'answer': String. Formulate the answer as a complete, grammatically correct sentence using the exact text from the document that answers the question.
- 'span': Tuple of 2 integers. The character span of the answer within the document.
- 'inverted': True|False. Default to False. Set to True if the question-answer pair was inverted by the assistant.
- 'related_topic': String. The topic most related to the specific/current question-answer pair
After generating each question-answer pair, attempt to create an inverted version by rephrasing the answer as a question. Evaluate the inverted pair for coherence and relevance; omit any pair that fails to meet these standards.",
"example": {
"question": "Where were Fuji apples developed?",
"answer": "Fuji apples were developed at the Tohoku Research Station in Fujisaki, Aomori prefecture, Japan.",
"span": (75, 113),
"inverted": True,
"related_topic": "Origin and History of Fuji Apples"
}
- **Step 3**: Export Json List of 'topics' in Step 1 and question answer pairs in Step 2 :
"example": {
"topics": ["Origin and History of Fuji Apples", ... "Flavor and Sugar Content of Fuji Apples"],
"qa_pairs: [
{
"question": "Where were Fuji apples developed?",
"answer": "Fuji apples were developed at the Tohoku Research Station in Fujisaki, Aomori prefecture, Japan.",
"span": (75, 113),
"inverted": True,
"related_topic": "Origin and History of Fuji Apples"
},
]
}
- **Step 4**: Cleanup and Optimization
- Remove any duplicate question answer pairs in the 'topics' and 'qa_pairs' nodes.
- Fix any grammatical and spelling errors in the 'question' and 'answer' nodes within the 'qa_pairs' node
- Ensure the final result is a well formatted JSON string
<Document>
<section_title>Intro</section_title>
Fuji apples, a delight among fruit lovers, epitomize the perfect balance of sweetness and crispness, making them a global favorite. Originating from Japan in the 1930s, these apples have a rich history and a significant impact from their cultural roots to global agriculture adaptation.
<section_title>Origin and Development</section_title>
Fuji apples were developed at the Tohoku Research Station in Fujisaki, Aomori prefecture, Japan, by crossing...
<section_title>Characteristics</section_title>
Fuji apples are known for their large size, round shape, predominantly red skin with a yellowish blush, and dense, sweet flesh. Their extraordinary crispness and longevity, allowing them to remain fresh for a long period when stored properly, set them apart, making them ideal for long-term consumption.<|eot_id|><|start_header_id|>assistant<|end_header_id|>
My role is to ensure the quality and relevance of all generated question-answer pairs after they have been generated. Here’s how I will support your efforts:
- **Accuracy and Format Compliance**: Iterating over the json list, I will check each question-answer pair for factual accuracy, relevance to the topic, and strict adherence to the JSON format specified.
- **Content Review**: I will remove any pairs that contain meaningless or nonsensical questions or answers.
- **Sentence Structuring**: All answers, including those in the inverted pairs, will be transformed into complete, grammatically correct sentences.
- **Refinement Suggestions**: I will provide suggestions to refine the questions and answers to achieve the highest standards of clarity and informativeness.
- **Relevant Topics**: I will ensure that the chosen relevant topic is the topic most relevant to each question and answer pairs. If it's no the most relevant, I will change the 'related_topic' to the most relevant topic in the 'topics' list.
This structured feedback process is designed to improve the quality of your submissions and deepen your understanding of pomology and historical fruit cultivation, with a strong emphasis on grammatical integrity.<|eot_id|>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment