Function calling gives Large Language Models (LLMs) the power to interact with the real world. While LLMs excel at generating text and maintaining conversation, they cannot natively check your database, book a flight, or fetch live weather data. Function calling bridges this gap by allowing the model to describe an action and its required parameters, which your application then executes.
In the context of Deepgram Voice Agents, function calling enables your agent to perform tasks during a live conversation. The agent identifies when a user request requires external data or an action, pauses its response to trigger a function, and then uses the result to continue the dialogue naturally.
Function calling transforms a simple chatbot into a functional assistant. Use it to:
Function calling follows a specific sequence of events between the user, the Voice Agent server, and your client application.
FunctionCallRequest to the client (for client-side functions) or executes it internally (for server-side functions).FunctionCallResponse.The following diagram illustrates the interaction between the components during a function call.
Deepgram supports two modes of execution for function calls:
Your application handles the function logic. This is ideal for actions that happen in the user’s environment, such as navigating a UI, accessing local device data, or calling APIs that require client-side authentication. You define the function in your settings without an endpoint URL.
Deepgram calls a web endpoint that you provide. This is best for secure operations, database lookups, or interacting with third-party services where you want to keep logic and credentials on your server.
To start implementing function calling, explore these detailed guides: