Overview
Wasn't able to find this clearly stated on the internet. Here's how you use the zod.function() system in a JavaScript class.
I work for Akkio, where I'm building out a no-code predictive AI platform. If you're looking to harness the power of AI without needing a data scientist, give us a try!
The Working Solution
class ClassName {
request = z
.function()
.args(
z.string(),
z.object({
temperature: z.number().default(0),
model: z.nativeEnum(MODELS).default(MODELS.STANDARD),
schema: z.instanceof(ZodSchema),
})
)
.returns(z.promise(z.string()))
.implement(async (prompt, options) => {
// ...
})
Enjoy!
Top comments (0)