toolkit-ads-gen / ai_tasks /text_summary.py
lgaleana's picture
Improve to v0
739e67a
raw
history blame
371 Bytes
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:
print_system("Summarizing text...")
instructions = PROMPT.format(text=text)
messages = [{"role": "user", "content": instructions}]
return llm.next(messages, temperature=0.4)