import json async def get_eval_score(sample): prompt = EVALUATION_PROMPT_TEMPLATE.format( additive_criteria=ADDITIVE_CRITERIA, evaluation_steps=EVALUATION_STEPS, json_schema=JSON_SCHEMA, examples=format_examples(few_shot_examples), question=sample["question"], context=sample["context"], answer=sample["answer"] ) # Comment in if you want to see the prompt # print(prompt) response = await client.chat.completions.create( model="meta-llama/Meta-Llama-3-70B-Instruct", messages=[{"role": "user", "content": prompt}], temperature=0, max_tokens=512, ) results = response.choices[0].message.content # Add the evaluation results to the sample return {**sample, **json.loads(results)}