We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I updated to "@ai-sdk/google": "^0.0.43", and now I get error. It seems like this SDK tries to use feature that is not supported as stated in issues here: google-gemini/generative-ai-js#200 google/generative-ai-docs#210
"@ai-sdk/google": "^0.0.43",
Edit: Seems like this is broken with OpenAI "@ai-sdk/openai": "^0.0.51", as well. But only when structuredOutputs is true.
"@ai-sdk/openai": "^0.0.51",
structuredOutputs
model: openai('gpt-4o-mini', { structuredOutputs: true }),
Invalid JSON payload received. Unknown name \\"minItems\\" at 'generation_config.response_schema.properties[1].value.items.properties[1].value': Cannot find field.\\nInvalid JSON payload received. Unknown name \\"minItems\\" at 'generation_config.response_schema.properties[1].value': Cannot find field.",\n
'use server' import { generateObject } from 'ai' import { google } from '@ai-sdk/google' import { z } from 'zod' const getQuizSchema = (amountQuestions: number, amountAnswers: number) => { const answerSchema = z.object({ text: z.string(), isCorrect: z.boolean(), }) const taskSchema = z.object({ question: z.string(), answers: z.array(answerSchema).length(amountAnswers), }) const quizSchema = z.object({ chapterName: z.string(), tasks: z.array(taskSchema).length(amountQuestions), }) return quizSchema } export async function generateQuiz( content: string, { outputLang = 'English', amountQuestions = 5, amountAnswers = 4, allowMultiple = false, }: { outputLang?: string; amountQuestions?: number; amountAnswers?: number; allowMultiple?: boolean }, ) { const schema = getQuizSchema(amountQuestions, amountAnswers) const { object } = await generateObject({ model: google('models/gemini-1.5-flash-latest'), schema: schema, system: trim` ... `, prompt: trim` ... `, }) return object }
Broken in both tool and json modes.
tool
json
Broken when structuredOutputs is true.
true
The text was updated successfully, but these errors were encountered:
The provider JSON specs don't fully support the OpenAPI 3.0 spec (Google) or, as it seems, JSON Schema 7 (OpenAI) fully.
In the OpenAI case, just disable structured outputs.
In the Google case, I'm working on a workaround: #2743
Sorry, something went wrong.
No branches or pull requests
Description
I updated to
"@ai-sdk/google": "^0.0.43",
and now I get error. It seems like this SDK tries to use feature that is not supported as stated in issues here:google-gemini/generative-ai-js#200
google/generative-ai-docs#210
Edit: Seems like this is broken with OpenAI
"@ai-sdk/openai": "^0.0.51",
as well. But only whenstructuredOutputs
is true.Error
Invalid JSON payload received. Unknown name \\"minItems\\" at 'generation_config.response_schema.properties[1].value.items.properties[1].value': Cannot find field.\\nInvalid JSON payload received. Unknown name \\"minItems\\" at 'generation_config.response_schema.properties[1].value': Cannot find field.",\n
Code example
Additional context
Google
Broken in both
tool
andjson
modes.OpenAI
Broken when
structuredOutputs
istrue
.The text was updated successfully, but these errors were encountered: