File size: 452 Bytes
1bc7525
 
 
 
 
 
 
 
 
 
 
 
 
28e7d81
 
 
 
1bc7525
28e7d81
1bc7525
a46217d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from ai import llm
from utils.io import print_system


PROMPT = """
Here is the text from a website:
{text}

What is this website about?
"""


def summarize_text(text: str) -> str:
    return _summarize_text(PROMPT, text=text)


def _summarize_text(prompt: str, **kwargs) -> str:
    print_system("Summarizing text...")
    instructions = prompt.format(**kwargs)
    messages = [{"role": "user", "content": instructions}]
    return llm.next(messages)