genkit
genkit copied to clipboard
Adds generateText and generateOutput convenience methods.
This adds new generateText and generateOutput convenience methods that return like so:
const {text, response} = await generateText({prompt: "Tell me a joke"});
const {output, response} = await generateOutput({
prompt: "Create a creature",
output: {
schema: z.object({
name: z.string(),
hitPoints: z.number()
})
}
});
It's a small ergonomic change but it prevents needing to assign the response to a variable if you don't care about it.
If you like the idea we can talk about how we'd want to document it vs. other options.
@mbleigh I saw you added these things to the 0.6 release doc. Did you want to submit this PR?