Fix Invalid Request using AzureOpenAI (#3522)

This fixes the error when calling AzureOpenAI of gpt-35-turbo model.

The error is:
InvalidRequestError: logprobs, best_of and echo parameters are not
available on gpt-35-turbo model. Please remove the parameter and try
again. For more details, see
https://go.microsoft.com/fwlink/?linkid=2227346.
fix_agent_callbacks
Howard Su 1 year ago committed by GitHub
parent f5aa767ef1
commit 83e871f1ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -242,10 +242,15 @@ class BaseOpenAI(BaseLLM):
"frequency_penalty": self.frequency_penalty,
"presence_penalty": self.presence_penalty,
"n": self.n,
"best_of": self.best_of,
"request_timeout": self.request_timeout,
"logit_bias": self.logit_bias,
}
# Azure gpt-35-turbo doesn't support best_of
# don't specify best_of if it is 1
if self.best_of > 1:
normal_params["best_of"] = self.best_of
return {**normal_params, **self.model_kwargs}
def _generate(

Loading…
Cancel
Save