Gemini 1.5 Flash response generates unnecessary line breaks

Thanks for the update.

Just a quick check that the fix isn’t uninformed hacks (like new stop token sequences that terminate the output (test passes)):


BTW: Function completion result by 1.5-Flash, the function being the excuse why tampering with my provided test string would be prohibited.

while "\n\n\n" in input_string:
    input_string = input_string.replace("\n\n\n", "\n\n")
return input_string

A redo with “interpret the docstring algorithm as literally as possible” gets it closer to:


Function completion by ChatGPT gpt-4o

previous_string = None
result_string = input_string

# Continue replacing until no more changes are detected
while previous_string != result_string:
    previous_string = result_string
    result_string = result_string.replace("\n\n\n", "\n\n")

return result_string