From 65308da233f2a52ed6d5555fed358ba5a6f567ac Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Tue, 3 Dec 2024 09:53:00 -0800 Subject: [PATCH] openai: dont populate logit_bias if None --- libs/partners/openai/langchain_openai/llms/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/partners/openai/langchain_openai/llms/base.py b/libs/partners/openai/langchain_openai/llms/base.py index dc5dd67099b08..b910f2e404dd8 100644 --- a/libs/partners/openai/langchain_openai/llms/base.py +++ b/libs/partners/openai/langchain_openai/llms/base.py @@ -205,11 +205,13 @@ def _default_params(self) -> Dict[str, Any]: "frequency_penalty": self.frequency_penalty, "presence_penalty": self.presence_penalty, "n": self.n, - "logit_bias": self.logit_bias, "seed": self.seed, "logprobs": self.logprobs, } + if self.logit_bias is not None: + normal_params["logit_bias"] = self.logit_bias + if self.max_tokens is not None: normal_params["max_tokens"] = self.max_tokens