ModelState type defines the configuration state for real-time models, including prompt and image inputs.
Type Definition
Fields
prompt
The text prompt configuration for the model.
image
Reference image input for models that support image conditioning. Can be:
Blob- Binary image dataFile- File object from file inputstring- Base64-encoded image data or URL
Usage Examples
With Prompt Only
With Image Reference
With Base64 Image
Related Methods
- connect() - Initialize real-time connection with ModelState
- setImage() - Update image during active session
- sendPrompt() - Send new prompt during active session
Validation
The SDK validatesModelState using a Zod schema at runtime:
Notes
- The
prompt.textfield must be at least 1 character when provided - Prompt enhancement is enabled by default to improve generation quality
- Not all real-time models support image inputs - check model capabilities
- Image data is automatically converted to the appropriate format for the API