brainy-painter-59862
05/15/2025, 1:20 PMtall-airline-16756
05/15/2025, 1:20 PMtall-airline-16756
05/15/2025, 1:20 PMsave_chatctx.py
script. Here's a summary of the process:
1. Create a voice pipeline agent with components like VAD (Voice Activity Detection), STT (Speech-to-Text), LLM, and TTS (Text-to-Speech).
2. Set up event handlers to capture both user speech and agent responses. For example: @agent.on("user_speech_committed")
def on_user_speech_committed(msg: llm.ChatMessage):
log_queue.put_nowait(f"[{datetime.now()}] USER:\n{msg.content}\n\n")
@agent.on("agent_speech_committed")
def on_agent_speech_committed(msg: llm.ChatMessage):
log_queue.put_nowait(f"[{datetime.now()}] AGENT:\n{msg.content}\n\n")
3. Use an asynchronous queue and a separate task to write the logs to a file, such as `transcriptions.log`:
4. Ensure proper cleanup when the application shuts down:
This method will log both user inputs and agent responses with timestamps to a file for later review.
Sources: Tree View: | dse-workbench