I never understood how stop sequences work

See image below.

I put \n and \n\n as stop sequences but I still always get an output with these line breaks.

What am I missing exactly?

Does the first double line break count? Since the “official” output starts after it.
Sometimes I when I put line breaks as stop sequences, nothing comes out because of this.


Thanks! Hmm i see, good to know.

So having \n and \n\n stop sequences should NOT produce an empty output in API?

I did encounter this the last few days, so I had to remove these stop sequences.

1 Like

Thanks! So we need to check in our code. I think I’d rather just take in whatever the output and process it manually.

What do you mean by 1 or 2 be ok?

I do have output token limits of course, but many times the last sentence end abruptly halfway or the output keeps repeating (as in the above example), so i rather have a proper stop sequence if I can.

1 Like

The explanation is way simpler than that, based on what I have experienced.
\n simply doesn’t work in the playground. In order to have the stop sequence be a newline, click on the textbox and just press enter (return) key. That should work. It inserts the return key icon in there (a 90 degrees downward pointing arrow).



Yes, same for the generated code, but not the same when using. I have been bitten by this.

Nice, that you recognized me from the other thread. See you around!!

1 Like

Sure, go ahead. We can use the past 2 threads to seed the category. (This one and the CLI one).