You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All the code is based on the Vercel IA SDK documentation, I'm using the createGoogleGenerativeAI provider instance with my API key and everything is fine, but whenever I need a return on the client side with new StreamingTextResponse(result.toAIStream( )) return this error:
my AI response is not compromised but the available stream is locked...
Code example
import{StreamingTextResponse,streamText,StreamData}from"ai";import{NextRequest}from"next/server";import{createGoogleGenerativeAI}from"@ai-sdk/google";exportconstdynamic="force-dynamic";exportconstPOST=async(req: NextRequest)=>{constdata=awaitreq.json();constgoogle=createGoogleGenerativeAI({apiKey: process.env.GOOGLE_API_KEY!,// custom settings});constmodel=google("models/gemini-1.5-pro-latest");constresult=awaitstreamText({
model,prompt: "Hello , you you doing? "seed: 5,});letmessage="";forawait(constitemofresult.textStream){console.log(item);message=item;}if(!result){console.log("error !!! ");}returnnewStreamingTextResponse(result.toAIStream());};
Additional context
The text was updated successfully, but these errors were encountered:
Description
All the code is based on the Vercel IA SDK documentation, I'm using the
![image](https://private-user-images.githubusercontent.com/80254945/327980466-05d5fbb3-9ef7-4b42-a914-f5dcfe3a0905.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwMjI0NjAsIm5iZiI6MTcxOTAyMjE2MCwicGF0aCI6Ii84MDI1NDk0NS8zMjc5ODA0NjYtMDVkNWZiYjMtOWVmNy00YjQyLWE5MTQtZjVkY2ZlM2EwOTA1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDAyMDkyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5MjQ4NWUwMzc0ZDQ1NmViZDJhZGQwZmQxNmJkNzUxMzdmMmI0YTdmNzg0ZDg4YTIwN2M3OGNmNDhhNTZiMjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.UbghUrv7RBi3y-J_18KtJsehctf-TckAh34D1elMKlg)
createGoogleGenerativeAI
provider instance with my API key and everything is fine, but whenever I need a return on the client side withnew StreamingTextResponse(result.toAIStream( ))
return this error:my AI response is not compromised but the available stream is locked...
Code example
Additional context
The text was updated successfully, but these errors were encountered: