Skip to content

Commit 0ba8812

Browse files
authored
Fix system prompt concatenated with instruction in chat template (#830)
1 parent 936612c commit 0ba8812

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lighteval/tasks/prompt_manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ def get_examples( # noqa: C901
310310

311311
# System prompt and instruction
312312
if use_chat_template:
313-
if system_prompt is not None: # We add system prompt and instruction jointly if possible
314-
examples.insert(0, {"role": "system", "content": system_prompt + instruction})
315-
else: # Else we add the instruction to the first example
316-
examples[0]["content"] = instruction + examples[0]["content"]
313+
# We add the instruction to the first example
314+
examples[0]["content"] = instruction + examples[0]["content"]
315+
if system_prompt is not None: # We add system prompt if available
316+
examples.insert(0, {"role": "system", "content": system_prompt})
317317
return examples
318318
else:
319319
system_prompt = system_prompt if system_prompt is not None else ""

0 commit comments

Comments
 (0)