Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
Hialus committed Sep 26, 2023
1 parent a54b90e commit 08ffb9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def get_instance(cls):
return cls.instance
# Local import needed to avoid circular dependency
from app.llms.strategy_llm import StrategyLLM

cls.instance = StrategyLLM(cls.llms)
return cls.instance

Expand Down Expand Up @@ -89,5 +90,7 @@ def get_settings(cls):


settings = Settings.get_settings()

# Init instance, so it is faster during requests
for value in enumerate(settings.pyris.llms.values()):
value[1].get_instance()
10 changes: 5 additions & 5 deletions app/llms/strategy_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ def set_correct_session(
selected_llm = None

for llm_key in self.llm.llm_keys:
if (llm_key not in exclude_llms
if (
llm_key not in exclude_llms
and cache_store.get(llm_key + ":status") != "OPEN"
and self.llm.llm_configs[llm_key].spec.context_length
>= self.get_total_context_length(prompt,
llm_key,
max_tokens)):
>= self.get_total_context_length(prompt, llm_key, max_tokens)
):
selected_llm = llm_key
break

Expand All @@ -122,7 +122,7 @@ def set_correct_session(
llm_configs,
key=lambda llm_key: llm_configs[llm_key].spec.context_length,
)

log.info("Selected LLM: " + selected_llm)

self.current_session_key = selected_llm
Expand Down

0 comments on commit 08ffb9b

Please sign in to comment.