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
when i try run the agentic ai example on nextjs app router v14.2.6 on a server action i get this error Error: await is only valid in async functions and the top level bodies of modules here is my code
"use server";import{createStreamableValue}from"ai/rsc";import{createOpenAI,openai}from"@ai-sdk/openai";import{streamText,tool}from"ai";import{z}from"zod";import{createAISDKTools}from"@agentic/ai-sdk";import{WeatherClient}from"@agentic/weather";constgroq=createOpenAI({baseURL: "https://api.groq.com/openai/v1",apiKey: process.env.GROQ_API_KEY,});exportasyncfunctiontryGroq({ input }: {input: string}){conststream=createStreamableValue("");constweather=newWeatherClient();(async()=>{const{ textStream }=awaitstreamText({model: groq("llama3-8b-8192"),system: `you are a helpful assistant. Be as concise as possible and straightforward as possible`,tools: createAISDKTools(weather),toolChoice: "none",prompt: input,}).catch((error)=>{console.error(error);throwerror;});forawait(constdeltaoftextStream){stream.update(delta);}stream.done();})();return{output: stream.value,};}
Been trying to debug but im getting no help. any leads will be highly appreciated. thank you
The text was updated successfully, but these errors were encountered:
when i try run the agentic ai example on nextjs app router
v14.2.6
on a server action i get this errorError: await is only valid in async functions and the top level bodies of modules
here is my codeBeen trying to debug but im getting no help. any leads will be highly appreciated. thank you
The text was updated successfully, but these errors were encountered: