Chat
Video
Use chat models with video input to generate insightful responses.
Chat + Video (Video as Input
)
The Bytez API enables multimodal chat
models that can analyze video content and respond based on the visual context.
Use chat models to process video input, generating insights, summaries, or context-aware responses. Below are examples for working with video-based AI interactions.
Code
Text + Video
This example sends a video file
along with a text prompt
for analysis.
Streaming
Streaming allows you to receive model outputs incrementally as soon as they are available, which is ideal for tasks like real-time responses or large outputs.
How Streaming Works
To enable streaming, pass true
as the third argument to the model.run()
function. The model will return a stream that you can read incrementally.
javascript
Node.js Example
javascript
Browser Example
javascript
Key Points
Node.js
: Convert the Web Stream usingReadable.fromWeb()
for compatibility.Browser
: UsegetReader()
andTextDecoder
to process the stream.Error Handling
: Both methods use try…catch to handle potential errors.Data Handling
: Data chunks are processed as they arrive via data events or.read()
calls.