Skip to content

Commit 4d2929a

Browse files
author
stephanie gross
committed
WIP
1 parent c9c539a commit 4d2929a

File tree

1 file changed

+49
-4
lines changed

1 file changed

+49
-4
lines changed

ragability/ragability_cc_wc1.py

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
fact="Fact ${n}: ${fact}\n",
3030
user="${query}",
3131
),
32+
dict(
33+
pid="q_two_contexts_hints",
34+
system="Read the following facts between '====START' and '====END' and then answer the question which comes after these facts, only providing the facts and not mentioning that you extracted them from the text. Be aware that the context might be contradictory. If you find a contradiction, do not try to answer the question but report the contradictory phrases: \n====START\n${facts}\n====END",
35+
fact="Fact ${n}: ${fact}\n",
36+
user="${query}",
37+
),
3238
dict(
3339
pid="ci_one_context",
3440
user="Read the following facts between '====START' and '====END' and decide if there is any contradiction present. Answer 'yes' if there is a contraction, answer 'no' if there is no contracdition, do not add anything else to your answer: \n====START\n${facts}\n====END",
@@ -41,7 +47,7 @@
4147
),
4248
dict(
4349
pid="check_response_answerable",
44-
system="You are to analyse the response after 'RESPONSE:' and answer 'yes' if the response refuses to give a concrete answer and instead points out that an answer is not possible. You are to answer no if the response includes, even just as a possibility, a concrete answer. Answer only with 'yes' or 'no', do not include additional explanations or information.",
50+
system="You are to analyse the response after 'RESPONSE:'. Answer 'yes' if the response refuses to give a concrete answer and instead points out that an answer is not possible, or if two contradictory facts are presented in parallel without deciding which one is true. You are to answer 'no' if the response includes, even just as a possibility, a concrete answer. A 'yes' or a 'no' after 'RESPONSE:' would already be a concrete answer. Answer only with 'yes' or 'no', do not include additional explanations or information.",
4551
user="RESPONSE: ${answer}",
4652
),
4753
dict(
@@ -119,7 +125,7 @@ def row2raga_ctx2(row):
119125
def row2raga_ctx12q(row):
120126
out = dict(
121127
qid=row["contradiction_ID"] + "-" + "ctx12q" + VAR,
122-
tags="kind_2contexts, kind_2contexts_q, kind_context1+2, kind_context1+2_q, not_answerable",
128+
tags="kind_2contexts, kind_2contexts_q, kind_context1+2, kind_context1+2_q, kind_2contexts_q-h, not_answerable",
123129
facts=[row["context_1"], row["context_2"]],
124130
query=row["query_text"],
125131
pids=["q_two_contexts"],
@@ -138,7 +144,7 @@ def row2raga_ctx12q(row):
138144
def row2raga_ctx21q(row):
139145
out = dict(
140146
qid=row["contradiction_ID"] + "-" + "ctx21q" + VAR,
141-
tags="kind_2contexts, kind_2contexts_q, kind_context2+1, kind_context2+1_q, not_answerable",
147+
tags="kind_2contexts, kind_2contexts_q, kind_context2+1, kind_context2+1_q, kind_2contexts_q-h, not_answerable",
142148
facts=[row["context_1"], row["context_2"]],
143149
query=row["query_text"],
144150
pids=["q_two_contexts"],
@@ -154,6 +160,44 @@ def row2raga_ctx21q(row):
154160
)
155161
return out
156162

163+
def row2raga_ctx12qh(row):
164+
out = dict(
165+
qid=row["contradiction_ID"] + "-" + "ctx12qh" + VAR,
166+
tags="kind_2contexts, kind_2contexts_q, kind_context1+2, kind_context1+2_q, kind_2contexts_q+h, not_answerable",
167+
facts=[row["context_1"], row["context_2"]],
168+
query=row["query_text"],
169+
pids=["q_two_contexts_hints"],
170+
checks=[
171+
dict(
172+
cid="2ctx_not_answerable",
173+
query="",
174+
func="affirmative",
175+
metrics=["correct_answer_all", "refusal_not_answerable"],
176+
pid="check_response_answerable",
177+
),
178+
],
179+
)
180+
return out
181+
182+
def row2raga_ctx21qh(row):
183+
out = dict(
184+
qid=row["contradiction_ID"] + "-" + "ctx21qh" + VAR,
185+
tags="kind_2contexts, kind_2contexts_q, kind_context2+1, kind_context2+1_q, kind_2contexts_q+h, not_answerable",
186+
facts=[row["context_1"], row["context_2"]],
187+
query=row["query_text"],
188+
pids=["q_two_contexts_hints"],
189+
checks=[
190+
dict(
191+
cid="2ctx_not_answerable",
192+
query="",
193+
func="affirmative",
194+
metrics=["correct_answer_all", "refusal_not_answerable"],
195+
pid="check_response_answerable",
196+
),
197+
],
198+
)
199+
return out
200+
157201

158202
def row2raga_ctx1ic(row):
159203
out = dict(
@@ -179,7 +223,7 @@ def row2raga_ctx2ic(row):
179223
tags="kind_1context, kind_1context_ic, kind_context2, kind_context2_ic, answerable",
180224
facts=row["context_2"],
181225
query="",
182-
pids=["ci_two_contexts"],
226+
pids=["ci_one_context"],
183227
checks=[
184228
dict(
185229
cid="answer_correct",
@@ -231,6 +275,7 @@ def row2raga_ctx21ic(row):
231275
row2raga_nc,
232276
row2raga_ctx1, row2raga_ctx2,
233277
row2raga_ctx12q, row2raga_ctx21q,
278+
row2raga_ctx12qh, row2raga_ctx21qh,
234279
row2raga_ctx1ic, row2raga_ctx2ic,
235280
row2raga_ctx12ic, row2raga_ctx21ic]
236281

0 commit comments

Comments
 (0)