Apply ruff formatting fixes

This commit is contained in:
zack
2026-03-01 11:44:37 -05:00
parent 5de495cc98
commit 42f91a9056
5 changed files with 56 additions and 81 deletions

View File

@@ -102,7 +102,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
@transport.event_handler("on_client_connected") @transport.event_handler("on_client_connected")
async def on_client_connected(transport, client): async def on_client_connected(transport, client):
logger.info(f"Client connected") logger.info(f"Client connected")
logger.info("Phase 1: No keyterms boosting - try saying 'Xiomara', 'Saoirse', or 'Krzystof'") logger.info(
"Phase 1: No keyterms boosting - try saying 'Xiomara', 'Saoirse', or 'Krzystof'"
)
messages.append({"role": "system", "content": "Please introduce yourself to the user."}) messages.append({"role": "system", "content": "Please introduce yourself to the user."})
await task.queue_frames([LLMRunFrame()]) await task.queue_frames([LLMRunFrame()])

View File

@@ -355,13 +355,10 @@ class AssemblyAISTTService(WebsocketSTTService):
if hasattr(conn_params, "min_turn_silence"): if hasattr(conn_params, "min_turn_silence"):
if ( if (
old_conn_params is None old_conn_params is None
or conn_params.min_turn_silence or conn_params.min_turn_silence != old_conn_params.min_turn_silence
!= old_conn_params.min_turn_silence
): ):
if conn_params.min_turn_silence is not None: if conn_params.min_turn_silence is not None:
update_config["min_turn_silence"] = ( update_config["min_turn_silence"] = conn_params.min_turn_silence
conn_params.min_turn_silence
)
logger.info( logger.info(
f"Updating min_turn_silence to: {conn_params.min_turn_silence}ms" f"Updating min_turn_silence to: {conn_params.min_turn_silence}ms"
) )

View File

