github vercel/ai ai@2.2.2

latest releases: @ai-sdk/amazon-bedrock@0.0.27, ai@3.4.3, @ai-sdk/google@0.0.49...
13 months ago

Patch Changes

  • 84e0cc8: Add experimental_StreamData and new opt-in wire protocol to enable streaming additional data. See #425.

    Changes onCompletion back to run every completion, including recursive function calls. Adds an onFinish callback that runs once everything has streamed. For users not using experimental function handling on the server, onCompletion functions the same but it's recommended you migrate to onFinish.

    If you're using experimental function handlers on the server and caching via onCompletion,
    you may want to adjust your caching code to account for recursive calls so the same key isn't used.

    let depth = 0
    
    const stream = OpenAIStream(response, {
        async onCompletion(completion) {
          depth++
          await kv.set(key + '_' + depth, completion)
          await kv.expire(key + '_' + depth, 60 * 60)
        }
      })
    

Don't miss a new ai release

NewReleases is sending notifications on new releases.