File size: 2,522 Bytes
88c61d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82055e6
88c61d3
 
 
 
 
82055e6
88c61d3
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from .templates import InputOutputTemplate

direct_template_dict = {
    "assessment": InputOutputTemplate(
        input_format="""
You are presented with a response generated subject to a context.
The context includes information relevant to the nature or generation of the response.
You will assess the quality of the response subject to an evaluation criteria.
###Context:
{context_variables}
###Response:
{response}
###Evaluation criteria:
{criteria_description}
{display_options_instruction}
Briefly assess the quality of the response subject to the evaluation criteria.
Focus on the evaluation criteria during assessment, do not provide a general assessment.
Assessment: """
    ),
    "summarization": InputOutputTemplate(
        input_format="""Transform the following assessment into a concise summary that focuses on the key details, excluding references to the assessment itself.

Assessment: {assessment}
Summary:"""
    ),
    "answer": InputOutputTemplate(
        input_format="""Now consider the evaluation criteria and choose a final answer. Only include the chosen answer in the response.
###Evaluation criteria:
{criteria_description}
{score_option_instruction}
The selected answer is: """,
        postprocessors=["processors.match_closest_option"],
    ),
}


pairwise_template_dict = {
    "assessment": InputOutputTemplate(
        input_format="""You are provided a pair of responses (Response {option_a} and Response {option_b}) generated subject to a context.
You will choose the better quality response subject to the evaluation criteria.

This is the context:
{context_variables}
This is the evaluation criteria:
{criteria_name}
{criteria_description}
Response {option_a}:
{response_a}
Response {option_b}:
{response_b}

Keeping the evaluation criteria in mind, briefly assess which response is better.
Focus on the evaluation criteria during assessment, do not provide a general assessment.
Assessment: """
    ),
    "summarization": InputOutputTemplate(
        input_format="""Transform the following assessment into a concise summary that focuses on the key details, excluding references to the assessment itself. The summary must clearly state which response won.

Assessment: {assessment}
Summary:"""
    ),
    "answer": InputOutputTemplate(
        input_format="""Now considering the evaluation criteria, which response is better quality? Only include the chosen response.
{score_option_instruction}
Answer: """,
        postprocessors=["processors.match_closest_option"],
    ),
}