Improve error message for stop word > 4 sequences


I never knew why more than 4 stop words would fail with a strange message

Error: “[’\\n###\\n’, ‘###’, ‘\\n’, ’ ### ', ‘[[’, ‘—’] is not valid under any of the given schemas - ‘stop’”

I’d suggest something like “Up to 4 sequences are allowed as stop word argument”
As it is clearly written here:


Very good point.
I had the same error thrown and had to try several use cases before figuring out that there was a length limit to the list of stops.

It could also be mentioned in the “best practices” of the guide. OpenAI API