I switched my app from openai to google provider and now streamText throws errors. The same code works fine with openai.
import { google } from "@ai-sdk/google"
import { streamText } from "ai"
const result = streamText({
model: google("gemini-2.5-flash"),
prompt: "tell me a story",
})
for await (const chunk of result.textStream) {
process.stdout.write(chunk)
}
Throws: TypeError: Cannot read properties of undefined (reading 'choices')
This seems like a compatibility issue between providers. Using ai@6.0.1.