Next.js Discord

Discord Forum

onStart in AI sdk streamText

Unanswered
Tomistoma posted this in #help-forum
Open in Discord
TomistomaOP
Hey guys I am trying to upgrade to the newest version of ai/sdk but I am missing onStart when streaming. I was using onStart in the older version but I am not sure how I can execute some code after the streaming has started

     const result = await streamText({
        model: client.chat('gpt-3.5-turbo'),
        system: 'You are a helpful assistant. today is monday',
        messages: context.allMessages,
        onFinish: async (event) => {
          // onFinish()
        },
        onStart: () => { -> doesn't exist
          // onStart()  -> 
        },
      })


Any ideas? Thanks!

0 Replies