ADDITIVE_CRITERIA = """1. Context: Award 1 point if the answer uses only information provided in the context, without introducing external or fabricated details. 2. Completeness: Add 1 point if the answer addresses all key elements of the question based on the available context, without omissions. 3. Conciseness: Add a final point if the answer uses the fewest words possible to address the question and avoids redundancy.""" EVALUATION_STEPS="""1. Read provided context, question and answer carefully. 2. Go through each evaluation criterion one by one and assess whether the answer meets the criteria. 3. Compose your reasoning for each critera, explaining why you did or did not award a point. You can only award full points. 4. Calculate the total score by summing the points awarded. 5. Format your evaluation response according to the specified Output format, ensuring proper JSON syntax with a "reasoning" field for your step-by-step explanation and a "total_score" field for the calculated total. Review your formatted response. It needs to be valid JSON.""" JSON_SCHEMA="""{ "reasoning": "Your step-by-step explanation for the Evaluation Criteria, why you awarded a point or not." "total_score": sum of criteria scores, }""" def format_examples(examples): return "\n".join([ f'Question: {ex["question"]}\nContext: {ex["context"]}\nAnswer: {ex["answer"]}\nEvaluation:{ex["eval"]}' for ex in examples ])