@@ -48,11 +48,11 @@ async def main():
logger.remove(0) logger.remove(0)
logger.add(sys.stderr, level=LOG_LEVEL) logger.add(sys.stderr, level=LOG_LEVEL)
logger.info("="*80) logger.info("=" * 80)
logger.info("AssemblyAI u3-rt-pro Custom Test") logger.info("AssemblyAI u3-rt-pro Custom Test")
logger.info("="*80) logger.info("=" * 80)
logger.info("Starting bot... Speak after you hear the greeting!") logger.info("Starting bot... Speak after you hear the greeting!")
logger.info("="*80) logger.info("=" * 80)
# Create local audio transport # Create local audio transport
transport = LocalAudioTransport( transport = LocalAudioTransport(
@@ -74,78 +74,63 @@ async def main():
speech_model="u3-rt-pro", speech_model="u3-rt-pro",
# speech_model="universal-streaming-english", # speech_model="universal-streaming-english",
# speech_model="universal-streaming-multilingual", # speech_model="universal-streaming-multilingual",
# ==================================================================== # ====================================================================
# Turn Detection Timing # Turn Detection Timing
# ==================================================================== # ====================================================================
# Minimum silence when confident about end of turn (milliseconds) # Minimum silence when confident about end of turn (milliseconds)
# Default: 100ms | Higher = more patient | Lower = faster responses # Default: 100ms | Higher = more patient | Lower = faster responses
# Only used in Pipecat mode (vad_force_turn_endpoint=True) # Only used in Pipecat mode (vad_force_turn_endpoint=True)
min_turn_silence=100000, min_turn_silence=100000,
# min_turn_silence=200, # min_turn_silence=200,
# min_turn_silence=300, # min_turn_silence=300,
# Maximum turn silence (milliseconds) # Maximum turn silence (milliseconds)
# WARNING: In Pipecat mode (vad_force_turn_endpoint=True), this is # WARNING: In Pipecat mode (vad_force_turn_endpoint=True), this is
# automatically set equal to min_turn_silence # automatically set equal to min_turn_silence
# to avoid double turn detection. Only used as-is in STT mode. # to avoid double turn detection. Only used as-is in STT mode.
max_turn_silence=500, max_turn_silence=500,
# End of turn confidence threshold (0.0 to 1.0) # End of turn confidence threshold (0.0 to 1.0)
# Higher = requires more confidence before ending turn # Higher = requires more confidence before ending turn
# end_of_turn_confidence_threshold=0.8, # end_of_turn_confidence_threshold=0.8,
# ==================================================================== # ====================================================================
# Prompting & Boosting # Prompting & Boosting
# ==================================================================== # ====================================================================
# Custom Prompt (WARNING: test carefully, default is optimized!) # Custom Prompt (WARNING: test carefully, default is optimized!)
# None = Use AssemblyAI's optimized default (recommended for 88% accuracy) # None = Use AssemblyAI's optimized default (recommended for 88% accuracy)
prompt=None, prompt=None,
# prompt="Transcribe speech with focus on technical terms.", # prompt="Transcribe speech with focus on technical terms.",
# prompt="Context: Medical conversation. Transcribe accurately.", # prompt="Context: Medical conversation. Transcribe accurately.",
# Keyterms Prompting (boosts recognition for specific words) # Keyterms Prompting (boosts recognition for specific words)
# NOTE: Cannot use both prompt and keyterms_prompt! # NOTE: Cannot use both prompt and keyterms_prompt!
keyterms_prompt=None, keyterms_prompt=None,
# keyterms_prompt=["Pipecat", "AssemblyAI", "OpenAI", "Cartesia"], # keyterms_prompt=["Pipecat", "AssemblyAI", "OpenAI", "Cartesia"],
# keyterms_prompt=["Python", "JavaScript", "TypeScript", "API"], # keyterms_prompt=["Python", "JavaScript", "TypeScript", "API"],
# ==================================================================== # ====================================================================
# Diarization (Speaker Identification) # Diarization (Speaker Identification)
# ==================================================================== # ====================================================================
# Enable speaker labels (identifies different speakers) # Enable speaker labels (identifies different speakers)
speaker_labels=None, # None or True speaker_labels=None, # None or True
# speaker_labels=True, # speaker_labels=True,
# ==================================================================== # ====================================================================
# Audio Configuration # Audio Configuration
# ==================================================================== # ====================================================================
# Audio sample rate (Hz) # Audio sample rate (Hz)
# sample_rate=16000, # sample_rate=16000,
# sample_rate=8000, # sample_rate=8000,
# Audio encoding format # Audio encoding format
# encoding="pcm_s16le", # Default: 16-bit PCM # encoding="pcm_s16le", # Default: 16-bit PCM
# encoding="pcm_mulaw", # μ-law encoding (telephony) # encoding="pcm_mulaw", # μ-law encoding (telephony)
# ==================================================================== # ====================================================================
# Other Options # Other Options
# ==================================================================== # ====================================================================
# Format transcript turns (applies formatting rules) # Format transcript turns (applies formatting rules)
# format_turns=True, # Default # format_turns=True, # Default
# format_turns=False, # format_turns=False,
# Language detection (only for universal-streaming-multilingual) # Language detection (only for universal-streaming-multilingual)
# language_detection=True, # language_detection=True,
) )
# Log connection parameters for debugging # Log connection parameters for debugging
logger.info("="*80) logger.info("=" * 80)
logger.info("CONNECTION PARAMETERS:") logger.info("CONNECTION PARAMETERS:")
logger.info(f" speech_model: {connection_params.speech_model}") logger.info(f" speech_model: {connection_params.speech_model}")
logger.info(f" min_turn_silence: {connection_params.min_turn_silence}") logger.info(f" min_turn_silence: {connection_params.min_turn_silence}")
@@ -156,27 +141,26 @@ async def main():
logger.info(f" keyterms_prompt: {connection_params.keyterms_prompt}") logger.info(f" keyterms_prompt: {connection_params.keyterms_prompt}")
logger.info(f" speaker_labels: {connection_params.speaker_labels}") logger.info(f" speaker_labels: {connection_params.speaker_labels}")
logger.info(f" format_turns: {connection_params.format_turns}") logger.info(f" format_turns: {connection_params.format_turns}")
logger.info(f" end_of_turn_confidence_threshold: {connection_params.end_of_turn_confidence_threshold}") logger.info(
f" end_of_turn_confidence_threshold: {connection_params.end_of_turn_confidence_threshold}"
)
logger.info(f" language_detection: {connection_params.language_detection}") logger.info(f" language_detection: {connection_params.language_detection}")
logger.info("="*80) logger.info("=" * 80)
# AssemblyAI Speech-to-Text Service # AssemblyAI Speech-to-Text Service
stt = AssemblyAISTTService( stt = AssemblyAISTTService(
api_key=os.getenv("ASSEMBLYAI_API_KEY"), api_key=os.getenv("ASSEMBLYAI_API_KEY"),
connection_params=connection_params, connection_params=connection_params,
# Turn Detection Mode # Turn Detection Mode
# True = Pipecat mode (VAD + Smart Turn controls turns) # True = Pipecat mode (VAD + Smart Turn controls turns)
# False = STT mode (u3-rt-pro model controls turns) # False = STT mode (u3-rt-pro model controls turns)
vad_force_turn_endpoint=True, vad_force_turn_endpoint=True,
# Speaker Formatting (only used if speaker_labels=True) # Speaker Formatting (only used if speaker_labels=True)
# None = Just log speaker IDs, don't modify transcript # None = Just log speaker IDs, don't modify transcript
speaker_format=None, speaker_format=None,
# speaker_format="<Speaker {speaker}>{text}</Speaker {speaker}>", # speaker_format="<Speaker {speaker}>{text}</Speaker {speaker}>",
# speaker_format="{speaker}: {text}", # speaker_format="{speaker}: {text}",
# speaker_format="[{speaker}] {text}", # speaker_format="[{speaker}] {text}",
# Additional available parameters (uncomment to use): # Additional available parameters (uncomment to use):
# should_interrupt=True, # Only for STT mode # should_interrupt=True, # Only for STT mode
) )

