Skip to content

Commit

Permalink
feat: 🎨 add poem generation script and file output
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Oct 15, 2024
1 parent b98083f commit 6f3f351
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ export async function runScript(
}
}

logInfo(`genaiscript: ${result.status}`)
if (result.status === "success") logInfo(`genaiscript: ${result.status}`)
else logError(`genaiscript: ${result.status}`)
stats.log()
if (outTraceFilename) logVerbose(` trace: ${outTraceFilename}`)

Expand Down
6 changes: 6 additions & 0 deletions packages/sample/genaisrc/deffileoutput.genai.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
script({
tests: {},
})
$`Generate a poem and save it in a file poems/<title>.txt`

defFileOutput("poems/*.txt")
19 changes: 19 additions & 0 deletions packages/sample/poems/Whispers_of_the_Wind.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Whispers of the wind in the twilight hour,
Dancing leaves and blooming flower.
Soft murmurs through the ancient trees,
Nature's serenade, a gentle breeze.

Stars awaken in the night sky,
Glimmering softly, they catch the eye.
Moonlight weaves a silver thread,
Across the earth, where dreams are spread.

Silent echoes of the night,
Crickets sing in pure delight.
A symphony of peace and grace,
In the quiet, nature's embrace.

Morning dew on petals bright,
Glistening in the dawning light.
A new day begins, with hopes anew,
In the heart of nature, pure and true.

0 comments on commit 6f3f351

Please sign in to comment.