Skip to content

Commit

Permalink
show output in run prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed May 29, 2024
1 parent 1a3d2ae commit 1ace0b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/core/src/runpromptcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ export function createRunPromptContext(
completer,
genOptions
)
const { json, text } = resp
if (resp.json)
trace.detailsFenced("📩 json (parsed)", json, "json")
else if (text)
trace.detailsFenced(`🔠 output`, text, `markdown`)
return resp
} catch (e) {
trace.error(e)
Expand Down
9 changes: 6 additions & 3 deletions packages/sample/genaisrc/console.genai.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ script({
tests: {},
})

console.log("log")
console.warn(`warn`)
console.error(`error`)

await runPrompt((_) => {
_.console.log("prompt.log")
_.console.warn("prompt.warn")
_.console.error("prompt.error")
_.$`write a movie title`
}, { label: "inner prompt"})

console.log("log")
console.warn(`warn`)
console.error(`error`)
console.log(`after run prompt`)

$`write a poem`

0 comments on commit 1ace0b9

Please sign in to comment.