Add Krisp API key support and debug logging#3809
Conversation
84e671a to
aeca6de
Compare
…mple 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.
aeca6de to
65f563a
Compare
| ("07n-interruptible-google.py", EVAL_SIMPLE_MATH), | ||
| ("07n-interruptible-google-http.py", EVAL_SIMPLE_MATH), | ||
| ("07o-interruptible-assemblyai.py", EVAL_SIMPLE_MATH), | ||
| ("07p-interruptible-krisp-viva.py", EVAL_SIMPLE_MATH), |
There was a problem hiding this comment.
@aconchillo I can provide the Krisp SDK and model for running release evals.
69c167e to
3bb9b07
Compare
|
|
||
| # Extract metrics from the nested structure | ||
| metrics = result.get("metrics", {}) | ||
| inference_time = metrics.get("inference_time", 0) |
There was a problem hiding this comment.
These fields weren't populated, so removing them along with SmartTurnMetricsData.
a0804c2 to
10ce2d8
Compare
| api_key: Krisp SDK API key. If empty, falls back to | ||
| the KRISP_API_KEY environment variable. |
There was a problem hiding this comment.
@markbackman, is this something new? As far as I remember, we never needed an API key for Krisp before. Is it required now?
If it is required, we should probably update our docs as well:
| key = api_key or os.environ.get("KRISP_API_KEY", "") | ||
| try: | ||
| # New SDK signature (requires license key) | ||
| krisp_audio.globalInit( |
There was a problem hiding this comment.
Even in Krisp’s own documentation, I don’t see an API key being required:
There was a problem hiding this comment.
I know, this isn't well documented, but it is required. You can find it in the SDK ref docs when you download the SDK. The Krisp team confirmed version 1.6.1 and newer require it.
| KRISP_MODEL_PATH=... | ||
|
|
||
| # Krisp Viva | ||
| KRISP_API_KEY=... |
There was a problem hiding this comment.
Should we call it KRISP_VIVA_API_KEY to match the other environment variables?
There was a problem hiding this comment.
Good idea. Yes. I'll do that now.
filipi87
left a comment
There was a problem hiding this comment.
Thanks for confirming with Krisp. LGTM!
The Krisp VIVA SDK v1.8.0 requires a license key in globalInit(). Add api_key parameter to KrispVivaSDKManager, KrispVivaTurn, and KrispVivaFilter with fallback to KRISP_API_KEY env var. Maintain backwards compatibility with older SDK versions by catching TypeError and falling back to the old 3-arg signature.
Introduce a generic TurnMetricsData class for turn detection metrics, replacing the service-specific SmartTurnMetricsData (now deprecated). Add end-to-end processing time measurement to KrispVivaTurn, tracking the interval from VAD speech-to-silence transition to model threshold crossing. Consume metrics in the strategy _handle_input_audio path so they are pushed immediately when fresh.
10ce2d8 to
0ca8c85
Compare
Context
The motivation for this PR is to provide transparency to the metrics data for
KrispVivaTurn. I took the opportunity to also remove dead code fields in theSmartTurnMetricsDataand created a genericTurnMetricsDataclass.While working on that, I found that the new Krisp SDK requires an API key, so I added support for that too, in 3bb9b07.
Summary
TurnMetricsDataas a generic metrics class for turn detection, replacing the service-specificSmartTurnMetricsData.KrispVivaTurnnow emitsTurnMetricsDatawithe2e_processing_time_msmeasuring the interval from VAD speech-to-silence transition to model threshold crossing.BaseSmartTurnnow emitsTurnMetricsDatainstead ofSmartTurnMetricsData. DeprecatedSmartTurnMetricsData(still available as a subclass for backwards compatibility).MetricsLogObservernormalizes deprecatedSmartTurnMetricsDataininclude_metricsfilters and logs all turn metrics via a unified_log_turnhandler._handle_input_audiopath whenappend_audioreturns COMPLETE, so they are pushed immediately while fresh.api_keyparameter toKrispVivaSDKManager,KrispVivaTurn, andKrispVivaFilterfor Krisp SDK v1.8.0 licensing. Falls back toKRISP_VIVA_API_KEYenvironment variable.07p,38b) to useTurnMetricsDataandMetricsLogObserver.Testing
07p-interruptible-krisp-viva.pywithKRISP_VIVA_API_KEYset and verify turn metrics are logged with e2e processing time38b-smart-turn-local.pyand verifyTurnMetricsDatametrics appear in logsinclude_metrics={SmartTurnMetricsData}still works (with deprecation warning)