Skip to content

Commit

Permalink
fix crashes on start
Browse files Browse the repository at this point in the history
  • Loading branch information
latekvo committed Jul 25, 2024
1 parent 2e135b9 commit 1b44c62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/tools/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def load_functional_llm():
# EXPERIMENTAL
if llm_config is None:
errorlib.pretty_error(
title="Tried loading LLM without a valid configuration",
title="Tried loading functional LLM without a valid configuration",
advice=f"Your worker configuration file is likely missing "
f"a valid {Fore.CYAN}llm_config_name{Fore.RESET} variable",
)
Expand Down
10 changes: 6 additions & 4 deletions schedulers/deepsearcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@

# TODO: move all LLM load to summarizer, local for now

llm = load_llm()
llm = None
output_parser = StrOutputParser()

extraction_chain = structured_extraction_prompt() | llm | output_parser


def are_workers_free():
# todo: check if there are non-busy workers available
return True
Expand All @@ -54,6 +51,11 @@ def extract_interesting_topics(text: str) -> list[str]:
# fixme: instead of TODO, extracting a single topic as a POC for now
extraction_request = "Find exactly one topic from this text, it must be interesting. Reply in 3 words at most."

global llm
if llm is None:
llm = load_llm()
extraction_chain = structured_extraction_prompt() | llm | output_parser

result = extraction_chain.invoke({"data": text, "user_request": extraction_request})

return [result]
Expand Down

0 comments on commit 1b44c62

Please sign in to comment.