Source
yaml
id: ai-book-summary-perplexity
namespace: company.team
inputs:
- id: book
type: STRING
displayName: What book did you read recently?
defaults: The Hunger Games by Suzanne Collins
- id: chapter
type: INT
displayName: What chapter did you just finish?
tasks:
- id: get_chapter_summary
type: io.kestra.plugin.perplexity.ChatCompletion
messages:
- type: SYSTEM
content: "You will summarise book chapters in a clear and consise way. Use a mix
of paragraphs and bullet points."
- type: USER
content: "I am currently reading {{ inputs.book }} and just finished chapter {{
inputs.chapter }}. Please summarise it for me to make sure I followed
along correctly."
- id: convert_to_html
type: io.kestra.plugin.perplexity.ChatCompletion
messages:
- type: SYSTEM
content: "Convert the book summary into a nicely formatted HTML email. Do not
wrap the HTML in markdown. It does not need an introduction, subject
or a signature. Also link the search resources at the bottom with
bullet points. Use a separate header called Resources to separate the
search resources."
- type: USER
content: "{{ outputs.get_chapter_summary.rawResponse }}"
- id: send_summary
type: io.kestra.plugin.notifications.mail.MailSend
from: wrussell@kestra.io
to: wrussell@kestra.io
username: "{{ kv('G_EMAIL') }}"
password: "{{ kv('G_APP_PASSWORD') }}"
host: smtp.gmail.com
port: 465
subject: "Book Summary - {{ inputs.book }}: Chapter {{ inputs.chapter }}"
htmlTextContent: "{{ outputs.convert_to_html.outputText }}"
pluginDefaults:
- forced: false
type: io.kestra.plugin.perplexity.ChatCompletion
values:
apiKey: "{{ kv('PERPLEXITY_API_KEY') }}"
model: sonar
temperature: 0.7
About this blueprint
Notifications AI
This flow leverages the Perplexity AI plugin to create summaries for a specific chapter of a book. It uses a two-step AI process:
- Summary Generation: The first task requests a summary based on the
book
andchapter
inputs. Perplexity'ssonar
model, being search-grounded, ensures the summary is highly factual and detailed. - HTML Formatting: The second task takes the plain text summary and uses another Perplexity prompt to convert it into a well-formatted HTML snippet, ready for email delivery.
The final task sends the summary via SMTP using your configured email credentials.
Configuration:
- Provide a key-value pair for the Perplexity API key (
PERPLEXITY_API_KEY
) - Configure email credentials (
G_EMAIL
,G_APP_PASSWORD
) for SMTP delivery (using Gmail in this example) - The book title and chapter number are passed as flow inputs.
This flow can be adapted to summarize articles, meeting transcripts, or any text-based content before converting it to an optimized format for distribution via email, Slack, or other channels.
More Related Blueprints