Skip to content

Commit

Permalink
add some logging to welcome fns
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantisan committed Sep 28, 2023
1 parent 6533a84 commit e89ce63
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mind_palace/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

from docs import Section
from llama_index.llms import ChatMessage, OpenAI
from measure import time_function

from mind_palace.measure import time_function

Check failure on line 7 in mind_palace/welcome.py

View workflow job for this annotation

GitHub Actions / build (3.11)

Ruff (F811)

mind_palace/welcome.py:7:33: F811 Redefinition of unused `time_function` from line 5


def parse_abstracts(nodes) -> List[str]:
Expand Down Expand Up @@ -29,7 +32,9 @@ def _summarize_prompt(abstracts: List[str]):
}


@time_function
def summarize(gpt_model, texts: List[str]) -> str:
print(f"Summarizing {len(texts)} pieces of texts with {gpt_model} model.")
prompt = _summarize_prompt(texts)
messages = [
ChatMessage(role="system", content=prompt["system"]),
Expand All @@ -51,7 +56,11 @@ def _extract_keywords_output(message):
return [keyword.split(". ")[1] for keyword in keywords]


@time_function
def extract_keywords(gpt_model, texts: List[str]) -> List[str]:
print(
f"Extracting keywords from {len(texts)} pieces of texts with {gpt_model} model."
)
prompt = _extract_keywords_prompt(texts)
messages = [
ChatMessage(role="system", content=prompt["system"]),
Expand Down

0 comments on commit e89ce63

Please sign in to comment.