View File

@@ -52,11 +52,11 @@ async def run_bot(
test_dynamic_updates: Optional[callable] = None, test_dynamic_updates: Optional[callable] = None,
): ):
"""Run the voice bot with specified configuration.""" """Run the voice bot with specified configuration."""
logger.info("="*80) logger.info("=" * 80)
logger.info(f"TEST: {test_name}") logger.info(f"TEST: {test_name}")
logger.info("="*80) logger.info("=" * 80)
logger.info("Starting bot... Speak into your microphone after you hear the greeting!") logger.info("Starting bot... Speak into your microphone after you hear the greeting!")
logger.info("="*80) logger.info("=" * 80)
# Create local audio transport # Create local audio transport
transport = LocalAudioTransport( transport = LocalAudioTransport(
@@ -150,6 +150,7 @@ async def run_bot(
# === BASIC CONFIGURATION (1-3) === # === BASIC CONFIGURATION (1-3) ===
async def test_01_basic_100ms(): async def test_01_basic_100ms():
"""Test 1: Basic default configuration (100ms).""" """Test 1: Basic default configuration (100ms)."""
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(
@@ -179,6 +180,7 @@ async def test_03_custom_500ms():
# === PROMPTING & WARNINGS (4-7) === # === PROMPTING & WARNINGS (4-7) ===
async def test_04_max_warning(): async def test_04_max_warning():
"""Test 4: max_turn_silence warning (should be overridden).""" """Test 4: max_turn_silence warning (should be overridden)."""
logger.warning("⚠️ EXPECT WARNING: max_turn_silence will be overridden") logger.warning("⚠️ EXPECT WARNING: max_turn_silence will be overridden")
@@ -230,6 +232,7 @@ async def test_07_keyterms_difficult():
# === DIARIZATION (8-9) === # === DIARIZATION (8-9) ===
async def test_08_diarization_basic(): async def test_08_diarization_basic():
"""Test 8: Basic diarization (speaker IDs logged).""" """Test 8: Basic diarization (speaker IDs logged)."""
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(
@@ -258,6 +261,7 @@ async def test_09_diarization_xml():
# === DYNAMIC UPDATES - SINGLE PARAMETER (10-13) === # === DYNAMIC UPDATES - SINGLE PARAMETER (10-13) ===
async def test_10_dynamic_keyterms(): async def test_10_dynamic_keyterms():
"""Test 10: Dynamic keyterms update with difficult names.""" """Test 10: Dynamic keyterms update with difficult names."""
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(
@@ -265,16 +269,16 @@ async def test_10_dynamic_keyterms():
) )
async def dynamic_update(task): async def dynamic_update(task):
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("PHASE 1: No keyterms boosting") logger.info("PHASE 1: No keyterms boosting")
logger.info(" Try saying: Xiomara, Saoirse, Krzystof") logger.info(" Try saying: Xiomara, Saoirse, Krzystof")
logger.info(" (May not transcribe correctly)") logger.info(" (May not transcribe correctly)")
logger.info("="*80) logger.info("=" * 80)
await asyncio.sleep(15) await asyncio.sleep(15)
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("🔄 UPDATING: Adding keyterms boost") logger.info("🔄 UPDATING: Adding keyterms boost")
logger.info("="*80) logger.info("=" * 80)
await task.queue_frame( await task.queue_frame(
STTUpdateSettingsFrame( STTUpdateSettingsFrame(
delta=AssemblyAISTTSettings( delta=AssemblyAISTTSettings(
@@ -284,11 +288,11 @@ async def test_10_dynamic_keyterms():
) )
) )
) )
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("PHASE 2: Keyterms NOW boosted") logger.info("PHASE 2: Keyterms NOW boosted")
logger.info(" Say the same names again: Xiomara, Saoirse, Krzystof") logger.info(" Say the same names again: Xiomara, Saoirse, Krzystof")
logger.info(" (Should transcribe better now!)") logger.info(" (Should transcribe better now!)")
logger.info("="*80) logger.info("=" * 80)
logger.info("🔄 This test has 2 phases:") logger.info("🔄 This test has 2 phases:")
logger.info(" Phase 1 (15s): No boosting - names may be wrong") logger.info(" Phase 1 (15s): No boosting - names may be wrong")
@@ -308,29 +312,27 @@ async def test_11_dynamic_silence():
) )
async def dynamic_update(task): async def dynamic_update(task):
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("PHASE 1: Quick responses (100ms silence threshold)") logger.info("PHASE 1: Quick responses (100ms silence threshold)")
logger.info(" Speak normally - bot responds quickly") logger.info(" Speak normally - bot responds quickly")
logger.info("="*80) logger.info("=" * 80)
await asyncio.sleep(10) await asyncio.sleep(10)
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("🔄 UPDATING: Changing silence from 100ms → 3000ms (3 seconds!)") logger.info("🔄 UPDATING: Changing silence from 100ms → 3000ms (3 seconds!)")
logger.info("="*80) logger.info("=" * 80)
await task.queue_frame( await task.queue_frame(
STTUpdateSettingsFrame( STTUpdateSettingsFrame(
delta=AssemblyAISTTSettings( delta=AssemblyAISTTSettings(
connection_params=AssemblyAIConnectionParams( connection_params=AssemblyAIConnectionParams(min_turn_silence=3000)
min_turn_silence=3000
)
) )
) )
) )
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("PHASE 2: Patient responses (3 second silence threshold)") logger.info("PHASE 2: Patient responses (3 second silence threshold)")
logger.info(" Bot will wait 3 full seconds before responding") logger.info(" Bot will wait 3 full seconds before responding")
logger.info(" Try pausing mid-sentence - bot should NOT interrupt") logger.info(" Try pausing mid-sentence - bot should NOT interrupt")
logger.info("="*80) logger.info("=" * 80)
logger.info("🔄 Dramatic change: 100ms → 3000ms after 10 seconds") logger.info("🔄 Dramatic change: 100ms → 3000ms after 10 seconds")
await run_bot( await run_bot(
@@ -347,16 +349,16 @@ async def test_12_dynamic_prompt():
) )
async def dynamic_update(task): async def dynamic_update(task):
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("PHASE 1: Default prompt (no keyterms)") logger.info("PHASE 1: Default prompt (no keyterms)")
logger.info(" Try saying: Xiomara, Saoirse, Krzystof") logger.info(" Try saying: Xiomara, Saoirse, Krzystof")
logger.info(" (May not transcribe correctly)") logger.info(" (May not transcribe correctly)")
logger.info("="*80) logger.info("=" * 80)
await asyncio.sleep(15) await asyncio.sleep(15)
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("🔄 UPDATING: Adding custom prompt with keyterms") logger.info("🔄 UPDATING: Adding custom prompt with keyterms")
logger.info("="*80) logger.info("=" * 80)
custom_prompt = """Transcribe verbatim. Rules: custom_prompt = """Transcribe verbatim. Rules:
1) Always include punctuation in output. 1) Always include punctuation in output.
2) Use period/question mark ONLY for complete sentences. 2) Use period/question mark ONLY for complete sentences.
@@ -368,17 +370,15 @@ Pay special attention to these names and transcribe them exactly: Xiomara, Saoir
await task.queue_frame( await task.queue_frame(
STTUpdateSettingsFrame( STTUpdateSettingsFrame(
delta=AssemblyAISTTSettings( delta=AssemblyAISTTSettings(
connection_params=AssemblyAIConnectionParams( connection_params=AssemblyAIConnectionParams(prompt=custom_prompt)
prompt=custom_prompt
)
) )
) )
) )
logger.info("\n" + "="*80) logger.info("\n" + "=" * 80)
logger.info("PHASE 2: Prompt with keyterms NOW active") logger.info("PHASE 2: Prompt with keyterms NOW active")
logger.info(" Say the same names again: Xiomara, Saoirse, Krzystof") logger.info(" Say the same names again: Xiomara, Saoirse, Krzystof")
logger.info(" (Should transcribe better now!)") logger.info(" (Should transcribe better now!)")
logger.info("="*80) logger.info("=" * 80)
logger.info("🔄 This test has 2 phases:") logger.info("🔄 This test has 2 phases:")
logger.info(" Phase 1 (15s): Default prompt - names may be wrong") logger.info(" Phase 1 (15s): Default prompt - names may be wrong")
@@ -403,9 +403,7 @@ async def test_13_dynamic_clear_keyterms():
await task.queue_frame( await task.queue_frame(
STTUpdateSettingsFrame( STTUpdateSettingsFrame(
delta=AssemblyAISTTSettings( delta=AssemblyAISTTSettings(
connection_params=AssemblyAIConnectionParams( connection_params=AssemblyAIConnectionParams(keyterms_prompt=[])
keyterms_prompt=[]
)
) )
) )
) )
@@ -421,6 +419,7 @@ async def test_13_dynamic_clear_keyterms():
# === DYNAMIC UPDATES - MULTIPLE PARAMETERS (14-15) === # === DYNAMIC UPDATES - MULTIPLE PARAMETERS (14-15) ===
async def test_14_multi_param_update(): async def test_14_multi_param_update():
"""Test 14: Update multiple parameters at once.""" """Test 14: Update multiple parameters at once."""
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(
@@ -464,9 +463,7 @@ async def test_15_complex_sequence():
await task.queue_frame( await task.queue_frame(
STTUpdateSettingsFrame( STTUpdateSettingsFrame(
delta=AssemblyAISTTSettings( delta=AssemblyAISTTSettings(
connection_params=AssemblyAIConnectionParams( connection_params=AssemblyAIConnectionParams(keyterms_prompt=["Pipecat"])
keyterms_prompt=["Pipecat"]
)
) )
) )
) )
@@ -476,9 +473,7 @@ async def test_15_complex_sequence():
await task.queue_frame( await task.queue_frame(
STTUpdateSettingsFrame( STTUpdateSettingsFrame(
delta=AssemblyAISTTSettings( delta=AssemblyAISTTSettings(
connection_params=AssemblyAIConnectionParams( connection_params=AssemblyAIConnectionParams(min_turn_silence=200)
min_turn_silence=200
)
) )
) )
) )
@@ -506,6 +501,7 @@ async def test_15_complex_sequence():
# === MODE COMPARISON (16-17) === # === MODE COMPARISON (16-17) ===
async def test_16_pipecat_mode(): async def test_16_pipecat_mode():
"""Test 16: Pipecat mode (VAD + Smart Turn controls turns).""" """Test 16: Pipecat mode (VAD + Smart Turn controls turns)."""
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(
@@ -538,6 +534,7 @@ async def test_17_stt_mode():
# === STT MODE TIMING EXPERIMENTS (18-20) === # === STT MODE TIMING EXPERIMENTS (18-20) ===
async def test_18_stt_long_max_short_min(): async def test_18_stt_long_max_short_min():
"""Test 18: STT mode - Long max_turn_silence + Short min (5000ms + 100ms).""" """Test 18: STT mode - Long max_turn_silence + Short min (5000ms + 100ms)."""
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(
@@ -596,6 +593,7 @@ async def test_20_stt_both_short():
# === EDGE CASES (21-23) === # === EDGE CASES (21-23) ===
async def test_21_very_long_silence(): async def test_21_very_long_silence():
"""Test 21: Very long silence threshold (STT mode only).""" """Test 21: Very long silence threshold (STT mode only)."""
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(
@@ -645,9 +643,9 @@ async def test_23_keyterms_plus_diarization():
def show_menu(): def show_menu():
"""Display the comprehensive test menu.""" """Display the comprehensive test menu."""
print("\n" + "="*80) print("\n" + "=" * 80)
print("AssemblyAI u3-rt-pro Comprehensive Test Suite") print("AssemblyAI u3-rt-pro Comprehensive Test Suite")
print("="*80) print("=" * 80)
print("\n📋 BASIC CONFIGURATION (1-3)") print("\n📋 BASIC CONFIGURATION (1-3)")
print(" 1. Basic Default (100ms)") print(" 1. Basic Default (100ms)")
print(" 2. Custom Silence (200ms)") print(" 2. Custom Silence (200ms)")
@@ -688,7 +686,7 @@ def show_menu():
print(" 23. Keyterms + Diarization Combined") print(" 23. Keyterms + Diarization Combined")
print("\n 0. Exit") print("\n 0. Exit")
print("\n" + "="*80) print("\n" + "=" * 80)
async def main(): async def main():
@@ -735,6 +733,7 @@ async def main():
except Exception as e: except Exception as e:
logger.error(f"Test failed with error: {e}") logger.error(f"Test failed with error: {e}")
import traceback import traceback
traceback.print_exc() traceback.print_exc()
input("\n\nPress Enter to return to menu...") input("\n\nPress Enter to return to menu...")

View File

@@ -50,6 +50,7 @@ from pipecat.transports.local.audio import LocalAudioTransport, LocalAudioTransp
load_dotenv() load_dotenv()
# Test configuration # Test configuration
class TestConfig: class TestConfig:
"""Centralized test configuration.""" """Centralized test configuration."""
@@ -205,9 +206,7 @@ async def test_custom_min_silence():
logger.info("TEST 2: Custom min_turn_silence") logger.info("TEST 2: Custom min_turn_silence")
logger.info("=" * 80) logger.info("=" * 80)
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(speech_model="u3-rt-pro", min_turn_silence=200)
speech_model="u3-rt-pro", min_turn_silence=200
)
task, transport = await create_basic_voice_agent(connection_params) task, transport = await create_basic_voice_agent(connection_params)
@@ -307,9 +306,7 @@ async def test_diarization_no_format():
logger.info("TEST 10: Diarization Enabled (No Formatting)") logger.info("TEST 10: Diarization Enabled (No Formatting)")
logger.info("=" * 80) logger.info("=" * 80)
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(speech_model="u3-rt-pro", speaker_labels=True)
speech_model="u3-rt-pro", speaker_labels=True
)
task, transport = await create_basic_voice_agent(connection_params) task, transport = await create_basic_voice_agent(connection_params)
@@ -327,9 +324,7 @@ async def test_diarization_xml_format():
logger.info("TEST 11: Diarization with XML Formatting") logger.info("TEST 11: Diarization with XML Formatting")
logger.info("=" * 80) logger.info("=" * 80)
connection_params = AssemblyAIConnectionParams( connection_params = AssemblyAIConnectionParams(speech_model="u3-rt-pro", speaker_labels=True)
speech_model="u3-rt-pro", speaker_labels=True
)
task, transport = await create_basic_voice_agent( task, transport = await create_basic_voice_agent(
connection_params, speaker_format="<{speaker}>{text}</{speaker}>" connection_params, speaker_format="<{speaker}>{text}</{speaker}>"
@@ -516,9 +511,7 @@ def main():
"prompt_keyterms_conflict, keyterms, diarization, diarization_xml, " "prompt_keyterms_conflict, keyterms, diarization, diarization_xml, "
"dynamic_keyterms, dynamic_silence, multi_param, all)", "dynamic_keyterms, dynamic_silence, multi_param, all)",
) )
parser.add_argument( parser.add_argument("--interactive", action="store_true", help="Run in interactive mode")
"--interactive", action="store_true", help="Run in interactive mode"
)
args = parser.parse_args() args = parser.parse_args()