mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
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.
This commit is contained in:
parent
f5aa767ef1
commit
83e871f1ff
@ -242,10 +242,15 @@ class BaseOpenAI(BaseLLM):
|
|||||||
"frequency_penalty": self.frequency_penalty,
|
"frequency_penalty": self.frequency_penalty,
|
||||||
"presence_penalty": self.presence_penalty,
|
"presence_penalty": self.presence_penalty,
|
||||||
"n": self.n,
|
"n": self.n,
|
||||||
"best_of": self.best_of,
|
|
||||||
"request_timeout": self.request_timeout,
|
"request_timeout": self.request_timeout,
|
||||||
"logit_bias": self.logit_bias,
|
"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}
|
return {**normal_params, **self.model_kwargs}
|
||||||
|
|
||||||
def _generate(
|
def _generate(
|
||||||
|
Loading…
Reference in New Issue
Block a user