palimpzest 0.8.2__py3-none-any.whl → 0.8.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- palimpzest/constants.py +38 -62
- palimpzest/core/data/iter_dataset.py +5 -5
- palimpzest/core/elements/groupbysig.py +1 -1
- palimpzest/core/elements/records.py +91 -109
- palimpzest/core/lib/schemas.py +23 -0
- palimpzest/core/models.py +3 -3
- palimpzest/prompts/__init__.py +2 -6
- palimpzest/prompts/convert_prompts.py +10 -66
- palimpzest/prompts/critique_and_refine_prompts.py +66 -0
- palimpzest/prompts/filter_prompts.py +8 -46
- palimpzest/prompts/join_prompts.py +12 -75
- palimpzest/prompts/{moa_aggregator_convert_prompts.py → moa_aggregator_prompts.py} +51 -2
- palimpzest/prompts/moa_proposer_prompts.py +87 -0
- palimpzest/prompts/prompt_factory.py +351 -479
- palimpzest/prompts/split_merge_prompts.py +51 -2
- palimpzest/prompts/split_proposer_prompts.py +48 -16
- palimpzest/prompts/utils.py +109 -0
- palimpzest/query/execution/all_sample_execution_strategy.py +1 -1
- palimpzest/query/execution/execution_strategy.py +4 -4
- palimpzest/query/execution/mab_execution_strategy.py +1 -2
- palimpzest/query/execution/parallel_execution_strategy.py +3 -3
- palimpzest/query/execution/single_threaded_execution_strategy.py +8 -8
- palimpzest/query/generators/generators.py +31 -17
- palimpzest/query/operators/__init__.py +15 -2
- palimpzest/query/operators/aggregate.py +21 -19
- palimpzest/query/operators/compute.py +6 -8
- palimpzest/query/operators/convert.py +12 -37
- palimpzest/query/operators/critique_and_refine.py +194 -0
- palimpzest/query/operators/distinct.py +7 -7
- palimpzest/query/operators/filter.py +13 -25
- palimpzest/query/operators/join.py +321 -192
- palimpzest/query/operators/limit.py +4 -4
- palimpzest/query/operators/mixture_of_agents.py +246 -0
- palimpzest/query/operators/physical.py +25 -2
- palimpzest/query/operators/project.py +4 -4
- palimpzest/query/operators/{rag_convert.py → rag.py} +202 -5
- palimpzest/query/operators/retrieve.py +10 -9
- palimpzest/query/operators/scan.py +9 -10
- palimpzest/query/operators/search.py +18 -24
- palimpzest/query/operators/split.py +321 -0
- palimpzest/query/optimizer/__init__.py +12 -8
- palimpzest/query/optimizer/optimizer.py +12 -10
- palimpzest/query/optimizer/rules.py +201 -108
- palimpzest/query/optimizer/tasks.py +18 -6
- palimpzest/validator/validator.py +7 -9
- {palimpzest-0.8.2.dist-info → palimpzest-0.8.4.dist-info}/METADATA +3 -8
- palimpzest-0.8.4.dist-info/RECORD +95 -0
- palimpzest/prompts/critique_and_refine_convert_prompts.py +0 -216
- palimpzest/prompts/moa_proposer_convert_prompts.py +0 -75
- palimpzest/prompts/util_phrases.py +0 -19
- palimpzest/query/operators/critique_and_refine_convert.py +0 -113
- palimpzest/query/operators/mixture_of_agents_convert.py +0 -140
- palimpzest/query/operators/split_convert.py +0 -170
- palimpzest-0.8.2.dist-info/RECORD +0 -95
- {palimpzest-0.8.2.dist-info → palimpzest-0.8.4.dist-info}/WHEEL +0 -0
- {palimpzest-0.8.2.dist-info → palimpzest-0.8.4.dist-info}/licenses/LICENSE +0 -0
- {palimpzest-0.8.2.dist-info → palimpzest-0.8.4.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""This file contains prompts for convert operations."""
|
|
2
2
|
|
|
3
3
|
### BASE PROMPTS ###
|
|
4
|
-
|
|
4
|
+
MAP_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
5
5
|
You will be presented with a context and a set of output fields to generate. Your task is to generate a JSON object which fills in the output fields with the correct values.
|
|
6
6
|
You will be provided with a description of each input field and each output field. All of the fields in the output JSON object can be derived using information from the context.
|
|
7
7
|
|
|
@@ -16,18 +16,18 @@ OUTPUT FIELDS:
|
|
|
16
16
|
{example_output_fields}
|
|
17
17
|
|
|
18
18
|
CONTEXT:
|
|
19
|
-
{example_context}{image_disclaimer}{audio_disclaimer}
|
|
19
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
20
20
|
|
|
21
21
|
Let's think step-by-step in order to answer the question.
|
|
22
22
|
|
|
23
23
|
REASONING: {example_reasoning}
|
|
24
24
|
|
|
25
25
|
ANSWER:
|
|
26
|
-
{example_answer}
|
|
26
|
+
{{{example_answer}}}
|
|
27
27
|
---
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
MAP_NO_REASONING_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
31
31
|
You will be presented with a context and a set of output fields to generate. Your task is to generate a JSON object which fills in the output fields with the correct values.
|
|
32
32
|
You will be provided with a description of each input field and each output field. All of the fields in the output JSON object can be derived using information from the context.
|
|
33
33
|
|
|
@@ -42,15 +42,15 @@ OUTPUT FIELDS:
|
|
|
42
42
|
{example_output_fields}
|
|
43
43
|
|
|
44
44
|
CONTEXT:
|
|
45
|
-
{example_context}{image_disclaimer}{audio_disclaimer}
|
|
45
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
46
46
|
|
|
47
47
|
ANSWER:
|
|
48
|
-
{example_answer}
|
|
48
|
+
{{{example_answer}}}
|
|
49
49
|
---
|
|
50
50
|
"""
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
MAP_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
54
54
|
You will be presented with a context and a set of output fields to generate. Your task is to generate a JSON object which fills in the output fields with the correct values.
|
|
55
55
|
You will be provided with a description of each input field and each output field. All of the fields in the output JSON object can be derived using information from the context.
|
|
56
56
|
{desc_section}
|
|
@@ -63,13 +63,13 @@ OUTPUT FIELDS:
|
|
|
63
63
|
{output_fields_desc}
|
|
64
64
|
|
|
65
65
|
CONTEXT:
|
|
66
|
-
{context}<<image-
|
|
66
|
+
{context}<<image-audio-placeholder>>
|
|
67
67
|
|
|
68
68
|
Let's think step-by-step in order to answer the question.
|
|
69
69
|
|
|
70
70
|
REASONING: """
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
MAP_NO_REASONING_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
73
73
|
You will be presented with a context and a set of output fields to generate. Your task is to generate a JSON object which fills in the output fields with the correct values.
|
|
74
74
|
You will be provided with a description of each input field and each output field. All of the fields in the output JSON object can be derived using information from the context.
|
|
75
75
|
{desc_section}
|
|
@@ -82,62 +82,6 @@ OUTPUT FIELDS:
|
|
|
82
82
|
{output_fields_desc}
|
|
83
83
|
|
|
84
84
|
CONTEXT:
|
|
85
|
-
{context}<<image-
|
|
85
|
+
{context}<<image-audio-placeholder>>
|
|
86
86
|
|
|
87
87
|
ANSWER: """
|
|
88
|
-
|
|
89
|
-
### TEMPLATE INPUTS ###
|
|
90
|
-
COT_QA_JOB_INSTRUCTION = """generate a JSON object"""
|
|
91
|
-
COT_QA_IMAGE_JOB_INSTRUCTION = """analyze input image(s) and/or text in order to produce a JSON object"""
|
|
92
|
-
COT_QA_AUDIO_JOB_INSTRUCTION = """analyze input audio and/or text in order to produce a JSON object"""
|
|
93
|
-
|
|
94
|
-
COT_QA_EXAMPLE_INPUT_FIELDS = """- text: a text passage describing a scientist
|
|
95
|
-
- birthday: the scientist's birthday"""
|
|
96
|
-
COT_QA_IMAGE_EXAMPLE_INPUT_FIELDS = """- image: an image of a scene
|
|
97
|
-
- photographer: the photographer of the image"""
|
|
98
|
-
COT_QA_AUDIO_EXAMPLE_INPUT_FIELDS = """- recording: an audio recording of a newscast
|
|
99
|
-
- speaker: the name of the speaker in the recording"""
|
|
100
|
-
|
|
101
|
-
COT_QA_EXAMPLE_OUTPUT_FIELDS = """- name: the name of the scientist
|
|
102
|
-
- birth_year: the year the scientist was born"""
|
|
103
|
-
COT_QA_IMAGE_EXAMPLE_OUTPUT_FIELDS = """- dog_in_image: true if a dog is in the image and false otherwise
|
|
104
|
-
- person_in_image: true if a person is in the image and false otherwise"""
|
|
105
|
-
COT_QA_AUDIO_EXAMPLE_OUTPUT_FIELDS = """- main_topic: the main topic discussed in the newscast
|
|
106
|
-
- language: the language spoken in the newscast"""
|
|
107
|
-
|
|
108
|
-
COT_QA_EXAMPLE_CONTEXT = """{{
|
|
109
|
-
"text": "Augusta Ada King, Countess of Lovelace, also known as Ada Lovelace, was an English mathematician and writer chiefly known for her work on Charles Babbage's proposed mechanical general-purpose computer, the Analytical Engine. She was the first to recognise that the machine had applications beyond pure calculation.",
|
|
110
|
-
"birthday": "December 10, 1815"
|
|
111
|
-
}}"""
|
|
112
|
-
COT_QA_IMAGE_EXAMPLE_CONTEXT = """{{
|
|
113
|
-
"image": <bytes>,
|
|
114
|
-
"photographer": "CameraEnthusiast1"
|
|
115
|
-
}}"""
|
|
116
|
-
COT_QA_AUDIO_EXAMPLE_CONTEXT = """{{
|
|
117
|
-
"recording": <bytes>,
|
|
118
|
-
"speaker": "Walter Cronkite"
|
|
119
|
-
}}"""
|
|
120
|
-
|
|
121
|
-
COT_QA_IMAGE_DISCLAIMER = """
|
|
122
|
-
\n<image content provided here; assume in this example the image shows a dog and a cat playing>
|
|
123
|
-
"""
|
|
124
|
-
COT_QA_AUDIO_DISCLAIMER = """
|
|
125
|
-
\n<audio content provided here; assume in this example the recording is about the Cuban Missile Crisis and spoken in English>
|
|
126
|
-
"""
|
|
127
|
-
|
|
128
|
-
COT_QA_EXAMPLE_REASONING = """the text passage mentions the scientist's name as "Augusta Ada King, Countess of Lovelace, also known as Ada Lovelace" and the scientist's birthday as "December 10, 1815". Therefore, the name of the scientist is "Augusta Ada King" and the birth year is 1815."""
|
|
129
|
-
COT_QA_IMAGE_EXAMPLE_REASONING = """The image shows a dog playing with a cat, so there is a dog in the image. There is no person in the image."""
|
|
130
|
-
COT_QA_AUDIO_EXAMPLE_REASONING = """The recording discusses the Cuban Missile Crisis, which is the main topic. The language spoken in the recording is English."""
|
|
131
|
-
|
|
132
|
-
COT_QA_EXAMPLE_ANSWER = """{{
|
|
133
|
-
"name": "Augusta Ada King",
|
|
134
|
-
"birth_year": 1815
|
|
135
|
-
}}"""
|
|
136
|
-
COT_QA_IMAGE_EXAMPLE_ANSWER = """{{
|
|
137
|
-
"dog_in_image": true,
|
|
138
|
-
"person_in_image": false
|
|
139
|
-
}}"""
|
|
140
|
-
COT_QA_AUDIO_EXAMPLE_ANSWER = """{{
|
|
141
|
-
"main_topic": "Cuban Missile Crisis",
|
|
142
|
-
"language": "English"
|
|
143
|
-
}}"""
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""This file contains prompts for CritiqueAndRefineConvert operations."""
|
|
2
|
+
|
|
3
|
+
### CRITIQUE PROMPT AND CRITERIA ###
|
|
4
|
+
BASE_CRITIQUE_PROMPT = """You are a helpful assistant tasked with critiquing the output of a model based on a given prompt.
|
|
5
|
+
Below is the original user prompt used to generate the output:
|
|
6
|
+
|
|
7
|
+
ORIGINAL PROMPT:
|
|
8
|
+
<<original-prompt-placeholder>>
|
|
9
|
+
|
|
10
|
+
Here is the output generated by the model:
|
|
11
|
+
|
|
12
|
+
OUTPUT:
|
|
13
|
+
{original_output}
|
|
14
|
+
|
|
15
|
+
Your task is to critique the output based on the following:
|
|
16
|
+
{critique_criteria}
|
|
17
|
+
|
|
18
|
+
{finish_instruction}
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
MAP_CRITIQUE_CRITERIA = """1. Does the JSON object adhere to the required format? Highlight any structural issues.
|
|
22
|
+
2. Are the values of the output fields accurate based on the provided context? If any fields are incorrect or missing, provide specific examples.
|
|
23
|
+
3. Are there any logical errors in reasoning used to derive the output? Provide detailed feedback on potential mistakes.
|
|
24
|
+
"""
|
|
25
|
+
FILTER_CRITIQUE_CRITERIA = """1. Does the output adhere to the required TRUE/FALSE format? Highlight any issues.
|
|
26
|
+
2. Is the TRUE/FALSE determination accurate based on the provided context? If there is evidence for an incorrect determination, provide specific reasons why.
|
|
27
|
+
3. Are there any logical errors in reasoning used to derive the TRUE/FALSE determination? Provide detailed feedback on potential mistakes.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
MAP_CRITIQUE_FINISH_INSTRUCTION = """Finish your critique with actionable recommendations for improving the JSON object."""
|
|
31
|
+
FILTER_CRITIQUE_FINISH_INSTRUCTION = """Finish your critique with actionable recommendations for improving the model's reasoning and answer."""
|
|
32
|
+
|
|
33
|
+
### REFINEMENT PROMPT AND CRITERIA ###
|
|
34
|
+
BASE_REFINEMENT_PROMPT = """You are a helpful assistant tasked with refining the output of a model based on a critique.
|
|
35
|
+
Below is the original user prompt used to generate the output:
|
|
36
|
+
|
|
37
|
+
ORIGINAL PROMPT:
|
|
38
|
+
<<original-prompt-placeholder>>
|
|
39
|
+
|
|
40
|
+
Here is the original output generated by the model:
|
|
41
|
+
|
|
42
|
+
OUTPUT:
|
|
43
|
+
{original_output}
|
|
44
|
+
|
|
45
|
+
Here is the critique of the output:
|
|
46
|
+
|
|
47
|
+
CRITIQUE:
|
|
48
|
+
{critique_output}
|
|
49
|
+
|
|
50
|
+
Your task is to refine the original output to address the critique. Ensure that:
|
|
51
|
+
{refinement_criteria}
|
|
52
|
+
|
|
53
|
+
{finish_instruction}
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
MAP_REFINEMENT_CRITERIA = """1. The answer adheres to the required JSON format specified in the original prompt.
|
|
57
|
+
2. Correctly derives all values for the output fields based on the provided context.
|
|
58
|
+
3. Resolves any logical errors identified in the critique.
|
|
59
|
+
"""
|
|
60
|
+
FILTER_REFINEMENT_CRITERIA = """1. The answer adheres to the required TRUE/FALSE format specified in the original prompt.
|
|
61
|
+
2. Correctly derives the final TRUE/FALSE determination based on the provided context.
|
|
62
|
+
3. Resolves any logical errors identified in the critique.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
MAP_REFINEMENT_FINISH_INSTRUCTION = """Return the refined JSON object as your final answer."""
|
|
66
|
+
FILTER_REFINEMENT_FINISH_INSTRUCTION = """Return the final TRUE/FALSE answer."""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""This file contains prompts for filter operations."""
|
|
2
2
|
|
|
3
3
|
### BASE PROMPTS ###
|
|
4
|
-
|
|
4
|
+
FILTER_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
5
5
|
You will be presented with a context and a filter condition. Output TRUE if the context satisfies the filter condition, and FALSE otherwise.
|
|
6
6
|
|
|
7
7
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -12,7 +12,7 @@ INPUT FIELDS:
|
|
|
12
12
|
{example_input_fields}
|
|
13
13
|
|
|
14
14
|
CONTEXT:
|
|
15
|
-
{example_context}{image_disclaimer}{audio_disclaimer}
|
|
15
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
16
16
|
|
|
17
17
|
FILTER CONDITION: {example_filter_condition}
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ ANSWER: TRUE
|
|
|
24
24
|
---
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
FILTER_NO_REASONING_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
28
28
|
You will be presented with a context and a filter condition. Output TRUE if the context satisfies the filter condition, and FALSE otherwise.
|
|
29
29
|
|
|
30
30
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -35,7 +35,7 @@ INPUT FIELDS:
|
|
|
35
35
|
{example_input_fields}
|
|
36
36
|
|
|
37
37
|
CONTEXT:
|
|
38
|
-
{example_context}{image_disclaimer}{audio_disclaimer}
|
|
38
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
39
39
|
|
|
40
40
|
FILTER CONDITION: {example_filter_condition}
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ ANSWER: TRUE
|
|
|
43
43
|
---
|
|
44
44
|
"""
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
FILTER_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
47
47
|
You will be presented with a context and a filter condition. Output TRUE if the context satisfies the filter condition, and FALSE otherwise.
|
|
48
48
|
{desc_section}
|
|
49
49
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -52,7 +52,7 @@ INPUT FIELDS:
|
|
|
52
52
|
{input_fields_desc}
|
|
53
53
|
|
|
54
54
|
CONTEXT:
|
|
55
|
-
{context}<<image-
|
|
55
|
+
{context}<<image-audio-placeholder>>
|
|
56
56
|
|
|
57
57
|
FILTER CONDITION: {filter_condition}
|
|
58
58
|
|
|
@@ -60,7 +60,7 @@ Let's think step-by-step in order to answer the question.
|
|
|
60
60
|
|
|
61
61
|
REASONING: """
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
FILTER_NO_REASONING_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
64
64
|
You will be presented with a context and a filter condition. Output TRUE if the context satisfies the filter condition, and FALSE otherwise.
|
|
65
65
|
{desc_section}
|
|
66
66
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -69,46 +69,8 @@ INPUT FIELDS:
|
|
|
69
69
|
{input_fields_desc}
|
|
70
70
|
|
|
71
71
|
CONTEXT:
|
|
72
|
-
{context}<<image-
|
|
72
|
+
{context}<<image-audio-placeholder>>
|
|
73
73
|
|
|
74
74
|
FILTER CONDITION: {filter_condition}
|
|
75
75
|
|
|
76
76
|
ANSWER: """
|
|
77
|
-
|
|
78
|
-
### TEMPLATE INPUTS ###
|
|
79
|
-
COT_BOOL_JOB_INSTRUCTION = """answer a TRUE / FALSE question"""
|
|
80
|
-
COT_BOOL_IMAGE_JOB_INSTRUCTION = """analyze input image(s) and/or text in order to answer a TRUE / FALSE question"""
|
|
81
|
-
COT_BOOL_AUDIO_JOB_INSTRUCTION = """analyze input audio and/or text in order to answer a TRUE / FALSE question"""
|
|
82
|
-
|
|
83
|
-
COT_BOOL_EXAMPLE_INPUT_FIELDS = """- text: a short passage of text"""
|
|
84
|
-
COT_BOOL_IMAGE_EXAMPLE_INPUT_FIELDS = """- image: an image of a scene
|
|
85
|
-
- photographer: the photographer of the image"""
|
|
86
|
-
COT_BOOL_AUDIO_EXAMPLE_INPUT_FIELDS = """- recording: an audio recording of a newscast
|
|
87
|
-
- speaker: the name of the speaker in the recording"""
|
|
88
|
-
|
|
89
|
-
COT_BOOL_EXAMPLE_CONTEXT = """{{
|
|
90
|
-
"text": "The quick brown fox jumps over the lazy dog."
|
|
91
|
-
}}"""
|
|
92
|
-
COT_BOOL_IMAGE_EXAMPLE_CONTEXT = """{{
|
|
93
|
-
"image": <bytes>,
|
|
94
|
-
"photographer": "CameraEnthusiast1"
|
|
95
|
-
}}"""
|
|
96
|
-
COT_BOOL_AUDIO_EXAMPLE_CONTEXT = """{{
|
|
97
|
-
"recording": <bytes>,
|
|
98
|
-
"speaker": "Walter Cronkite"
|
|
99
|
-
}}"""
|
|
100
|
-
|
|
101
|
-
COT_BOOL_EXAMPLE_FILTER_CONDITION = "the text mentions an animal"
|
|
102
|
-
COT_BOOL_IMAGE_EXAMPLE_FILTER_CONDITION = "there's an animal in this image"
|
|
103
|
-
COT_BOOL_AUDIO_EXAMPLE_FILTER_CONDITION = "the newscast discusses a flashpoint in the Cold War"
|
|
104
|
-
|
|
105
|
-
COT_BOOL_IMAGE_DISCLAIMER = """
|
|
106
|
-
\n<image content provided here; assume in this example the image shows a dog and a cat playing>
|
|
107
|
-
"""
|
|
108
|
-
COT_BOOL_AUDIO_DISCLAIMER = """
|
|
109
|
-
\n<audio content provided here; assume in this example the recording is about the Cuban Missile Crisis>
|
|
110
|
-
"""
|
|
111
|
-
|
|
112
|
-
COT_BOOL_EXAMPLE_REASONING = """the text mentions the words "fox" and "dog" which are animals, therefore the answer is TRUE."""
|
|
113
|
-
COT_BOOL_IMAGE_EXAMPLE_REASONING = """the image shows a dog and a cat playing, both of which are animals, therefore the answer is TRUE."""
|
|
114
|
-
COT_BOOL_AUDIO_EXAMPLE_REASONING = """the newscast discusses the Cuban Missile Crisis, which was a flashpoint in the Cold War, therefore the answer is TRUE."""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""This file contains prompts for join operations."""
|
|
2
2
|
|
|
3
3
|
### BASE PROMPTS ###
|
|
4
|
-
|
|
4
|
+
JOIN_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
5
5
|
You will be presented with two data records and a join condition. Output TRUE if the two data records satisfy the join condition, and FALSE otherwise.
|
|
6
6
|
|
|
7
7
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -12,13 +12,13 @@ LEFT INPUT FIELDS:
|
|
|
12
12
|
{example_input_fields}
|
|
13
13
|
|
|
14
14
|
LEFT CONTEXT:
|
|
15
|
-
{example_context}{image_disclaimer}{audio_disclaimer}
|
|
15
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
16
16
|
|
|
17
17
|
RIGHT INPUT FIELDS:
|
|
18
18
|
{right_example_input_fields}
|
|
19
19
|
|
|
20
20
|
RIGHT CONTEXT:
|
|
21
|
-
{right_example_context}{right_image_disclaimer}{right_audio_disclaimer}
|
|
21
|
+
{{{right_example_context}}}{right_image_disclaimer}{right_audio_disclaimer}
|
|
22
22
|
|
|
23
23
|
JOIN CONDITION: {example_join_condition}
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ ANSWER: TRUE
|
|
|
30
30
|
---
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
JOIN_NO_REASONING_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
34
34
|
You will be presented with two data records and a join condition. Output TRUE if the two data records satisfy the join condition, and FALSE otherwise.
|
|
35
35
|
|
|
36
36
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -41,13 +41,13 @@ LEFT INPUT FIELDS:
|
|
|
41
41
|
{example_input_fields}
|
|
42
42
|
|
|
43
43
|
LEFT CONTEXT:
|
|
44
|
-
{example_context}{image_disclaimer}{audio_disclaimer}
|
|
44
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
45
45
|
|
|
46
46
|
RIGHT INPUT FIELDS:
|
|
47
47
|
{right_example_input_fields}
|
|
48
48
|
|
|
49
49
|
RIGHT CONTEXT:
|
|
50
|
-
{right_example_context}{right_image_disclaimer}{right_audio_disclaimer}
|
|
50
|
+
{{{right_example_context}}}{right_image_disclaimer}{right_audio_disclaimer}
|
|
51
51
|
|
|
52
52
|
JOIN CONDITION: {example_join_condition}
|
|
53
53
|
|
|
@@ -55,7 +55,7 @@ ANSWER: TRUE
|
|
|
55
55
|
---
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
JOIN_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
59
59
|
You will be presented with two data records and a join condition. Output TRUE if the two data records satisfy the join condition, and FALSE otherwise.
|
|
60
60
|
{desc_section}
|
|
61
61
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -64,13 +64,13 @@ LEFT INPUT FIELDS:
|
|
|
64
64
|
{input_fields_desc}
|
|
65
65
|
|
|
66
66
|
LEFT CONTEXT:
|
|
67
|
-
{context}<<image-
|
|
67
|
+
{context}<<image-audio-placeholder>>
|
|
68
68
|
|
|
69
69
|
RIGHT INPUT FIELDS:
|
|
70
70
|
{right_input_fields_desc}
|
|
71
71
|
|
|
72
72
|
RIGHT CONTEXT:
|
|
73
|
-
{right_context}<<image-
|
|
73
|
+
{right_context}<<right-image-audio-placeholder>>
|
|
74
74
|
|
|
75
75
|
JOIN CONDITION: {join_condition}
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ Let's think step-by-step in order to evaluate the join condition.
|
|
|
78
78
|
|
|
79
79
|
REASONING: """
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
JOIN_NO_REASONING_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
82
82
|
You will be presented with two data records and a join condition. Output TRUE if the two data records satisfy the join condition, and FALSE otherwise.
|
|
83
83
|
{desc_section}
|
|
84
84
|
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
@@ -87,77 +87,14 @@ LEFT INPUT FIELDS:
|
|
|
87
87
|
{input_fields_desc}
|
|
88
88
|
|
|
89
89
|
LEFT CONTEXT:
|
|
90
|
-
{context}<<image-
|
|
90
|
+
{context}<<image-audio-placeholder>>
|
|
91
91
|
|
|
92
92
|
RIGHT INPUT FIELDS:
|
|
93
93
|
{right_input_fields_desc}
|
|
94
94
|
|
|
95
95
|
RIGHT CONTEXT:
|
|
96
|
-
{right_context}<<image-
|
|
96
|
+
{right_context}<<right-image-audio-placeholder>>
|
|
97
97
|
|
|
98
98
|
JOIN CONDITION: {join_condition}
|
|
99
99
|
|
|
100
100
|
ANSWER: """
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### TEMPLATE INPUTS ###
|
|
104
|
-
COT_JOIN_JOB_INSTRUCTION = """determine whether two data records satisfy a join condition"""
|
|
105
|
-
COT_JOIN_IMAGE_JOB_INSTRUCTION = """analyze input image(s) and/or text in order to determine whether two data records satisfy a join condition"""
|
|
106
|
-
COT_JOIN_AUDIO_JOB_INSTRUCTION = """analyze input audio and/or text in order to determine whether two data records satisfy a join condition"""
|
|
107
|
-
|
|
108
|
-
COT_JOIN_EXAMPLE_INPUT_FIELDS = """- text: a short passage of text"""
|
|
109
|
-
COT_JOIN_IMAGE_EXAMPLE_INPUT_FIELDS = """- image: an image of a scene
|
|
110
|
-
- photographer: the photographer of the image"""
|
|
111
|
-
COT_JOIN_AUDIO_EXAMPLE_INPUT_FIELDS = """- recording: an audio recording of a newscast
|
|
112
|
-
- speaker: the name of the speaker in the recording"""
|
|
113
|
-
|
|
114
|
-
COT_JOIN_RIGHT_EXAMPLE_INPUT_FIELDS = """- contents: the contents of a text file"""
|
|
115
|
-
COT_JOIN_IMAGE_RIGHT_EXAMPLE_INPUT_FIELDS = """- image: an image of a scene
|
|
116
|
-
- photographer: the photographer of the image"""
|
|
117
|
-
COT_JOIN_AUDIO_RIGHT_EXAMPLE_INPUT_FIELDS = """- recording: an audio recording of a newscast
|
|
118
|
-
- speaker: the name of the speaker in the recording"""
|
|
119
|
-
|
|
120
|
-
COT_JOIN_EXAMPLE_CONTEXT = """{{
|
|
121
|
-
"text": "The quick brown fox jumps over the lazy dog."
|
|
122
|
-
}}"""
|
|
123
|
-
COT_JOIN_IMAGE_EXAMPLE_CONTEXT = """{{
|
|
124
|
-
"image": <bytes>,
|
|
125
|
-
"photographer": "CameraEnthusiast1"
|
|
126
|
-
}}"""
|
|
127
|
-
COT_JOIN_AUDIO_EXAMPLE_CONTEXT = """{{
|
|
128
|
-
"recording": <bytes>,
|
|
129
|
-
"speaker": "Walter Cronkite"
|
|
130
|
-
}}"""
|
|
131
|
-
|
|
132
|
-
COT_JOIN_RIGHT_EXAMPLE_CONTEXT = """{{
|
|
133
|
-
"contents": "Foxes are wild animals which primarily hunt small mammals like rabbits and rodents."
|
|
134
|
-
}}"""
|
|
135
|
-
COT_JOIN_IMAGE_RIGHT_EXAMPLE_CONTEXT = """{{
|
|
136
|
-
"image": <bytes>,
|
|
137
|
-
"filename": "img123.png"
|
|
138
|
-
}}"""
|
|
139
|
-
COT_JOIN_AUDIO_RIGHT_EXAMPLE_CONTEXT = """{{
|
|
140
|
-
"recording": <bytes>,
|
|
141
|
-
"speaker": "Barbara Walters"
|
|
142
|
-
}}"""
|
|
143
|
-
|
|
144
|
-
COT_JOIN_EXAMPLE_JOIN_CONDITION = "each record mentions the same animal"
|
|
145
|
-
COT_JOIN_IMAGE_EXAMPLE_JOIN_CONDITION = "the images are of the same subject"
|
|
146
|
-
COT_JOIN_AUDIO_EXAMPLE_JOIN_CONDITION = "the recordings are about the same subject"
|
|
147
|
-
|
|
148
|
-
COT_JOIN_IMAGE_DISCLAIMER = """
|
|
149
|
-
\n<image content provided here; assume in this example the image shows a horse in a field>
|
|
150
|
-
"""
|
|
151
|
-
COT_JOIN_AUDIO_DISCLAIMER = """
|
|
152
|
-
\n<audio content provided here; assume in this example the recording is about the Cuban Missile Crisis>
|
|
153
|
-
"""
|
|
154
|
-
COT_JOIN_RIGHT_IMAGE_DISCLAIMER = """
|
|
155
|
-
\n<image content provided here; assume in this example the image shows a horse in its stable>
|
|
156
|
-
"""
|
|
157
|
-
COT_JOIN_RIGHT_AUDIO_DISCLAIMER = """
|
|
158
|
-
\n<audio content provided here; assume in this example the recording is from a telecast about the Cuban Missile Crisis's historical significance>
|
|
159
|
-
"""
|
|
160
|
-
|
|
161
|
-
COT_JOIN_EXAMPLE_REASONING = """both passages mention a fox, which is the same animal, therefore the answer is TRUE."""
|
|
162
|
-
COT_JOIN_IMAGE_EXAMPLE_REASONING = """both images show a horse, which appears to be the main subject of each image, therefore the answer is TRUE."""
|
|
163
|
-
COT_JOIN_AUDIO_EXAMPLE_REASONING = """both recordings discuss the Cuban Missile Crisis, which is the same subject, therefore the answer is TRUE."""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""This file contains prompts for Mixture-of-Agents aggregator operations."""
|
|
2
2
|
|
|
3
3
|
### SYSTEM PROMPTS ###
|
|
4
|
-
|
|
4
|
+
MAP_MOA_AGG_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to generate a JSON object.
|
|
5
5
|
You will be presented with one or more outputs produced by a set of models. Your task is to synthesize these responses into a single, high-quality JSON object which fills in the output fields with the correct values.
|
|
6
6
|
It is crucial to critically evaluate the information provided in these responses, recognizing that some of it may be biased or incorrect.
|
|
7
7
|
|
|
@@ -35,8 +35,38 @@ ANSWER:
|
|
|
35
35
|
---
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
+
FILTER_MOA_AGG_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to answer a TRUE/FALSE question.
|
|
39
|
+
You will be presented with one or more outputs produced by a set of models. Your task is to synthesize these responses into a single TRUE/FALSE answer.
|
|
40
|
+
It is crucial to critically evaluate the information provided in these responses, recognizing that some of it may be biased or incorrect.
|
|
41
|
+
|
|
42
|
+
You will also be provided with a description of each input field and the filter condition.
|
|
43
|
+
|
|
44
|
+
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
45
|
+
|
|
46
|
+
An example is shown below:
|
|
47
|
+
---
|
|
48
|
+
MODEL RESPONSE 1: The context describes Augusta Ada King, Countess of Lovelace, also known as Ada Lovelace, who is widely recognized as a foundational figure in computer science. Therefore, the answer is TRUE.
|
|
49
|
+
|
|
50
|
+
MODEL RESPONSE 2: Based on the context provided, Ada Lovelace is indeed a foundational computer scientist, therefore the answer is TRUE.
|
|
51
|
+
|
|
52
|
+
INPUT FIELDS:
|
|
53
|
+
- text: a text passage describing a scientist
|
|
54
|
+
- birthday: the scientist's birthday
|
|
55
|
+
- image: an image of the scientist
|
|
56
|
+
- recording: an audio recording of a newscast about the scientist's contributions to their field
|
|
57
|
+
|
|
58
|
+
FILTER CONDITION: The subject of the input is a foundational computer scientist.
|
|
59
|
+
|
|
60
|
+
Let's think step-by-step in order to answer the question.
|
|
61
|
+
|
|
62
|
+
REASONING: Both model responses agree that the context describes Ada Lovelace, who is widely recognized as a foundational figure in computer science. The evidence from the text passage supports this conclusion.
|
|
63
|
+
|
|
64
|
+
ANSWER: TRUE
|
|
65
|
+
---
|
|
66
|
+
"""
|
|
67
|
+
|
|
38
68
|
### USER / INSTANCE-SPECIFIC PROMPTS ###
|
|
39
|
-
|
|
69
|
+
MAP_MOA_AGG_BASE_USER_PROMPT = """You are a helpful assistant whose job is to generate a JSON object.
|
|
40
70
|
You will be presented with one or more outputs produced by a set of models. Your task is to synthesize these responses into a single, high-quality JSON object which fills in the output fields with the correct values.
|
|
41
71
|
It is crucial to critically evaluate the information provided in these responses, recognizing that some of it may be biased or incorrect.
|
|
42
72
|
|
|
@@ -55,3 +85,22 @@ OUTPUT FIELDS:
|
|
|
55
85
|
Let's think step-by-step in order to answer the question.
|
|
56
86
|
|
|
57
87
|
REASONING: """
|
|
88
|
+
|
|
89
|
+
FILTER_MOA_AGG_BASE_USER_PROMPT = """You are a helpful assistant whose job is to answer a TRUE/FALSE question.
|
|
90
|
+
You will be presented with one or more outputs produced by a set of models. Your task is to synthesize these responses into a single TRUE/FALSE answer.
|
|
91
|
+
It is crucial to critically evaluate the information provided in these responses, recognizing that some of it may be biased or incorrect.
|
|
92
|
+
|
|
93
|
+
You will also be provided with a description of each input field and the filter condition.
|
|
94
|
+
|
|
95
|
+
Remember, your answer must be TRUE or FALSE. Finish your response with a newline character followed by ---
|
|
96
|
+
---
|
|
97
|
+
{model_responses}
|
|
98
|
+
|
|
99
|
+
INPUT FIELDS:
|
|
100
|
+
{input_fields_desc}
|
|
101
|
+
|
|
102
|
+
FILTER CONDITION: {filter_condition}
|
|
103
|
+
|
|
104
|
+
Let's think step-by-step in order to answer the question.
|
|
105
|
+
|
|
106
|
+
REASONING: """
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""This file contains prompts for MixtureOfAgentsConvert operations."""
|
|
2
|
+
|
|
3
|
+
### SYSTEM PROMPTS ###
|
|
4
|
+
MAP_MOA_PROPOSER_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
5
|
+
You will be presented with a context and a set of output fields to generate. Your task is to generate a detailed and succinct analysis describing what you believe is the correct value for each output field.
|
|
6
|
+
Be sure to cite information from the context as evidence of why your answers are correct. Do not hallucinate evidence.
|
|
7
|
+
|
|
8
|
+
You will be provided with a description of each input field and each output field.
|
|
9
|
+
|
|
10
|
+
An example is shown below:
|
|
11
|
+
---
|
|
12
|
+
INPUT FIELDS:
|
|
13
|
+
{example_input_fields}
|
|
14
|
+
|
|
15
|
+
OUTPUT FIELDS:
|
|
16
|
+
{example_output_fields}
|
|
17
|
+
|
|
18
|
+
CONTEXT:
|
|
19
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
20
|
+
|
|
21
|
+
Let's think step-by-step in order to answer the question.
|
|
22
|
+
|
|
23
|
+
ANSWER: {example_answer}
|
|
24
|
+
---
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
FILTER_MOA_PROPOSER_BASE_SYSTEM_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
28
|
+
You will be presented with a context and a filter condition. Your task is to generate a detailed and succinct analysis describing whether you believe the input satisfies the filter condition.
|
|
29
|
+
Be sure to cite information from the context as evidence of why your determination is correct. Do not hallucinate evidence.
|
|
30
|
+
|
|
31
|
+
You will be provided with a description of each input field.
|
|
32
|
+
|
|
33
|
+
An example is shown below:
|
|
34
|
+
---
|
|
35
|
+
INPUT FIELDS:
|
|
36
|
+
{example_input_fields}
|
|
37
|
+
|
|
38
|
+
CONTEXT:
|
|
39
|
+
{{{example_context}}}{image_disclaimer}{audio_disclaimer}
|
|
40
|
+
|
|
41
|
+
FILTER CONDITION: {example_filter_condition}
|
|
42
|
+
|
|
43
|
+
Let's think step-by-step in order to answer the question.
|
|
44
|
+
|
|
45
|
+
ANSWER: {example_answer}
|
|
46
|
+
---
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
### USER / INSTANCE-SPECIFIC PROMPTS ###
|
|
50
|
+
MAP_MOA_PROPOSER_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
51
|
+
You will be presented with a context and a set of output fields to generate. Your task is to generate a detailed and succinct analysis describing what you believe is the correct value for each output field.
|
|
52
|
+
Be sure to cite information from the context as evidence of why your answers are correct. Do not hallucinate evidence.
|
|
53
|
+
{desc_section}
|
|
54
|
+
You will be provided with a description of each input field and each output field.
|
|
55
|
+
---
|
|
56
|
+
INPUT FIELDS:
|
|
57
|
+
{input_fields_desc}
|
|
58
|
+
|
|
59
|
+
OUTPUT FIELDS:
|
|
60
|
+
{output_fields_desc}
|
|
61
|
+
|
|
62
|
+
CONTEXT:
|
|
63
|
+
{context}<<image-audio-placeholder>>
|
|
64
|
+
|
|
65
|
+
Let's think step-by-step in order to answer the question.
|
|
66
|
+
|
|
67
|
+
ANSWER: """
|
|
68
|
+
|
|
69
|
+
FILTER_MOA_PROPOSER_BASE_USER_PROMPT = """You are a helpful assistant whose job is to {job_instruction}.
|
|
70
|
+
You will be presented with a context and a filter condition. Your task is to generate a detailed and succinct analysis describing whether you believe the input satisfies the filter condition.
|
|
71
|
+
Be sure to cite information from the context as evidence of why your determination is correct. Do not hallucinate evidence.
|
|
72
|
+
{desc_section}
|
|
73
|
+
You will be provided with a description of each input field.
|
|
74
|
+
|
|
75
|
+
An example is shown below:
|
|
76
|
+
---
|
|
77
|
+
INPUT FIELDS:
|
|
78
|
+
{input_fields_desc}
|
|
79
|
+
|
|
80
|
+
CONTEXT:
|
|
81
|
+
{context}<<image-audio-placeholder>>
|
|
82
|
+
|
|
83
|
+
FILTER CONDITION: {filter_condition}
|
|
84
|
+
|
|
85
|
+
Let's think step-by-step in order to answer the question.
|
|
86
|
+
|
|
87
|
+
ANSWER: """
|