Add debug logging to KrispVivaTurn analyze_end_of_turn and update example
Move speech detection tracking outside the per-frame loop in append_audio since is_speech applies to the whole buffer. Add debug log in analyze_end_of_turn to show state and probability at decision time. Update the Krisp VIVA example to use Cartesia TTS and turn analyzer strategy.
This commit is contained in:
1
changelog/3809.changed.md
Normal file
1
changelog/3809.changed.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Added debug logging to `KrispVivaTurn.analyze_end_of_turn()` to log turn state and probability at decision time.
|
||||||
@@ -41,12 +41,14 @@ from pipecat.processors.aggregators.llm_response_universal import (
|
|||||||
)
|
)
|
||||||
from pipecat.runner.types import RunnerArguments
|
from pipecat.runner.types import RunnerArguments
|
||||||
from pipecat.runner.utils import create_transport
|
from pipecat.runner.utils import create_transport
|
||||||
|
from pipecat.services.cartesia.tts import CartesiaTTSService
|
||||||
from pipecat.services.deepgram.stt import DeepgramSTTService
|
from pipecat.services.deepgram.stt import DeepgramSTTService
|
||||||
from pipecat.services.deepgram.tts import DeepgramTTSService
|
|
||||||
from pipecat.services.openai.llm import OpenAILLMService
|
from pipecat.services.openai.llm import OpenAILLMService
|
||||||
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
||||||
from pipecat.transports.daily.transport import DailyParams
|
from pipecat.transports.daily.transport import DailyParams
|
||||||
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams
|
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams
|
||||||
|
from pipecat.turns.user_stop import TurnAnalyzerUserTurnStopStrategy
|
||||||
|
from pipecat.turns.user_turn_strategies import UserTurnStrategies
|
||||||
|
|
||||||
load_dotenv(override=True)
|
load_dotenv(override=True)
|
||||||
|
|
||||||
@@ -76,7 +78,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
|||||||
|
|
||||||
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
|
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
|
||||||
|
|
||||||
tts = DeepgramTTSService(api_key=os.getenv("DEEPGRAM_API_KEY"), voice="aura-helios-en")
|
tts = CartesiaTTSService(
|
||||||
|
api_key=os.getenv("CARTESIA_API_KEY"), voice_id="71a7ad14-091c-4e8e-a314-022ece01c121"
|
||||||
|
)
|
||||||
|
|
||||||
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"))
|
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"))
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ TESTS_07 = [
|
|||||||
("07n-interruptible-google.py", EVAL_SIMPLE_MATH),
|
("07n-interruptible-google.py", EVAL_SIMPLE_MATH),
|
||||||
("07n-interruptible-google-http.py", EVAL_SIMPLE_MATH),
|
("07n-interruptible-google-http.py", EVAL_SIMPLE_MATH),
|
||||||
("07o-interruptible-assemblyai.py", EVAL_SIMPLE_MATH),
|
("07o-interruptible-assemblyai.py", EVAL_SIMPLE_MATH),
|
||||||
|
("07p-interruptible-krisp-viva.py", EVAL_SIMPLE_MATH),
|
||||||
("07q-interruptible-rime.py", EVAL_SIMPLE_MATH),
|
("07q-interruptible-rime.py", EVAL_SIMPLE_MATH),
|
||||||
("07q-interruptible-rime-http.py", EVAL_SIMPLE_MATH),
|
("07q-interruptible-rime-http.py", EVAL_SIMPLE_MATH),
|
||||||
("07r-interruptible-nvidia.py", EVAL_SIMPLE_MATH),
|
("07r-interruptible-nvidia.py", EVAL_SIMPLE_MATH),
|
||||||
@@ -148,8 +149,6 @@ TESTS_07 = [
|
|||||||
("07zj-interruptible-kokoro.py", EVAL_SIMPLE_MATH),
|
("07zj-interruptible-kokoro.py", EVAL_SIMPLE_MATH),
|
||||||
# Needs a local XTTS docker instance running.
|
# Needs a local XTTS docker instance running.
|
||||||
# ("07i-interruptible-xtts.py", EVAL_SIMPLE_MATH),
|
# ("07i-interruptible-xtts.py", EVAL_SIMPLE_MATH),
|
||||||
# Needs a Krisp license.
|
|
||||||
# ("07p-interruptible-krisp.py", EVAL_SIMPLE_MATH),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
TESTS_12 = [
|
TESTS_12 = [
|
||||||
|
|||||||
@@ -331,6 +331,9 @@ class KrispVivaTurn(BaseTurnAnalyzer):
|
|||||||
"""
|
"""
|
||||||
# For real-time processing, the state is determined in append_audio
|
# For real-time processing, the state is determined in append_audio
|
||||||
# Return the last state that was computed
|
# Return the last state that was computed
|
||||||
|
logger.debug(
|
||||||
|
f"Krisp turn analysis: state={self._last_state}, probability={self._last_probability}"
|
||||||
|
)
|
||||||
return self._last_state, None
|
return self._last_state, None
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user