Skip to content

Commit

Permalink
Add tweetify script for generating social media posts (#673)
Browse files Browse the repository at this point in the history
* Add tweetify script for generating social media posts and its npm script entry

* update trace info

* updated
  • Loading branch information
pelikhan authored Aug 29, 2024
1 parent 657cc65 commit 309bf58
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"genai:blog-post": "node packages/cli/built/genaiscript.cjs run blog-generator",
"genai:readme": "node packages/cli/built/genaiscript.cjs run readme-updater",
"genai:blogify": "node packages/cli/built/genaiscript.cjs run blogify-sample --no-cache",
"genai:tweetify": "node packages/cli/built/genaiscript.cjs run tweetify --no-cache",
"gcm": "node packages/cli/built/genaiscript.cjs run gcm"
},
"release-it": {
Expand All @@ -79,4 +80,4 @@
"glob": "^11.0.0",
"zx": "^8.1.4"
}
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { resolveTokenEncoder } from "../../core/src/encoders"
import { writeFile } from "fs/promises"

async function setupTraceWriting(trace: MarkdownTrace, filename: string) {
logVerbose(`writing trace to ${filename}`)
logVerbose(`trace: ${filename}`)
await ensureDir(dirname(filename))
await writeFile(filename, "", { encoding: "utf-8" })
trace.addEventListener(
Expand Down
38 changes: 38 additions & 0 deletions packages/sample/genaisrc/tweetify.genai.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
script({
model: "openai:gpt-4",
title: "tweetify",
tools: ["fs", "md"],
description: "Generates a tweet about a documentation page",
})

def("DOC", env.files)

$`
## Persona
You are an expert at the GenAIScript project and also a social media expert.
## Task
Generate social media announcements for the documentation page or blog post in DOC.
- generate a Twitter/X post
- generate a LinkedIn post
## Instructions
- make sure to adjust the tone for each social platform
- add link to the documentation page
- use emojis
- add hashtags, all lowercase
- don't be excited
- don't announce blog posts, mention content
## Information
- the documentation is in markdown and has frontmatter: docs/src/content/docs/**/*.md*
- the documentation routing is docs/src/content/docs/**/<route>.md* becomes https://microsoft.github.io/genaiscript/<route>.
- the genaiscript type definition: genaiscript/genaiscript.d.ts. Assume that all globals are ambient. Do not import or require genaiscript module.
- the genaiscript samples: packages/sample/src/*.genai.*
`

0 comments on commit 309bf58

Please sign in to comment.