Ahmet Kaan Sever commited on
Commit
a43bda3
·
1 Parent(s): b561b82

F string fix for nli and complex_reasoning

Browse files
src/deepeval/complex_reasoning.py CHANGED
@@ -26,6 +26,8 @@ class ComplexReasoningTask(BaseTask):
26
 
27
  # Get values from row
28
  choices = ast.literal_eval(row["choices"]) # Convert string to list
 
 
29
  formatted_choices = "\n".join([f"{chr(65+i)}: {choice}" for i, choice in enumerate(choices)])
30
  correct_answer_letter = row["answer_choice"]
31
  correct_answers.append(correct_answer_letter)
@@ -37,7 +39,7 @@ class ComplexReasoningTask(BaseTask):
37
 
38
  # Construct the prompt/message
39
  instruction = ""
40
- prompt = f"Soru:\n{row["narrative"]}\n{row["question"]}\nSeçenekler:\n{formatted_choices}\n{instruction}\n"
41
  message = prompt
42
 
43
  # Get/format answer of the model
 
26
 
27
  # Get values from row
28
  choices = ast.literal_eval(row["choices"]) # Convert string to list
29
+ narrative = row["narrative"]
30
+ question = row["question"]
31
  formatted_choices = "\n".join([f"{chr(65+i)}: {choice}" for i, choice in enumerate(choices)])
32
  correct_answer_letter = row["answer_choice"]
33
  correct_answers.append(correct_answer_letter)
 
39
 
40
  # Construct the prompt/message
41
  instruction = ""
42
+ prompt = f"Soru:\n{narrative}\n{question}\nSeçenekler:\n{formatted_choices}\n{instruction}\n"
43
  message = prompt
44
 
45
  # Get/format answer of the model
src/deepeval/nli.py CHANGED
@@ -23,6 +23,9 @@ class NLITask(BaseTask):
23
  total_count += 1
24
 
25
  # Get values from row
 
 
 
26
  label = row["label"].lower().replace(' ','')
27
  choices=["entailment","contradiction","neutral"]
28
  formatted_choices = "\n".join([f"{chr(65+i)}: {choice}" for i, choice in enumerate(choices)])
@@ -40,8 +43,8 @@ class NLITask(BaseTask):
40
  # Construct the prompt/message
41
  instruction = ""
42
  question = "Yukarıdaki cümleler arasındaki ilişki “entailment” (bir cümle diğerini ima eder), “neutral (cümleler birbirini ima etmez ve çelişmez) veya “contradiction (cümleler birbirleriyle çelişir) olarak karakterize edilebilir. Bu ilişkilerden hangisi olduğunu söyleyin."
43
- context = f"Bağlam:\n{row["text"]}\n" # can add to prompt if needed
44
- prompt = f"Cümle1:\n{row["premise"]}\nCümle2:{row["hypothesis"]}\nSoru:\n{question}\nSeçenekler:\n{formatted_choices}\n{instruction}\n"
45
  message = prompt
46
 
47
  # Get/format answer of the model
 
23
  total_count += 1
24
 
25
  # Get values from row
26
+ text = row["text"]
27
+ premise = row["premise"]
28
+ hypothesis = row["hypothesis"]
29
  label = row["label"].lower().replace(' ','')
30
  choices=["entailment","contradiction","neutral"]
31
  formatted_choices = "\n".join([f"{chr(65+i)}: {choice}" for i, choice in enumerate(choices)])
 
43
  # Construct the prompt/message
44
  instruction = ""
45
  question = "Yukarıdaki cümleler arasındaki ilişki “entailment” (bir cümle diğerini ima eder), “neutral (cümleler birbirini ima etmez ve çelişmez) veya “contradiction (cümleler birbirleriyle çelişir) olarak karakterize edilebilir. Bu ilişkilerden hangisi olduğunu söyleyin."
46
+ context = f"Bağlam:\n{text}\n" # can add to prompt if needed
47
+ prompt = f"Cümle1:\n{premise}\nCümle2:{hypothesis}\nSoru:\n{question}\nSeçenekler:\n{formatted_choices}\n{instruction}\n"
48
  message = prompt
49
 
50
  # Get/format answer of the model