Overview
Once connected, you can dynamically update the transformation parameters without reconnecting. The Real-time API provides several methods to update state during an active session.Updating Prompts
UsesetPrompt() to change the text prompt:
Method Signature
Parameters
- prompt (string, required) - The text prompt to apply
- enhance (boolean, optional) - Whether to enhance the prompt (default:
true)
Example with Error Handling
Updating Multiple Parameters
Useset() to update prompt and/or image together:
Method Signature
Parameters
At least one ofprompt or image must be provided:
- prompt (string, optional) - New text prompt
- enhance (boolean, optional) - Enable prompt enhancement (default:
true) - image (Blob | File | string | null, optional) - Reference image to update
Update Prompt Only
Update Image Only
Update Both
Clear Image
Updating Reference Images
For models likelucy_2_rt, use setImage() for more control:
Method Signature
Parameters
- image (Blob | File | string | null, required) - Image to set as reference
- prompt (string, optional) - Optional prompt to send with the image
- enhance (boolean, optional) - Whether to enhance the prompt
- timeout (number, optional) - Timeout in milliseconds (default: 30000)
Image Input Types
Interactive Examples
Prompt Switcher
User Input Handler
Image Upload Handler
Real-time Slider Controls
Live Avatar Audio
For thelive_avatar model, play audio to animate the avatar:
State Update Best Practices
1. Check Connection State
2. Debounce Rapid Updates
3. Handle Errors Gracefully
4. Validate Input
Timeout Handling
All update methods have timeouts to prevent hanging:Next Steps
- Events & Diagnostics - Monitor state changes and handle errors
- Connection Management - Connection lifecycle and error handling