Skip to content

Commit

Permalink
fix bug: check before using the variables (#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
ya0guang and pre-commit-ci[bot] authored Mar 5, 2024
1 parent 359eee2 commit 0ae649e
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 0ae649e

Please sign in to comment.