In my code, I wanted to add the possibility to use the vision version. When I use gpt4 it works fine, but when I use vision version. I get this error:
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: ‘1 validation error for Request\nbody → stop\n none is not an allowed value (type=type_error.none.not_allowed)’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}
Here is a snippet of my code:
if "vision" in self.config.model_name:
messages = [
{
"role": "user",
"content": [
{
"type":"text",
"text":prompt
}
]
}
]
else:
messages = [{"role": "user", "content": prompt}]
chat_completion = self.openai.chat.completions.create(
model=self.config["model_name"], # Choose the engine according to your OpenAI plan
messages=messages,
max_tokens=n_predict, # Adjust the desired length of the generated response
n=1, # Specify the number of responses you want
stop=None, # Define a stop sequence if needed
temperature=gpt_params["temperature"], # Adjust the temperature for more or less randomness in the output
stream=True)