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