Documentation
¶
Overview ¶
Command function-calling-openai-async-stream is a voice agent whose LLM calls tools: OpenAI, with a tool that reports intermediate results.
The track_current_location tool simulates a GPS tracker reporting the device's position during a road trip from San Francisco to San Diego. It sends two intermediate updates (results marked not final) as the vehicle passes through cities along the way, then delivers the final destination. Because the tool is not canceled when the user interrupts, the LLM can keep talking while the trip is in progress; each position update reaches it as a developer message, so it can narrate the journey to the user. Speech-to-text is Deepgram and text-to-speech Cartesia.
DEEPGRAM_API_KEY=… OPENAI_API_KEY=… CARTESIA_API_KEY=… \ go run ./examples/function-calling/function-calling-openai-async-stream
Then open http://localhost:7860, connect, and ask it to track your location.