Example: Function calling
This example answers an inbound call, enables Gemini tool calling, and sends tool responses back to the model.
⬇️ Jump to the Full VoxEngine scenario.
Prerequisites
- Set up an inbound entrypoint for the caller:
- Phone number: https://voximplant.com/docs/getting-started/basic-concepts/phone-numbers
- WhatsApp: https://voximplant.com/docs/guides/integrations/whatsapp
- SIP user / SIP registration: https://voximplant.com/docs/guides/calls/sip
- App user: https://voximplant.com/docs/getting-started/basic-concepts/users (see also https://voximplant.com/docs/guides/calls/scenarios#how-to-call-a-voximplant-user)
- Create a routing rule that points the destination (phone number / WhatsApp / SIP username / app user alias) to this scenario: https://voximplant.com/docs/getting-started/basic-concepts/routing-rules
- Store your Gemini API key in Voximplant
ApplicationStorageunderGEMINI_API_KEY.
Tool definitions
The example registers tools in connectConfig.tools using functionDeclarations and JSON Schema parameters:
Handling tool calls
Gemini sends tool calls via Gemini.LiveAPIEvents.ToolCall. Respond with sendToolResponse:
Notes
- The example uses the Gemini Developer API (
Gemini.Backend.GEMINI_API), not Vertex AI. - Tool implementations in the example are stubs. Replace with real integrations as needed.
See the VoxEngine API Reference for more details.
Full VoxEngine scenario
voxeengine-gemini-function-calling.js