Function Call Response

Configure the voice agent and configure the function call response.


📘

When the LLM decides to call a function, it sends a message to the client indicating the need to invoke a specific function—this message is called a FunctionCallRequest. In response, the client processes the request, calls the desired function, and then sends back the result as a FunctionCallResponse.

What is the FunctionCallResponse Message

TheFunctionCallResponse message is a JSON command that the client should reply with every time there is a FunctionCallRequest received.

Sending FunctionCallResponse

To send the FunctionCallResponse message, you need to send the following JSON message to the server:

{
  "type": "FunctionCallResponse",
  "function_call_id": "", // The same ID received in the request
  "output": "" // A string containing the result of the function call
}

FunctionCallResponse Confirmation

There is no confirmation message sent to the client after it sends a FunctionCallResponse to the server. You know your function call was processed successfully if the conversation proceeds and the agent replies

Conclusion

the FunctionCallResponse message serves as a standardized JSON command that the client must send in direct response to each FunctionCallRequest received. This ensures consistent communication, facilitates prompt data exchange, and maintains a reliable workflow between the client and server.