[api] Passing n=None with the openai client breaks the service
Created by: tbmihailov
What
Passing n=None with the openai client breaks the service. This can be fixed by adding the same default values if the params are None. See OpenAI api defaults https://beta.openai.com/docs/api-reference/completions/create
See request and error in the log:
INFO - message='Request to OpenAI API' method=post path=http://52.190.63.124:6011/engines/opt/completions
DEBUG - api_version=None data='{"prompt": "The man drank heavily at the party sothe toilet filled with water.", "max_tokens": 0, "temperature": 0, "logprobs": 1, "echo": true, "stop": null, "n": null}' message='Post details'
DEBUG - http://52.190.63.124:6011/ "POST /engines/opt/completions HTTP/1.1" 500 708
INFO - message='OpenAI API response' path=http://52.190.63.124:6011/engines/opt/completions processing_ms=None response_code=500
INFO - error_code=None error_message="int() argument must be a string, a bytes-like object or a number, not 'NoneType'" error_param=None error_type=oops message='OpenAI API error received' stream_error=False
API error: int() argument must be a string, a bytes-like object or a number, not 'NoneType', retrying