The useLiveAPIContext hook provides access to the client (an event-emitting websocket client) and a setConfig function. Use setConfig to define the model, system instructions, and tools (such as Google Search or function declarations) for the session.
Common configuration keys include:
model: The model identifier (e.g., models/gemini-2.0-flash-exp).systemInstruction: An object containing parts with text instructions.tools: An array of tool objects, such as { googleSearch: {} } or { functionDeclarations: [...] }.
import { useLiveAPIContext } from "../../contexts/LiveAPIContext";
// Inside a component:
const { client, setConfig } = useLiveAPIContext();
useEffect(() => {
setConfig({
model: "models/gemini-2.0-flash-exp",
systemInstruction: {
parts: [{ text: 'Your instructions here' }],
},
tools: [{ googleSearch: {} }],
});
}, [setConfig]);