continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
19.71k stars 1.73k forks source link

Autocomplete fails with openai gpt-4o model "Invalid 'stop': array too long. #2461

Open tandav opened 1 month ago

tandav commented 1 month ago

Relevant environment info

"tabAutocompleteModel": {
    "model": "gpt-4o-mini",
    "title": "gpt-4o-mini",
    "provider": "openai",
    "maxStopWords": 20,
    "apiBase": "https://openai-proxy.example.com/v1",
    "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  },

Description

this is reopen of this issue

To reproduce

No response

Log output

HTTP 400 Bad Request from https://openai-proxy.example.com/v1/chat/completions {
"error": {
 "message": "Invalid 'stop': array too long. Expected an array with maximum length 4, but got an array with length 9 instead.", 
"type": "invalid_request_error", 
"param": "stop", 
"code": "array_above_max_length" } }
cgweddle commented 1 month ago

Autocomplete with Bedrock also fails due to the same issue, the API can only take a maximum of 4 stop sequences. An issue for that is open here: #2296

Patrick-Erichsen commented 1 month ago

Thanks for the reference at @cgweddle , this seems to be an issue for a handful of providers. Added this to our list of autocomplete bugfixes to tackle in the near future 👍