openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

newline char(`\n`) in stop param leads to 500 error in gpt-3.5-turbo

Open wonkyuml opened this issue 2 years ago • 4 comments

Describe the bug

unlike text-davinci-003 model, gpt-3.5-turbo model fails when using stop='\n'. maybe it would be backend problem but it would be good to have front-end translates '\n' into some form that backend server can deal with.

To Reproduce

with openai(0.27.1) package running this line of code would result in 500 error.

Code snippets

completion = openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages=[{"role": "user", "content":"hello"}], 
  stop=['\n']
)


### OS

Ubuntu 18.04

### Python version

Python3.7.15

### Library version

v0.27.1

wonkyuml avatar Mar 09 '23 03:03 wonkyuml

Verified this locally, passed onto the team to investigate.

logankilpatrick avatar Mar 13 '23 16:03 logankilpatrick

Any updates on this?

mrsegev avatar Mar 17 '23 20:03 mrsegev

Give this a try: completion = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[{"role": "user", "content":"hello"}], stop=[r"\n"] )

https://community.openai.com/t/stop-n-in-gpt-3-5-turbo-leads-to-500-error/87815/12 This worked for me.

TotzkePaul avatar Mar 18 '23 02:03 TotzkePaul

stop=[r"\n"] does not result in 500 error but it does not stop model generating multiple-lines of text.

wonkyuml avatar Mar 18 '23 05:03 wonkyuml

This was fixed a week or so ago, apologies for the issue. Please reopen if you see this again!

athyuttamre avatar Mar 29 '23 23:03 athyuttamre