Skip to content

Commit

Permalink
fix bug: check before using the variables (jupyterlab#656)
Browse files Browse the repository at this point in the history
* fix bug: check before using the variables

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Marchlak committed Oct 28, 2024
1 parent d576ba8 commit 07d2b42
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def get_llm_chain(self):
lm_provider = self.config_manager.lm_provider
lm_provider_params = self.config_manager.lm_provider_params

if not lm_provider or not lm_provider_params:
return None

curr_lm_id = (
f'{self.llm.id}:{lm_provider_params["model_id"]}' if self.llm else None
)
Expand All @@ -39,9 +42,6 @@ def get_llm_chain(self):
else None
)

if not lm_provider or not lm_provider_params:
return None

if curr_lm_id != next_lm_id:
self.log.info(
f"Switching {self.handler_kind} language model from {curr_lm_id} to {next_lm_id}."
Expand Down

0 comments on commit 07d2b42

Please sign in to comment.