Skip to content

Commit

Permalink
feat(lib): add titleify lib script
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Aug 22, 2024
1 parent ecb8013 commit f1c41a3
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions lib/titleify.ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
version: 0.1.0
type: lib
description: |-
Summarize the content or a text file into a single sentence or headline that captures the essence of the document.
It takes a filepath as input and outputs a concise title that reflects the main theme or content.
eg, `Title: @titleify(document.md)`
tag:
- titleify
- title
- summarize
- extract
- prompt
- lib
input:
- content # The content to summarize
- file # The text file path if exists, it will load content from the file
- len: {type: "number"} # the optional max length of the title
output:
type: "string"
parameters:
max_tokens: 128
---
- $if: "this.file"
then:
$set:
content: "@file({{file}})"
- system: |-
Summarize the content provided by the user into some best titles that captures the essence of the document.
---
- $if: "this.content"
then:
- user: "{{content}}"
- assistant: "[[titles]]"
- ---
- user: "Titles:\n{{titles}}\nWhich title is the best title? Why?"
- assistant: "[[titleInfo]]"
- ---
- user: "{{titleInfo}}\nOutput the title only"
- assistant: "[[title]]"
else:
- assistant: "What's the content you want to titleify?"

0 comments on commit f1c41a3

Please sign in to comment.