Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/NickTikhonov/shuo
/ functions
Functions
148 in github.com/NickTikhonov/shuo
⨍
Functions
148
◇
Types & classes
33
↳
Endpoints
5
↓ 50 callers
Function
_c
Wrap text in color codes.
shuo/log.py:53
↓ 42 callers
Method
info
(self, msg: str)
shuo/log.py:295
↓ 35 callers
Method
get
Get a connected TTS service with the given callbacks. Returns a warm connection if available (and not stale), otherwise bloc
shuo/services/tts_pool.py:77
↓ 33 callers
Function
process_event
Pure state machine: (State, Event) -> (State, Actions) With Flux, this is just a simple router: - MediaEvent -> feed audio to Flu
shuo/state.py:22
↓ 20 callers
Method
error
Log an error (red).
shuo/log.py:239
↓ 10 callers
Method
cancel
Cancel ongoing generation.
shuo/services/llm.py:64
↓ 5 callers
Function
_text_outline
White outline effect for text readability over the map.
scripts/service_map.py:93
↓ 4 callers
Function
_ms_since
Milliseconds elapsed since t0.
shuo/agent.py:29
↓ 4 callers
Method
begin
Begin a named span.
shuo/tracer.py:77
↓ 4 callers
Method
debug
(self, msg: str)
shuo/log.py:292
↓ 4 callers
Method
end
End a named span.
shuo/tracer.py:85
↓ 4 callers
Function
get_logger
Get a logger instance.
shuo/log.py:95
↓ 3 callers
Method
cancel_turn
Cancel current turn, preserve history.
shuo/agent.py:126
↓ 3 callers
Method
connected
(self)
shuo/log.py:269
↓ 3 callers
Method
send
Send text chunk for synthesis.
shuo/services/tts.py:93
↓ 3 callers
Method
stop_and_clear
Stop playback immediately and clear Twilio's buffer.
shuo/services/player.py:85
↓ 2 callers
Method
_cleanup
Clean up resources.
shuo/services/tts.py:142
↓ 2 callers
Method
_cleanup
Clean up resources.
shuo/services/flux.py:104
↓ 2 callers
Method
_playback_loop
Independent loop that drips audio at ~20ms intervals.
shuo/services/player.py:111
↓ 2 callers
Function
_quote
Wrap text in quotes with color.
shuo/log.py:58
↓ 2 callers
Method
_trigger_fill
Signal the fill loop to check pool levels.
shuo/services/tts_pool.py:128
↓ 2 callers
Method
cancelled
(self)
shuo/log.py:277
↓ 2 callers
Method
disconnected
(self)
shuo/log.py:274
↓ 2 callers
Method
flush
Force synthesis of any buffered text.
shuo/services/tts.py:107
↓ 2 callers
Function
load_trace
(path: Path)
scripts/visualize.py:53
↓ 2 callers
Function
make_outbound_call
Initiate an outbound call using Twilio. Args: to_number: Phone number to call in E.164 format (+1234567890) Returns
shuo/services/twilio_client.py:18
↓ 2 callers
Method
mark
Record a point-in-time marker.
shuo/tracer.py:97
↓ 2 callers
Method
start
Start generating a response.
shuo/services/llm.py:53
↓ 2 callers
Method
start
Open WebSocket connection to ElevenLabs.
shuo/services/tts.py:54
↓ 1 callers
Function
_color
(m: str)
scripts/bench_chart.py:33
↓ 1 callers
Method
_evict_stale
Remove connections that have been idle past TTL.
shuo/services/tts_pool.py:168
↓ 1 callers
Method
_fill_loop
Background loop that keeps the pool at target size.
shuo/services/tts_pool.py:132
↓ 1 callers
Method
_generate
Generate response and stream tokens.
shuo/services/llm.py:78
↓ 1 callers
Method
_handle_message
Parse and handle ElevenLabs response.
shuo/services/tts.py:178
↓ 1 callers
Function
_make_clients
Build provider → AsyncOpenAI client map.
shuo/server.py:139
↓ 1 callers
Function
_measure_ttft
Single TTFT measurement in milliseconds. Opens a streaming completion, records time-to-first-content-token, then closes the stream immed
shuo/server.py:154
↓ 1 callers
Method
_receive_loop
Background task to receive audio chunks.
shuo/services/tts.py:161
↓ 1 callers
Function
_render_turn
Render a single turn on one subplot.
scripts/visualize.py:145
↓ 1 callers
Method
_send_audio
Send a single audio chunk to Twilio.
shuo/services/player.py:137
↓ 1 callers
Method
_send_clear
Send clear message to Twilio to flush audio buffer.
shuo/services/player.py:148
↓ 1 callers
Function
_short_id
Truncate long call IDs for display.
scripts/visualize.py:79
↓ 1 callers
Method
action
Log an outgoing action.
shuo/log.py:200
↓ 1 callers
Method
begin_turn
Start a new turn, returns turn number.
shuo/tracer.py:66
↓ 1 callers
Method
bind
Rebind callbacks (used by connection pool to assign per-turn handlers).
shuo/services/tts.py:45
↓ 1 callers
Method
call_initiated
(cls, sid: str)
shuo/log.py:129
↓ 1 callers
Method
call_initiating
(cls, phone: str)
shuo/log.py:125
↓ 1 callers
Method
cancel
Abort connection immediately.
shuo/services/tts.py:136
↓ 1 callers
Function
check_environment
Check that all required environment variables are set.
main.py:35
↓ 1 callers
Method
cleanup
Final cleanup when call ends.
shuo/agent.py:151
↓ 1 callers
Method
event
Log an incoming event.
shuo/log.py:152
↓ 1 callers
Function
fetch_trace
Fetch trace JSON from a remote URL.
scripts/visualize.py:58
↓ 1 callers
Function
find_latest_trace
()
scripts/visualize.py:64
↓ 1 callers
Function
main
Main entry point.
main.py:75
↓ 1 callers
Function
main
CLI entry point.
scripts/visualize.py:296
↓ 1 callers
Function
make_chart
(data: dict, save_path: Optional[str] = None)
scripts/bench_chart.py:24
↓ 1 callers
Function
make_map
(save_path: str = None)
scripts/service_map.py:98
↓ 1 callers
Method
mark_tts_done
Signal that TTS is complete - no more chunks coming.
shuo/services/player.py:69
↓ 1 callers
Function
parse_twilio_message
Parse raw Twilio WebSocket message into typed Event.
shuo/services/twilio_client.py:50
↓ 1 callers
Function
read_twilio
Background task to read from Twilio and push to event queue.
shuo/conversation.py:77
↓ 1 callers
Function
render_trace
Render a trace as a Gantt chart.
scripts/visualize.py:86
↓ 1 callers
Function
run_conversation_over_twilio
Main event loop for a single call. 1. Create shared event queue 2. Create Flux service (always-on STT + turn detection) 3. Start Twi
shuo/conversation.py:41
↓ 1 callers
Method
save
Write trace data to /tmp/shuo/<call_id>.json.
shuo/tracer.py:116
↓ 1 callers
Method
send
Send audio chunk to Deepgram Flux.
shuo/services/flux.py:88
↓ 1 callers
Method
send_chunk
Add an audio chunk to the playback queue.
shuo/services/player.py:62
↓ 1 callers
Method
server_ready
(cls, url: str)
shuo/log.py:121
↓ 1 callers
Method
server_starting
(cls, port: int)
shuo/log.py:117
↓ 1 callers
Function
setup_logging
Configure logging for the application.
shuo/log.py:78
↓ 1 callers
Method
shutdown
(cls)
shuo/log.py:143
↓ 1 callers
Method
start
Start the playback loop.
shuo/services/player.py:50
↓ 1 callers
Method
start
Start the pool and begin pre-connecting.
shuo/services/tts_pool.py:69
↓ 1 callers
Method
start
Connect to Deepgram Flux (always-on for the duration of the call).
shuo/services/flux.py:50
↓ 1 callers
Method
start_turn
Start a new agent turn.
shuo/agent.py:90
↓ 1 callers
Method
stop
Shut down pool and clean up all connections.
shuo/services/tts_pool.py:111
↓ 1 callers
Method
stop
Disconnect from Deepgram Flux.
shuo/services/flux.py:98
↓ 1 callers
Method
transition
Log a phase transition (magenta).
shuo/log.py:229
↓ 1 callers
Method
websocket_connected
(cls)
shuo/log.py:135
↓ 1 callers
Method
websocket_disconnected
(cls)
shuo/log.py:139
Method
__init__
(self, verbose: bool = False)
shuo/log.py:148
Method
__init__
(self, service_name: str)
shuo/log.py:264
Method
__init__
( self, websocket: WebSocket, stream_sid: str, on_done: Callable[[], None],
shuo/agent.py:43
Method
__init__
(self)
shuo/tracer.py:62
Method
__init__
( self, on_token: Callable[[str], Awaitable[None]], on_done: Callable[[], Awaitable[No
shuo/services/llm.py:25
Method
__init__
( self, websocket: WebSocket, stream_sid: str, on_done: Optional[Callable[[],
shuo/services/player.py:30
Method
__init__
(self, pool_size: int = 1, ttl: float = 8.0)
shuo/services/tts_pool.py:55
Method
__init__
( self, on_audio: Callable[[str], Awaitable[None]], on_done: Callable[[], Awaitable[No
shuo/services/tts.py:26
Method
__init__
( self, on_end_of_turn: Callable[[str], Awaitable[None]], on_start_of_turn: Callable[[
shuo/services/flux.py:29
Function
_fmt_ms
Format axis tick as integer ms or seconds.
scripts/visualize.py:72
Function
_handle_sigterm
Railway (and Docker) send SIGTERM before killing the container. We stop accepting new calls and wait for active ones to finish.
main.py:107
Function
_noop_audio
(_audio: str)
shuo/services/tts_pool.py:30
Function
_noop_done
()
shuo/services/tts_pool.py:34
Method
_on_error
Handle Deepgram errors.
shuo/services/flux.py:158
Method
_on_llm_done
LLM finished -> flush TTS.
shuo/agent.py:172
Method
_on_llm_token
LLM produced a token -> feed to TTS.
shuo/agent.py:158
Method
_on_message
Handle Flux messages -- parse TurnInfo events.
shuo/services/flux.py:126
Method
_on_playback_done
Player finished -> turn is complete.
shuo/agent.py:202
Method
_on_tts_audio
TTS produced audio -> send to player.
shuo/agent.py:179
Method
_on_tts_done
TTS finished -> tell player no more chunks coming.
shuo/agent.py:195
Method
available
Number of warm connections ready to dispense.
shuo/services/tts_pool.py:65
Function
bench_ttft
Benchmark TTFT across OpenAI-compatible models. Usage: curl https://your-server/bench/ttft curl https://your-server/bench/tt
shuo/server.py:201
Method
cancel_turn
Mark turn as cancelled and end all open spans at current time.
shuo/tracer.py:105
next →
1–100 of 148, ranked by callers