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 f825cf0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mind_palace/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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


def parse_abstracts(nodes) -> List[str]:
Expand Down Expand Up @@ -29,7 +30,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 +54,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 f825cf0

Please sign in to comment.