@absolutejs/voice 0.0.20 → 0.0.22-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +884 -4
- package/dist/angular/index.d.ts +1 -0
- package/dist/angular/index.js +759 -3
- package/dist/angular/voice-controller.service.d.ts +27 -0
- package/dist/angular/voice-stream.service.d.ts +6 -0
- package/dist/audioConditioning.d.ts +3 -0
- package/dist/client/actions.d.ts +48 -0
- package/dist/client/audioPlayer.d.ts +40 -0
- package/dist/client/connection.d.ts +5 -0
- package/dist/client/controller.d.ts +2 -0
- package/dist/client/duplex.d.ts +3 -0
- package/dist/client/htmxBootstrap.js +660 -167
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +991 -6
- package/dist/client/microphone.d.ts +4 -2
- package/dist/correction.d.ts +33 -0
- package/dist/fileStore.d.ts +27 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +3721 -298
- package/dist/ops.d.ts +100 -0
- package/dist/presets.d.ts +13 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +728 -3
- package/dist/react/useVoiceController.d.ts +26 -0
- package/dist/react/useVoiceStream.d.ts +7 -0
- package/dist/routing.d.ts +3 -0
- package/dist/runtimeOps.d.ts +23 -0
- package/dist/store.d.ts +2 -2
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +691 -3
- package/dist/telephony/response.d.ts +7 -0
- package/dist/telephony/twilio.d.ts +116 -0
- package/dist/testing/benchmark.d.ts +93 -2
- package/dist/testing/corrected.d.ts +41 -0
- package/dist/testing/duplex.d.ts +59 -0
- package/dist/testing/fixtures.d.ts +18 -2
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.js +6247 -402
- package/dist/testing/review.d.ts +143 -0
- package/dist/testing/sessionBenchmark.d.ts +92 -2
- package/dist/testing/stt.d.ts +3 -1
- package/dist/testing/telephony.d.ts +70 -0
- package/dist/testing/tts.d.ts +73 -0
- package/dist/turnDetection.d.ts +5 -1
- package/dist/turnProfiles.d.ts +6 -0
- package/dist/types.d.ts +487 -10
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +750 -3
- package/dist/vue/useVoiceController.d.ts +30 -0
- package/dist/vue/useVoiceStream.d.ts +11 -0
- package/fixtures/README.md +9 -0
- package/fixtures/manifest.json +59 -1
- package/fixtures/pcm/dialogue-three-clean.pcm +0 -0
- package/fixtures/pcm/dialogue-three-mixed.pcm +0 -0
- package/fixtures/pcm/dialogue-two-clean.pcm +0 -0
- package/fixtures/pcm/dialogue-two-noisy.pcm +0 -0
- package/package.json +135 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { VoiceCallDisposition, VoiceServerMessage } from '../types';
|
|
2
|
+
type ReviewTimelineSource = 'benchmark' | 'stt' | 'turn' | 'twilio';
|
|
3
|
+
export type VoiceCallReviewTimelineEvent = {
|
|
4
|
+
atMs: number;
|
|
5
|
+
event: string;
|
|
6
|
+
source: ReviewTimelineSource;
|
|
7
|
+
bytes?: number;
|
|
8
|
+
chunkDurationMs?: number;
|
|
9
|
+
chunkIndex?: number;
|
|
10
|
+
confidence?: number;
|
|
11
|
+
name?: string;
|
|
12
|
+
reason?: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
track?: string;
|
|
15
|
+
};
|
|
16
|
+
export type VoiceCallReviewConfig = {
|
|
17
|
+
preset?: string;
|
|
18
|
+
stt?: Record<string, unknown>;
|
|
19
|
+
tts?: Record<string, unknown>;
|
|
20
|
+
turnDetection?: Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
export type VoiceCallReviewPostCallSummary = {
|
|
23
|
+
label: string;
|
|
24
|
+
recommendedAction: string;
|
|
25
|
+
reason?: string;
|
|
26
|
+
summary: string;
|
|
27
|
+
target?: string;
|
|
28
|
+
};
|
|
29
|
+
export type VoiceCallReviewSummary = {
|
|
30
|
+
clearLatencyMs?: number;
|
|
31
|
+
elapsedMs?: number;
|
|
32
|
+
firstOutboundMediaLatencyMs?: number;
|
|
33
|
+
firstTurnLatencyMs?: number;
|
|
34
|
+
markLatencyMs?: number;
|
|
35
|
+
outcome?: VoiceCallDisposition;
|
|
36
|
+
outboundMediaCount?: number;
|
|
37
|
+
pass: boolean;
|
|
38
|
+
termRecall?: number;
|
|
39
|
+
turnCount?: number;
|
|
40
|
+
wordErrorRate?: number;
|
|
41
|
+
};
|
|
42
|
+
export type VoiceCallReviewArtifact = {
|
|
43
|
+
id?: string;
|
|
44
|
+
config?: VoiceCallReviewConfig;
|
|
45
|
+
errors: string[];
|
|
46
|
+
expectedText?: string;
|
|
47
|
+
fixtureId?: string;
|
|
48
|
+
generatedAt?: number;
|
|
49
|
+
latencyBreakdown: Array<{
|
|
50
|
+
label: string;
|
|
51
|
+
valueMs: number;
|
|
52
|
+
}>;
|
|
53
|
+
notes: string[];
|
|
54
|
+
path?: string;
|
|
55
|
+
postCall?: VoiceCallReviewPostCallSummary;
|
|
56
|
+
summary: VoiceCallReviewSummary;
|
|
57
|
+
title: string;
|
|
58
|
+
timeline: VoiceCallReviewTimelineEvent[];
|
|
59
|
+
transcript: {
|
|
60
|
+
actual: string;
|
|
61
|
+
expected?: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type StoredVoiceCallReviewArtifact = VoiceCallReviewArtifact & {
|
|
65
|
+
id: string;
|
|
66
|
+
};
|
|
67
|
+
export type VoiceCallReviewStore<TArtifact extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact> = {
|
|
68
|
+
get: (id: string) => Promise<TArtifact | undefined> | TArtifact | undefined;
|
|
69
|
+
list: () => Promise<TArtifact[]> | TArtifact[];
|
|
70
|
+
remove: (id: string) => Promise<void> | void;
|
|
71
|
+
set: (id: string, artifact: TArtifact) => Promise<void> | void;
|
|
72
|
+
};
|
|
73
|
+
type LiveTelephonyFixture = {
|
|
74
|
+
actualText: string;
|
|
75
|
+
clearLatencyMs?: number;
|
|
76
|
+
elapsedMs?: number;
|
|
77
|
+
errors?: string[];
|
|
78
|
+
expectedText?: string;
|
|
79
|
+
fixtureId?: string;
|
|
80
|
+
firstOutboundMediaLatencyMs?: number;
|
|
81
|
+
firstTurnLatencyMs?: number;
|
|
82
|
+
markLatencyMs?: number;
|
|
83
|
+
outboundMediaCount?: number;
|
|
84
|
+
passes: boolean;
|
|
85
|
+
termRecall?: number;
|
|
86
|
+
title?: string;
|
|
87
|
+
turnCount?: number;
|
|
88
|
+
wordErrorRate?: number;
|
|
89
|
+
};
|
|
90
|
+
type LiveTelephonyTraceEvent = VoiceCallReviewTimelineEvent;
|
|
91
|
+
type LiveTelephonyReviewInput = {
|
|
92
|
+
fixtures?: LiveTelephonyFixture[];
|
|
93
|
+
generatedAt?: number;
|
|
94
|
+
trace?: LiveTelephonyTraceEvent[];
|
|
95
|
+
ttsConfig?: Record<string, unknown>;
|
|
96
|
+
turnDetectionConfig?: Record<string, unknown>;
|
|
97
|
+
variant?: {
|
|
98
|
+
description?: string;
|
|
99
|
+
id?: string;
|
|
100
|
+
model?: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export type VoiceCallReviewRecorderOptions = {
|
|
104
|
+
config?: VoiceCallReviewConfig;
|
|
105
|
+
fixtureId?: string;
|
|
106
|
+
now?: () => number;
|
|
107
|
+
path?: string;
|
|
108
|
+
title?: string;
|
|
109
|
+
};
|
|
110
|
+
export type VoiceCallReviewRecorder = {
|
|
111
|
+
finalize: () => VoiceCallReviewArtifact;
|
|
112
|
+
recordError: (error: unknown) => void;
|
|
113
|
+
recordTwilioInbound: (input: {
|
|
114
|
+
bytes?: number;
|
|
115
|
+
chunkDurationMs?: number;
|
|
116
|
+
event: 'connected' | 'mark' | 'media' | 'start' | 'stop';
|
|
117
|
+
name?: string;
|
|
118
|
+
reason?: string;
|
|
119
|
+
text?: string;
|
|
120
|
+
track?: string;
|
|
121
|
+
}) => void;
|
|
122
|
+
recordTwilioOutbound: (input: {
|
|
123
|
+
bytes?: number;
|
|
124
|
+
chunkDurationMs?: number;
|
|
125
|
+
event: 'clear' | 'mark' | 'media';
|
|
126
|
+
name?: string;
|
|
127
|
+
reason?: string;
|
|
128
|
+
text?: string;
|
|
129
|
+
track?: string;
|
|
130
|
+
}) => void;
|
|
131
|
+
recordVoiceMessage: (message: VoiceServerMessage) => void;
|
|
132
|
+
};
|
|
133
|
+
export declare const withVoiceCallReviewId: <TArtifact extends VoiceCallReviewArtifact = VoiceCallReviewArtifact>(id: string, artifact: TArtifact) => TArtifact & {
|
|
134
|
+
id: string;
|
|
135
|
+
};
|
|
136
|
+
export declare const createVoiceCallReviewFromLiveTelephonyReport: (report: LiveTelephonyReviewInput, options?: {
|
|
137
|
+
path?: string;
|
|
138
|
+
preset?: string;
|
|
139
|
+
}) => VoiceCallReviewArtifact;
|
|
140
|
+
export declare const createVoiceCallReviewRecorder: (options?: VoiceCallReviewRecorderOptions) => VoiceCallReviewRecorder;
|
|
141
|
+
export declare const renderVoiceCallReviewMarkdown: (artifact: VoiceCallReviewArtifact) => string;
|
|
142
|
+
export declare const renderVoiceCallReviewHTML: (artifact: VoiceCallReviewArtifact) => string;
|
|
143
|
+
export {};
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import type { STTAdapter } from '../types';
|
|
1
|
+
import type { STTAdapter, VoiceAudioConditioningConfig, VoicePhraseHint, VoiceSTTFallbackConfig, VoiceSTTLifecycle, VoiceTurnCorrectionHandler, VoiceTurnProfile, VoiceTranscriptQuality } from '../types';
|
|
2
2
|
import { type VoiceTranscriptAccuracy } from './accuracy';
|
|
3
3
|
import type { VoiceTestFixture } from './fixtures';
|
|
4
4
|
export type VoiceSessionBenchmarkScenario = VoiceTestFixture & {
|
|
5
5
|
expectedTurnTexts: string[];
|
|
6
|
+
phraseHints?: VoicePhraseHint[];
|
|
6
7
|
reconnectAtChunkIndex?: number;
|
|
8
|
+
reconnectAtChunkIndices?: number[];
|
|
7
9
|
reconnectPauseMs?: number;
|
|
10
|
+
reconnectPauseMsByIndex?: number[];
|
|
8
11
|
silenceMs?: number;
|
|
9
12
|
speechThreshold?: number;
|
|
13
|
+
transcriptStabilityMs?: number;
|
|
10
14
|
transcriptThreshold?: number;
|
|
15
|
+
turnProfile?: VoiceTurnProfile;
|
|
16
|
+
audioConditioning?: VoiceAudioConditioningConfig;
|
|
17
|
+
sttLifecycle?: VoiceSTTLifecycle;
|
|
18
|
+
};
|
|
19
|
+
export type VoiceSessionBenchmarkTraceEntry = {
|
|
20
|
+
atMs: number;
|
|
21
|
+
data?: unknown;
|
|
22
|
+
phase: string;
|
|
11
23
|
};
|
|
12
24
|
export type VoiceSessionBenchmarkTurnResult = {
|
|
13
25
|
actualText: string;
|
|
@@ -15,27 +27,41 @@ export type VoiceSessionBenchmarkTurnResult = {
|
|
|
15
27
|
expectedText?: string;
|
|
16
28
|
index: number;
|
|
17
29
|
passes: boolean;
|
|
30
|
+
quality?: VoiceTranscriptQuality;
|
|
18
31
|
};
|
|
19
32
|
export type VoiceSessionBenchmarkScenarioResult = {
|
|
20
33
|
actualTurns: string[];
|
|
34
|
+
averageRelativeCostUnits: number;
|
|
21
35
|
duplicateTurnCount: number;
|
|
22
36
|
elapsedMs: number;
|
|
37
|
+
fallbackReplayAudioMs: number;
|
|
38
|
+
expectedReconnectCount: number;
|
|
23
39
|
expectedTurns: string[];
|
|
24
40
|
fixtureId: string;
|
|
41
|
+
primaryAudioMs: number;
|
|
25
42
|
passes: boolean;
|
|
43
|
+
reconnectCount: number;
|
|
26
44
|
reconnectTriggered: boolean;
|
|
27
45
|
tags: string[];
|
|
28
46
|
title: string;
|
|
47
|
+
turnPassRate: number;
|
|
29
48
|
turnCountDelta: number;
|
|
30
49
|
turnResults: VoiceSessionBenchmarkTurnResult[];
|
|
50
|
+
trace?: VoiceSessionBenchmarkTraceEntry[];
|
|
31
51
|
};
|
|
32
52
|
export type VoiceSessionBenchmarkSummary = {
|
|
33
53
|
adapterId: string;
|
|
34
54
|
averageElapsedMs: number;
|
|
55
|
+
averageFallbackReplayAudioMs: number;
|
|
56
|
+
averagePrimaryAudioMs: number;
|
|
57
|
+
averageReconnectCount: number;
|
|
58
|
+
averageRelativeCostUnits: number;
|
|
59
|
+
averageTurnPassRate: number;
|
|
35
60
|
averageWordErrorRate: number;
|
|
36
61
|
duplicateTurnRate: number;
|
|
37
62
|
passCount: number;
|
|
38
63
|
passRate: number;
|
|
64
|
+
reconnectCoverageRate: number;
|
|
39
65
|
reconnectSuccessRate: number;
|
|
40
66
|
scenarioCount: number;
|
|
41
67
|
scenariosWithDuplicateTurns: number;
|
|
@@ -47,15 +73,79 @@ export type VoiceSessionBenchmarkReport = {
|
|
|
47
73
|
scenarios: VoiceSessionBenchmarkScenarioResult[];
|
|
48
74
|
summary: VoiceSessionBenchmarkSummary;
|
|
49
75
|
};
|
|
50
|
-
export
|
|
76
|
+
export type VoiceSessionBenchmarkScenarioAggregate = {
|
|
77
|
+
averageElapsedMs: number;
|
|
78
|
+
averageFallbackReplayAudioMs: number;
|
|
79
|
+
averagePrimaryAudioMs: number;
|
|
80
|
+
averageReconnectCount: number;
|
|
81
|
+
averageRelativeCostUnits: number;
|
|
82
|
+
averageTurnPassRate: number;
|
|
83
|
+
averageWordErrorRate: number;
|
|
84
|
+
bestWordErrorRate: number;
|
|
85
|
+
fixtureId: string;
|
|
86
|
+
passCount: number;
|
|
87
|
+
passRate: number;
|
|
88
|
+
reconnectSuccessRate: number;
|
|
89
|
+
runCount: number;
|
|
90
|
+
tags: string[];
|
|
91
|
+
title: string;
|
|
92
|
+
worstWordErrorRate: number;
|
|
93
|
+
};
|
|
94
|
+
export type VoiceSessionBenchmarkSeriesSummary = {
|
|
95
|
+
adapterId: string;
|
|
96
|
+
averageElapsedMs: number;
|
|
97
|
+
averageFallbackReplayAudioMs: number;
|
|
98
|
+
averagePassRate: number;
|
|
99
|
+
averagePrimaryAudioMs: number;
|
|
100
|
+
averageReconnectCount: number;
|
|
101
|
+
averageRelativeCostUnits: number;
|
|
102
|
+
averageTurnPassRate: number;
|
|
103
|
+
averageWordErrorRate: number;
|
|
104
|
+
flakyScenarioCount: number;
|
|
105
|
+
generatedRunCount: number;
|
|
106
|
+
reconnectCoverageRate: number;
|
|
107
|
+
reconnectSuccessRate: number;
|
|
108
|
+
scenarioCount: number;
|
|
109
|
+
stableScenarioCount: number;
|
|
110
|
+
totalPassCount: number;
|
|
111
|
+
totalRunCount: number;
|
|
112
|
+
};
|
|
113
|
+
export type VoiceSessionBenchmarkSeriesReport = {
|
|
114
|
+
adapterId: string;
|
|
115
|
+
generatedAt: number;
|
|
116
|
+
runCount: number;
|
|
117
|
+
scenarios: VoiceSessionBenchmarkScenarioAggregate[];
|
|
118
|
+
summary: VoiceSessionBenchmarkSeriesSummary;
|
|
119
|
+
};
|
|
120
|
+
export declare const runVoiceSessionBenchmarkScenario: (adapter: STTAdapter, fixture: VoiceSessionBenchmarkScenario, options?: {
|
|
121
|
+
correctTurn?: VoiceTurnCorrectionHandler;
|
|
122
|
+
sttFallback?: VoiceSTTFallbackConfig;
|
|
123
|
+
trace?: boolean;
|
|
124
|
+
}) => Promise<VoiceSessionBenchmarkScenarioResult>;
|
|
51
125
|
export declare const summarizeVoiceSessionBenchmark: (adapterId: string, scenarios: VoiceSessionBenchmarkScenarioResult[]) => VoiceSessionBenchmarkSummary;
|
|
126
|
+
export declare const summarizeVoiceSessionBenchmarkSeries: (input: {
|
|
127
|
+
adapterId: string;
|
|
128
|
+
reports: VoiceSessionBenchmarkReport[];
|
|
129
|
+
}) => VoiceSessionBenchmarkSeriesReport;
|
|
52
130
|
export declare const runVoiceSessionBenchmark: (input: {
|
|
53
131
|
adapter: STTAdapter;
|
|
54
132
|
adapterId: string;
|
|
133
|
+
correctTurn?: VoiceTurnCorrectionHandler;
|
|
55
134
|
scenarios: VoiceSessionBenchmarkScenario[];
|
|
135
|
+
sttFallback?: VoiceSTTFallbackConfig;
|
|
136
|
+
trace?: boolean;
|
|
56
137
|
}) => Promise<{
|
|
57
138
|
adapterId: string;
|
|
58
139
|
generatedAt: number;
|
|
59
140
|
scenarios: VoiceSessionBenchmarkScenarioResult[];
|
|
60
141
|
summary: VoiceSessionBenchmarkSummary;
|
|
61
142
|
}>;
|
|
143
|
+
export declare const runVoiceSessionBenchmarkSeries: (input: {
|
|
144
|
+
adapter: STTAdapter;
|
|
145
|
+
adapterId: string;
|
|
146
|
+
correctTurn?: VoiceTurnCorrectionHandler;
|
|
147
|
+
runs: number;
|
|
148
|
+
scenarios: VoiceSessionBenchmarkScenario[];
|
|
149
|
+
sttFallback?: VoiceSTTFallbackConfig;
|
|
150
|
+
trace?: boolean;
|
|
151
|
+
}) => Promise<VoiceSessionBenchmarkSeriesReport>;
|
package/dist/testing/stt.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type VoiceTranscriptAccuracy } from './accuracy';
|
|
2
|
-
import type { STTAdapter, VoiceCloseEvent, VoiceEndOfTurnEvent, VoiceErrorEvent, VoiceFinalEvent, VoicePartialEvent } from '../types';
|
|
2
|
+
import type { STTAdapter, STTAdapterOpenOptions, VoiceCloseEvent, VoiceEndOfTurnEvent, VoiceErrorEvent, VoiceFinalEvent, VoicePartialEvent } from '../types';
|
|
3
3
|
import type { VoiceTestFixture } from './fixtures';
|
|
4
4
|
export type VoiceSTTAdapterHarnessOptions = {
|
|
5
5
|
chunkDurationMs?: number;
|
|
6
6
|
idleTimeoutMs?: number;
|
|
7
|
+
openOptions?: Partial<STTAdapterOpenOptions> | ((fixture: VoiceTestFixture) => Partial<STTAdapterOpenOptions> | undefined);
|
|
7
8
|
settleMs?: number;
|
|
8
9
|
tailPaddingMs?: number;
|
|
9
10
|
transcriptThreshold?: number;
|
|
@@ -17,6 +18,7 @@ export type VoiceSTTAdapterHarnessResult = {
|
|
|
17
18
|
finalEvents: VoiceFinalEvent[];
|
|
18
19
|
finalText: string;
|
|
19
20
|
partialEvents: VoicePartialEvent[];
|
|
21
|
+
speechEndedAt: number;
|
|
20
22
|
startedAt: number;
|
|
21
23
|
};
|
|
22
24
|
export declare const runSTTAdapterFixture: (adapter: STTAdapter, fixture: VoiceTestFixture, options?: VoiceSTTAdapterHarnessOptions) => Promise<VoiceSTTAdapterHarnessResult>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type VoiceTelephonyBenchmarkScenario = {
|
|
2
|
+
expectClear: boolean;
|
|
3
|
+
expectMark: boolean;
|
|
4
|
+
expectOutboundMedia: boolean;
|
|
5
|
+
id: string;
|
|
6
|
+
secondInboundDelayMs?: number;
|
|
7
|
+
sttDelayMs?: number;
|
|
8
|
+
title: string;
|
|
9
|
+
ttsChunkCount?: number;
|
|
10
|
+
ttsChunkDelayMs?: number;
|
|
11
|
+
};
|
|
12
|
+
export type VoiceTelephonyBenchmarkScenarioResult = {
|
|
13
|
+
clearCount: number;
|
|
14
|
+
clearLatencyMs?: number;
|
|
15
|
+
elapsedMs: number;
|
|
16
|
+
expectClear: boolean;
|
|
17
|
+
expectMark: boolean;
|
|
18
|
+
expectOutboundMedia: boolean;
|
|
19
|
+
fixtureId: string;
|
|
20
|
+
firstOutboundMediaLatencyMs?: number;
|
|
21
|
+
markCount: number;
|
|
22
|
+
markLatencyMs?: number;
|
|
23
|
+
outboundMediaCount: number;
|
|
24
|
+
passes: boolean;
|
|
25
|
+
receivedAudioBytes: number;
|
|
26
|
+
title: string;
|
|
27
|
+
};
|
|
28
|
+
export type VoiceTelephonyBenchmarkSummary = {
|
|
29
|
+
averageClearLatencyMs?: number;
|
|
30
|
+
averageElapsedMs: number;
|
|
31
|
+
averageFirstOutboundMediaLatencyMs?: number;
|
|
32
|
+
averageMarkLatencyMs?: number;
|
|
33
|
+
passCount: number;
|
|
34
|
+
passRate: number;
|
|
35
|
+
scenarioCount: number;
|
|
36
|
+
totalOutboundMediaCount: number;
|
|
37
|
+
};
|
|
38
|
+
export type VoiceTelephonyBenchmarkReport = {
|
|
39
|
+
fixtures: VoiceTelephonyBenchmarkScenarioResult[];
|
|
40
|
+
generatedAt: number;
|
|
41
|
+
summary: VoiceTelephonyBenchmarkSummary;
|
|
42
|
+
};
|
|
43
|
+
type VoiceTelephonyBenchmarkOptions = {
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
};
|
|
46
|
+
export declare const getDefaultVoiceTelephonyBenchmarkScenarios: () => {
|
|
47
|
+
expectClear: boolean;
|
|
48
|
+
expectMark: boolean;
|
|
49
|
+
expectOutboundMedia: boolean;
|
|
50
|
+
id: string;
|
|
51
|
+
secondInboundDelayMs?: number;
|
|
52
|
+
sttDelayMs?: number;
|
|
53
|
+
title: string;
|
|
54
|
+
ttsChunkCount?: number;
|
|
55
|
+
ttsChunkDelayMs?: number;
|
|
56
|
+
}[];
|
|
57
|
+
export declare const runVoiceTelephonyBenchmarkScenario: (scenario: VoiceTelephonyBenchmarkScenario, options?: VoiceTelephonyBenchmarkOptions) => Promise<VoiceTelephonyBenchmarkScenarioResult>;
|
|
58
|
+
export declare const summarizeVoiceTelephonyBenchmark: (fixtures: VoiceTelephonyBenchmarkScenarioResult[]) => VoiceTelephonyBenchmarkSummary;
|
|
59
|
+
export declare const runVoiceTelephonyBenchmark: (scenarios?: {
|
|
60
|
+
expectClear: boolean;
|
|
61
|
+
expectMark: boolean;
|
|
62
|
+
expectOutboundMedia: boolean;
|
|
63
|
+
id: string;
|
|
64
|
+
secondInboundDelayMs?: number;
|
|
65
|
+
sttDelayMs?: number;
|
|
66
|
+
title: string;
|
|
67
|
+
ttsChunkCount?: number;
|
|
68
|
+
ttsChunkDelayMs?: number;
|
|
69
|
+
}[], options?: VoiceTelephonyBenchmarkOptions) => Promise<VoiceTelephonyBenchmarkReport>;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AudioFormat, RealtimeAdapter, RealtimeAdapterOpenOptions, TTSAdapter, TTSAdapterOpenOptions } from '../types';
|
|
2
|
+
export type VoiceTTSBenchmarkFixture = {
|
|
3
|
+
id: string;
|
|
4
|
+
tags?: string[];
|
|
5
|
+
text: string;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
export type VoiceTTSBenchmarkFixtureResult = {
|
|
9
|
+
audioChunkCount: number;
|
|
10
|
+
audioDurationMs: number;
|
|
11
|
+
audioFormat?: AudioFormat;
|
|
12
|
+
closeCount: number;
|
|
13
|
+
elapsedMs: number;
|
|
14
|
+
errorCount: number;
|
|
15
|
+
fixtureId: string;
|
|
16
|
+
firstAudioLatencyMs?: number;
|
|
17
|
+
interruptionLatencyMs?: number;
|
|
18
|
+
interruptionRequestedAtMs?: number;
|
|
19
|
+
passes: boolean;
|
|
20
|
+
postInterruptAudioBytes?: number;
|
|
21
|
+
preInterruptAudioBytes?: number;
|
|
22
|
+
tags: string[];
|
|
23
|
+
textLength: number;
|
|
24
|
+
title: string;
|
|
25
|
+
totalAudioBytes: number;
|
|
26
|
+
};
|
|
27
|
+
export type VoiceTTSBenchmarkSummary = {
|
|
28
|
+
adapterId: string;
|
|
29
|
+
averageAudioChunkCount: number;
|
|
30
|
+
averageAudioDurationMs: number;
|
|
31
|
+
averageElapsedMs: number;
|
|
32
|
+
averageFirstAudioLatencyMs?: number;
|
|
33
|
+
averageInterruptionLatencyMs?: number;
|
|
34
|
+
averageTextLength: number;
|
|
35
|
+
fixtureCount: number;
|
|
36
|
+
passCount: number;
|
|
37
|
+
passRate: number;
|
|
38
|
+
totalAudioBytes: number;
|
|
39
|
+
totalErrorCount: number;
|
|
40
|
+
};
|
|
41
|
+
export type VoiceTTSBenchmarkReport = {
|
|
42
|
+
adapterId: string;
|
|
43
|
+
fixtures: VoiceTTSBenchmarkFixtureResult[];
|
|
44
|
+
generatedAt: number;
|
|
45
|
+
profileId?: string;
|
|
46
|
+
summary: VoiceTTSBenchmarkSummary;
|
|
47
|
+
};
|
|
48
|
+
export type VoiceTTSBenchmarkOptions = {
|
|
49
|
+
idleTimeoutMs?: number;
|
|
50
|
+
interruptAfterFirstAudioMs?: number;
|
|
51
|
+
minAudioBytes?: number;
|
|
52
|
+
openOptions?: Partial<TTSAdapterOpenOptions & RealtimeAdapterOpenOptions> | ((fixture: VoiceTTSBenchmarkFixture) => Partial<TTSAdapterOpenOptions & RealtimeAdapterOpenOptions> | undefined);
|
|
53
|
+
realtimeFormat?: AudioFormat;
|
|
54
|
+
settleMs?: number;
|
|
55
|
+
waitForFirstAudioMs?: number;
|
|
56
|
+
waitForCloseAfterInterruptMs?: number;
|
|
57
|
+
};
|
|
58
|
+
type VoiceOutputAdapter = TTSAdapter | RealtimeAdapter;
|
|
59
|
+
export declare const getDefaultTTSBenchmarkFixtures: () => {
|
|
60
|
+
id: string;
|
|
61
|
+
tags?: string[];
|
|
62
|
+
text: string;
|
|
63
|
+
title: string;
|
|
64
|
+
}[];
|
|
65
|
+
export declare const runTTSAdapterFixture: (adapter: VoiceOutputAdapter, fixture: VoiceTTSBenchmarkFixture, options?: VoiceTTSBenchmarkOptions) => Promise<VoiceTTSBenchmarkFixtureResult>;
|
|
66
|
+
export declare const runTTSAdapterBenchmark: (adapterId: string, adapter: VoiceOutputAdapter, fixtures?: {
|
|
67
|
+
id: string;
|
|
68
|
+
tags?: string[];
|
|
69
|
+
text: string;
|
|
70
|
+
title: string;
|
|
71
|
+
}[], options?: VoiceTTSBenchmarkOptions) => Promise<VoiceTTSBenchmarkReport>;
|
|
72
|
+
export declare const summarizeTTSBenchmark: (adapterId: string, fixtures: VoiceTTSBenchmarkFixtureResult[]) => VoiceTTSBenchmarkSummary;
|
|
73
|
+
export {};
|
package/dist/turnDetection.d.ts
CHANGED
|
@@ -2,4 +2,8 @@ import type { AudioChunk, Transcript } from './types';
|
|
|
2
2
|
export declare const DEFAULT_SILENCE_MS = 700;
|
|
3
3
|
export declare const DEFAULT_SPEECH_THRESHOLD = 0.015;
|
|
4
4
|
export declare const measureAudioLevel: (audio: AudioChunk) => number;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const selectPreferredTranscriptText: (currentText: string, nextText: string) => string;
|
|
6
|
+
export declare const buildTurnText: (transcripts: Transcript[], partialText: string, options?: {
|
|
7
|
+
partialEndedAtMs?: number;
|
|
8
|
+
partialStartedAtMs?: number;
|
|
9
|
+
}) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VoiceResolvedTurnDetectionConfig, VoiceTurnDetectionConfig, VoiceTurnQualityProfile, VoiceTurnProfile } from './types';
|
|
2
|
+
export declare const TURN_PROFILE_DEFAULTS: Record<VoiceTurnProfile, Omit<VoiceResolvedTurnDetectionConfig, 'profile'>>;
|
|
3
|
+
export declare const QUALITY_PROFILE_DEFAULTS: Record<VoiceTurnQualityProfile, Partial<VoiceResolvedTurnDetectionConfig>>;
|
|
4
|
+
export declare const DEFAULT_TURN_PROFILE: VoiceTurnProfile;
|
|
5
|
+
export declare const DEFAULT_QUALITY_PROFILE: VoiceTurnQualityProfile;
|
|
6
|
+
export declare const resolveTurnDetectionConfig: (config?: VoiceTurnDetectionConfig) => VoiceResolvedTurnDetectionConfig;
|