Problem
Some of the models return media via a stream, or provide an api to retrieve the final file. TanStack AI supports returning media either as a URL or as a base64 blob. If a URL isn't returned by the model, then it has to return a blob. This means downloading or fetching all the bytes in memory, then converting to base64. This will cause many backend environments to run out of memory.
Solution
Add a media uploader function to the constructor of video, image, audio, and speech adapters to allow the user to efficiently stream bytes from responses to a storage provider of their choice
Problem
Some of the models return media via a stream, or provide an api to retrieve the final file. TanStack AI supports returning media either as a URL or as a base64 blob. If a URL isn't returned by the model, then it has to return a blob. This means downloading or fetching all the bytes in memory, then converting to base64. This will cause many backend environments to run out of memory.
Solution
Add a media uploader function to the constructor of video, image, audio, and speech adapters to allow the user to efficiently stream bytes from responses to a storage provider of their choice