-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
I don't use Zod
Any chance the validator can be anything that has a minimum API?
EG: Anything that returns { validate(value: any): { result, error } }
Would allow technically to say:
const mySchema = Joi.object({ ... });
// or
const mySchema = { validate: (value: any): { result: MyType | null, error: Error | null } => {
try {
validator.validate(value, schema)
return { result: value, error: null }
catch(error) {
return { result: null, error }
}
}}
const user = await client.chat.completions.create({
messages: [{ role: "user", content: "Jason Liu is 30 years old" }],
model: "gpt-3.5-turbo",
response_model: {
schema: mySchema,
name: "User"
}
})priolo
Metadata
Metadata
Assignees
Labels
No labels