-
-
Notifications
You must be signed in to change notification settings - Fork 171
Open
Description
Thanks for the awesome work, the API works great 👏🏻
Is is possible to get structured outputs to work?
The following fails schema validation.
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { z } from 'zod';
import { generateObject } from 'ai';
const provider = createOpenAICompatible({
name: "geminiLocal",
apiKey: "",
baseURL: 'http://0.0.0.0:8787/v1/,
includeUsage: true,
});
async function main() {
const batchSchema = z.object({
capital: z.string()
});
const { object, usage } = await generateObject({
model: provider('gemini-2.5-pro'),
schema: batchSchema,
prompt:"what is the capital of france? return answer according to JSON schema.",
});
console.log('object', object);
}
main();Metadata
Metadata
Assignees
Labels
No labels