State Awareness
Voice assistants often fail because they lack visual context. They don't know what page the user is on or what's in their cart. Voxide solves this via `bindState`.
#Binding Live State
Pass a getter function to the SDK. Every time the user speaks, Voxide evaluates this function and securely injects the returned JSON object into the AI's prompt context.
typescript
ai.bindState(() => { return { currentRoute: window.location.pathname, cartItemCount: getCartCount(), userIsLoggedIn: !!getToken() };});Performance Note
Do not execute heavy synchronous logic inside `bindState`. It runs on the main thread immediately before the WebSocket transmission. Keep the payload small and relevant.