From 3d00f938be0d52f707fe8a31ee48eec5a7cb7c56 Mon Sep 17 00:00:00 2001 From: "Efkan S. Goktepe" <76130958+serhatgktp@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:13:19 -0400 Subject: [PATCH] Remove redundant `hasattr` check Signed-off-by: serhatgktp --- nemoguardrails/llm/params.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nemoguardrails/llm/params.py b/nemoguardrails/llm/params.py index 83717407c..27de824ce 100644 --- a/nemoguardrails/llm/params.py +++ b/nemoguardrails/llm/params.py @@ -41,9 +41,7 @@ def __enter__(self): if hasattr(self.llm, param): self.original_params[param] = getattr(self.llm, param) setattr(self.llm, param, value) - elif hasattr(self.llm, "model_kwargs") and param in getattr( - self.llm, "model_kwargs", {} - ): + elif param in getattr(self.llm, "model_kwargs", {}): self.original_params[param] = self.llm.model_kwargs[param] self.llm.model_kwargs[param] = value else: