@@ -82,9 +82,9 @@ def evaluate_ifeval(client, prompt_template, num_samples, model):
8282
8383 try :
8484 formatted_prompt = prompt_template .format (instruction = instruction )
85- except KeyError :
86- # Handle prompts with different placeholder names
87- formatted_prompt = prompt_template . replace ( "{instruction}" , instruction )
85+ except KeyError as e :
86+ print ( f"Error: Prompt template missing placeholder: { e } " )
87+ return 0.0 , 0 , total , total
8888
8989 # Call LLM with retries
9090 output_text = None
@@ -163,8 +163,9 @@ def evaluate_hover(client, prompt_template, num_samples, model):
163163
164164 try :
165165 formatted_prompt = prompt_template .format (claim = claim )
166- except KeyError :
167- formatted_prompt = prompt_template .replace ("{claim}" , claim )
166+ except KeyError as e :
167+ print (f"Error: Prompt template missing placeholder: { e } " )
168+ return 0.0 , 0 , total , total
168169
169170 # Call LLM with retries
170171 output_text = None
@@ -258,10 +259,9 @@ def evaluate_hotpotqa(client, prompt_template, num_samples, model):
258259 formatted_prompt = prompt_template .format (
259260 context = context_str .strip (), question = question
260261 )
261- except KeyError :
262- # Try alternative formatting
263- formatted_prompt = prompt_template .replace ("{context}" , context_str .strip ())
264- formatted_prompt = formatted_prompt .replace ("{question}" , question )
262+ except KeyError as e :
263+ print (f"Error: Prompt template missing placeholders: { e } " )
264+ return 0.0 , 0 , total , total
265265
266266 # Call LLM with retries
267267 output_text = None
0 commit comments