@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,7 @@
|
|
|
1
|
+
export type TelephonyResponseShapeMode = 'full' | 'lead-clause';
|
|
2
|
+
export type TelephonyResponseShapeOptions = {
|
|
3
|
+
mode?: TelephonyResponseShapeMode;
|
|
4
|
+
maxChars?: number;
|
|
5
|
+
maxWords?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const shapeTelephonyAssistantText: (text: string, options?: TelephonyResponseShapeOptions) => string;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type VoiceCallReviewArtifact, type VoiceCallReviewConfig } from '../testing/review';
|
|
2
|
+
import type { AudioFormat, VoiceLogger, VoicePluginConfig, VoiceSessionRecord, VoiceServerMessage } from '../types';
|
|
3
|
+
type TwilioMediaPayload = {
|
|
4
|
+
chunk?: string;
|
|
5
|
+
payload: string;
|
|
6
|
+
timestamp?: string;
|
|
7
|
+
track?: 'inbound' | 'outbound';
|
|
8
|
+
};
|
|
9
|
+
type TwilioConnectedMessage = {
|
|
10
|
+
event: 'connected';
|
|
11
|
+
protocol?: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
};
|
|
14
|
+
type TwilioStartMessage = {
|
|
15
|
+
event: 'start';
|
|
16
|
+
sequenceNumber?: string;
|
|
17
|
+
start: {
|
|
18
|
+
accountSid?: string;
|
|
19
|
+
callSid?: string;
|
|
20
|
+
customParameters?: Record<string, string>;
|
|
21
|
+
mediaFormat?: {
|
|
22
|
+
channels?: number;
|
|
23
|
+
encoding?: string;
|
|
24
|
+
sampleRate?: number;
|
|
25
|
+
};
|
|
26
|
+
streamSid: string;
|
|
27
|
+
track?: string;
|
|
28
|
+
};
|
|
29
|
+
streamSid?: string;
|
|
30
|
+
};
|
|
31
|
+
type TwilioMediaMessage = {
|
|
32
|
+
event: 'media';
|
|
33
|
+
media: TwilioMediaPayload;
|
|
34
|
+
sequenceNumber?: string;
|
|
35
|
+
streamSid: string;
|
|
36
|
+
};
|
|
37
|
+
type TwilioMarkMessage = {
|
|
38
|
+
event: 'mark';
|
|
39
|
+
mark?: {
|
|
40
|
+
name?: string;
|
|
41
|
+
};
|
|
42
|
+
sequenceNumber?: string;
|
|
43
|
+
streamSid: string;
|
|
44
|
+
};
|
|
45
|
+
type TwilioStopMessage = {
|
|
46
|
+
event: 'stop';
|
|
47
|
+
sequenceNumber?: string;
|
|
48
|
+
stop?: {
|
|
49
|
+
accountSid?: string;
|
|
50
|
+
callSid?: string;
|
|
51
|
+
};
|
|
52
|
+
streamSid: string;
|
|
53
|
+
};
|
|
54
|
+
export type TwilioInboundMessage = TwilioConnectedMessage | TwilioStartMessage | TwilioMediaMessage | TwilioMarkMessage | TwilioStopMessage;
|
|
55
|
+
export type TwilioOutboundMediaMessage = {
|
|
56
|
+
event: 'media';
|
|
57
|
+
media: {
|
|
58
|
+
payload: string;
|
|
59
|
+
};
|
|
60
|
+
streamSid: string;
|
|
61
|
+
};
|
|
62
|
+
export type TwilioOutboundClearMessage = {
|
|
63
|
+
event: 'clear';
|
|
64
|
+
streamSid: string;
|
|
65
|
+
};
|
|
66
|
+
export type TwilioOutboundMarkMessage = {
|
|
67
|
+
event: 'mark';
|
|
68
|
+
mark: {
|
|
69
|
+
name: string;
|
|
70
|
+
};
|
|
71
|
+
streamSid: string;
|
|
72
|
+
};
|
|
73
|
+
export type TwilioOutboundMessage = TwilioOutboundMediaMessage | TwilioOutboundClearMessage | TwilioOutboundMarkMessage;
|
|
74
|
+
export type TwilioMediaStreamSocket = {
|
|
75
|
+
close: (code?: number, reason?: string) => void | Promise<void>;
|
|
76
|
+
send: (data: string) => void | Promise<void>;
|
|
77
|
+
};
|
|
78
|
+
export type TwilioMediaStreamBridgeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoicePluginConfig<TContext, TSession, TResult>, 'htmx' | 'path'> & {
|
|
79
|
+
clearOnInboundMedia?: boolean;
|
|
80
|
+
context: TContext;
|
|
81
|
+
logger?: VoiceLogger;
|
|
82
|
+
onVoiceMessage?: (input: {
|
|
83
|
+
callSid?: string;
|
|
84
|
+
message: VoiceServerMessage<TResult>;
|
|
85
|
+
sessionId: string;
|
|
86
|
+
streamSid?: string;
|
|
87
|
+
}) => Promise<void> | void;
|
|
88
|
+
review?: {
|
|
89
|
+
config?: VoiceCallReviewConfig;
|
|
90
|
+
fixtureId?: string;
|
|
91
|
+
onArtifact?: (artifact: VoiceCallReviewArtifact) => Promise<void> | void;
|
|
92
|
+
path?: string;
|
|
93
|
+
title?: string;
|
|
94
|
+
};
|
|
95
|
+
scenarioId?: string;
|
|
96
|
+
sessionId?: string;
|
|
97
|
+
};
|
|
98
|
+
export type TwilioMediaStreamBridge = {
|
|
99
|
+
close: (reason?: string) => Promise<void>;
|
|
100
|
+
getSessionId: () => string | null;
|
|
101
|
+
getStreamSid: () => string | null;
|
|
102
|
+
handleMessage: (raw: string | TwilioInboundMessage) => Promise<void>;
|
|
103
|
+
};
|
|
104
|
+
export type TwilioVoiceResponseOptions = {
|
|
105
|
+
parameters?: Record<string, string | number | boolean | undefined>;
|
|
106
|
+
streamName?: string;
|
|
107
|
+
streamUrl: string;
|
|
108
|
+
track?: 'both_tracks' | 'inbound_track' | 'outbound_track';
|
|
109
|
+
};
|
|
110
|
+
export declare const decodeTwilioMulawBase64: (payload: string) => Int16Array<ArrayBuffer>;
|
|
111
|
+
export declare const encodeTwilioMulawBase64: (samples: Int16Array) => string;
|
|
112
|
+
export declare const transcodeTwilioInboundPayloadToPCM16: (payload: string) => Uint8Array<ArrayBuffer>;
|
|
113
|
+
export declare const transcodePCMToTwilioOutboundPayload: (chunk: Uint8Array, format: AudioFormat) => string;
|
|
114
|
+
export declare const createTwilioVoiceResponse: (options: TwilioVoiceResponseOptions) => string;
|
|
115
|
+
export declare const createTwilioMediaStreamBridge: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(socket: TwilioMediaStreamSocket, options: TwilioMediaStreamBridgeOptions<TContext, TSession, TResult>) => TwilioMediaStreamBridge;
|
|
116
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { STTAdapter } from '../types';
|
|
1
|
+
import type { STTAdapter, STTAdapterOpenOptions } from '../types';
|
|
2
2
|
import { type VoiceSTTAdapterHarnessOptions, type VoiceSTTAdapterHarnessResult } from './stt';
|
|
3
3
|
import type { VoiceTestFixture } from './fixtures';
|
|
4
4
|
export type VoiceExpectedTermAccuracy = {
|
|
@@ -8,6 +8,15 @@ export type VoiceExpectedTermAccuracy = {
|
|
|
8
8
|
missingTerms: string[];
|
|
9
9
|
recall: number;
|
|
10
10
|
};
|
|
11
|
+
export type VoiceSTTFixtureEnvironment = 'accent' | 'accent-noisy' | 'clean' | 'code-switch' | 'jargon' | 'multilingual' | 'multi-speaker' | 'noisy' | 'telephony' | 'other';
|
|
12
|
+
export type VoiceSpeakerTurnAccuracy = {
|
|
13
|
+
available: boolean;
|
|
14
|
+
actualTurnCount: number;
|
|
15
|
+
expectedTurnCount: number;
|
|
16
|
+
passes: boolean;
|
|
17
|
+
patternMatchRate: number;
|
|
18
|
+
postClustered?: boolean;
|
|
19
|
+
};
|
|
11
20
|
export type VoiceSTTBenchmarkFixtureResult = {
|
|
12
21
|
accuracy: VoiceSTTAdapterHarnessResult['accuracy'];
|
|
13
22
|
closeCount: number;
|
|
@@ -20,8 +29,12 @@ export type VoiceSTTBenchmarkFixtureResult = {
|
|
|
20
29
|
finalText: string;
|
|
21
30
|
fixtureId: string;
|
|
22
31
|
fragmentationCount: number;
|
|
32
|
+
group: VoiceSTTFixtureEnvironment;
|
|
23
33
|
passes: boolean;
|
|
24
34
|
partialCount: number;
|
|
35
|
+
speakerTurns?: VoiceSpeakerTurnAccuracy;
|
|
36
|
+
postSpeechTimeToEndOfTurnMs?: number;
|
|
37
|
+
postSpeechTimeToFirstFinalMs?: number;
|
|
25
38
|
tags: string[];
|
|
26
39
|
timeToEndOfTurnMs?: number;
|
|
27
40
|
timeToFirstFinalMs?: number;
|
|
@@ -34,7 +47,10 @@ export type VoiceSTTBenchmarkSummary = {
|
|
|
34
47
|
averageElapsedMs: number;
|
|
35
48
|
averageEndOfTurnCount: number;
|
|
36
49
|
averageFinalCount: number;
|
|
50
|
+
averageSpeakerTurnMatchRate?: number;
|
|
37
51
|
averageTermRecall: number;
|
|
52
|
+
averagePostSpeechTimeToEndOfTurnMs?: number;
|
|
53
|
+
averagePostSpeechTimeToFirstFinalMs?: number;
|
|
38
54
|
averageTimeToEndOfTurnMs?: number;
|
|
39
55
|
averageTimeToFirstFinalMs?: number;
|
|
40
56
|
averageTimeToFirstPartialMs?: number;
|
|
@@ -46,6 +62,20 @@ export type VoiceSTTBenchmarkSummary = {
|
|
|
46
62
|
passRate: number;
|
|
47
63
|
totalErrorCount: number;
|
|
48
64
|
wordAccuracyRate: number;
|
|
65
|
+
groupSummaries: VoiceSTTBenchmarkFixtureSummary[];
|
|
66
|
+
};
|
|
67
|
+
export type VoiceSTTBenchmarkFixtureSummary = {
|
|
68
|
+
group: VoiceSTTFixtureEnvironment;
|
|
69
|
+
fixtureCount: number;
|
|
70
|
+
fixturesWithErrors: number;
|
|
71
|
+
fixturesWithFragments: number;
|
|
72
|
+
passCount: number;
|
|
73
|
+
passRate: number;
|
|
74
|
+
wordAccuracyRate: number;
|
|
75
|
+
averageTermRecall: number;
|
|
76
|
+
averageSpeakerTurnMatchRate?: number;
|
|
77
|
+
averageWordErrorRate: number;
|
|
78
|
+
averageElapsedMs: number;
|
|
49
79
|
};
|
|
50
80
|
export type VoiceSTTBenchmarkReport = {
|
|
51
81
|
adapterId: string;
|
|
@@ -53,6 +83,38 @@ export type VoiceSTTBenchmarkReport = {
|
|
|
53
83
|
generatedAt: number;
|
|
54
84
|
summary: VoiceSTTBenchmarkSummary;
|
|
55
85
|
};
|
|
86
|
+
export type VoiceSTTBenchmarkFixtureAggregate = {
|
|
87
|
+
averageElapsedMs: number;
|
|
88
|
+
averagePassRate: number;
|
|
89
|
+
averageWordErrorRate: number;
|
|
90
|
+
bestWordErrorRate: number;
|
|
91
|
+
fixtureId: string;
|
|
92
|
+
group: VoiceSTTFixtureEnvironment;
|
|
93
|
+
passCount: number;
|
|
94
|
+
runCount: number;
|
|
95
|
+
tags: string[];
|
|
96
|
+
title: string;
|
|
97
|
+
worstWordErrorRate: number;
|
|
98
|
+
};
|
|
99
|
+
export type VoiceSTTBenchmarkSeriesSummary = {
|
|
100
|
+
adapterId: string;
|
|
101
|
+
averageElapsedMs: number;
|
|
102
|
+
averagePassRate: number;
|
|
103
|
+
averageWordErrorRate: number;
|
|
104
|
+
fixtureCount: number;
|
|
105
|
+
flakyFixtureCount: number;
|
|
106
|
+
generatedRunCount: number;
|
|
107
|
+
stableFixtureCount: number;
|
|
108
|
+
totalPassCount: number;
|
|
109
|
+
totalRunCount: number;
|
|
110
|
+
};
|
|
111
|
+
export type VoiceSTTBenchmarkSeriesReport = {
|
|
112
|
+
adapterId: string;
|
|
113
|
+
fixtures: VoiceSTTBenchmarkFixtureAggregate[];
|
|
114
|
+
generatedAt: number;
|
|
115
|
+
runCount: number;
|
|
116
|
+
summary: VoiceSTTBenchmarkSeriesSummary;
|
|
117
|
+
};
|
|
56
118
|
export type VoiceSTTBenchmarkComparisonEntry = {
|
|
57
119
|
adapterId: string;
|
|
58
120
|
summary: VoiceSTTBenchmarkSummary;
|
|
@@ -63,10 +125,28 @@ export type VoiceSTTBenchmarkComparison = {
|
|
|
63
125
|
bestByWordErrorRate?: VoiceSTTBenchmarkComparisonEntry;
|
|
64
126
|
entries: VoiceSTTBenchmarkComparisonEntry[];
|
|
65
127
|
};
|
|
128
|
+
export type VoiceSTTBenchmarkAcceptanceThresholds = {
|
|
129
|
+
termRecall?: number;
|
|
130
|
+
wordAccuracyRate?: number;
|
|
131
|
+
overallPassRate?: number;
|
|
132
|
+
groupPassRate?: Partial<Record<VoiceSTTFixtureEnvironment, {
|
|
133
|
+
passRate?: number;
|
|
134
|
+
wordAccuracyRate?: number;
|
|
135
|
+
}>>;
|
|
136
|
+
};
|
|
137
|
+
export type VoiceSTTBenchmarkAcceptanceResult = {
|
|
138
|
+
adapterId: string;
|
|
139
|
+
failures: string[];
|
|
140
|
+
passed: boolean;
|
|
141
|
+
score: number;
|
|
142
|
+
};
|
|
66
143
|
export type VoiceSTTBenchmarkOptions = VoiceSTTAdapterHarnessOptions & {
|
|
67
|
-
fixtureOptions?: Record<string, Omit<VoiceSTTAdapterHarnessOptions, 'fixtureOptions'>>;
|
|
144
|
+
fixtureOptions?: Record<string, Omit<VoiceSTTAdapterHarnessOptions, 'fixtureOptions' | 'openOptions'>>;
|
|
145
|
+
openOptions?: Partial<STTAdapterOpenOptions> | ((fixture: VoiceTestFixture) => Partial<STTAdapterOpenOptions> | undefined);
|
|
68
146
|
};
|
|
147
|
+
export declare const resolveFixtureEnvironment: (fixture: Pick<VoiceTestFixture, "language" | "tags">) => VoiceSTTFixtureEnvironment;
|
|
69
148
|
export declare const summarizeSTTBenchmark: (adapterId: string, fixtures: VoiceSTTBenchmarkFixtureResult[]) => VoiceSTTBenchmarkSummary;
|
|
149
|
+
export declare const evaluateSTTBenchmarkAcceptance: (report: VoiceSTTBenchmarkReport, thresholds?: VoiceSTTBenchmarkAcceptanceThresholds) => VoiceSTTBenchmarkAcceptanceResult;
|
|
70
150
|
export declare const compareSTTBenchmarks: (reports: VoiceSTTBenchmarkReport[]) => VoiceSTTBenchmarkComparison;
|
|
71
151
|
export declare const runSTTAdapterBenchmark: ({ adapter, adapterId, fixtures, options }: {
|
|
72
152
|
adapter: STTAdapter;
|
|
@@ -74,3 +154,14 @@ export declare const runSTTAdapterBenchmark: ({ adapter, adapterId, fixtures, op
|
|
|
74
154
|
fixtures: VoiceTestFixture[];
|
|
75
155
|
options?: VoiceSTTBenchmarkOptions;
|
|
76
156
|
}) => Promise<VoiceSTTBenchmarkReport>;
|
|
157
|
+
export declare const summarizeSTTBenchmarkSeries: (input: {
|
|
158
|
+
adapterId: string;
|
|
159
|
+
reports: VoiceSTTBenchmarkReport[];
|
|
160
|
+
}) => VoiceSTTBenchmarkSeriesReport;
|
|
161
|
+
export declare const runSTTAdapterBenchmarkSeries: ({ adapter, adapterId, fixtures, options, runs }: {
|
|
162
|
+
adapter: STTAdapter;
|
|
163
|
+
adapterId: string;
|
|
164
|
+
fixtures: VoiceTestFixture[];
|
|
165
|
+
options?: VoiceSTTBenchmarkOptions;
|
|
166
|
+
runs: number;
|
|
167
|
+
}) => Promise<VoiceSTTBenchmarkSeriesReport>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { VoiceLexiconEntry, VoicePhraseHint, VoiceTurnCorrectionHandler } from '../types';
|
|
2
|
+
import { type VoiceExpectedTermAccuracy, type VoiceSTTBenchmarkReport } from './benchmark';
|
|
3
|
+
import type { VoiceSessionBenchmarkReport } from './sessionBenchmark';
|
|
4
|
+
import type { VoiceTestFixture } from './fixtures';
|
|
5
|
+
export type VoiceCorrectionHintProfile = 'generic' | 'benchmark-seeded';
|
|
6
|
+
type VoiceCorrectionAuditSlice<TReport> = {
|
|
7
|
+
fixtureIds: string[];
|
|
8
|
+
raw: TReport;
|
|
9
|
+
generic: TReport;
|
|
10
|
+
experimental: TReport;
|
|
11
|
+
benchmarkSeeded: TReport;
|
|
12
|
+
};
|
|
13
|
+
export type VoiceCorrectionBenchmarkAudit = {
|
|
14
|
+
raw: VoiceSTTBenchmarkReport;
|
|
15
|
+
generic: VoiceSTTBenchmarkReport;
|
|
16
|
+
experimental: VoiceSTTBenchmarkReport;
|
|
17
|
+
benchmarkSeeded: VoiceSTTBenchmarkReport;
|
|
18
|
+
holdout: VoiceCorrectionAuditSlice<VoiceSTTBenchmarkReport>;
|
|
19
|
+
lexicalHoldout: VoiceCorrectionAuditSlice<VoiceSTTBenchmarkReport>;
|
|
20
|
+
};
|
|
21
|
+
export type VoiceSessionCorrectionAudit = {
|
|
22
|
+
raw: VoiceSessionBenchmarkReport;
|
|
23
|
+
generic: VoiceSessionBenchmarkReport;
|
|
24
|
+
experimental: VoiceSessionBenchmarkReport;
|
|
25
|
+
benchmarkSeeded: VoiceSessionBenchmarkReport;
|
|
26
|
+
holdout: VoiceCorrectionAuditSlice<VoiceSessionBenchmarkReport>;
|
|
27
|
+
lexicalHoldout: VoiceCorrectionAuditSlice<VoiceSessionBenchmarkReport>;
|
|
28
|
+
};
|
|
29
|
+
export declare const isCorrectionHoldoutFixtureId: (fixtureId: string) => boolean;
|
|
30
|
+
export declare const buildFixturePhraseHints: (fixture: Pick<VoiceTestFixture, "expectedTerms" | "expectedText">, profile?: VoiceCorrectionHintProfile) => VoicePhraseHint[];
|
|
31
|
+
export declare const buildCodeSwitchBenchmarkLexicon: (fixture: Pick<VoiceTestFixture, "expectedTerms" | "expectedText" | "language" | "tags">) => VoiceLexiconEntry[];
|
|
32
|
+
export declare const buildCodeSwitchBenchmarkPhraseHints: (fixture: Pick<VoiceTestFixture, "expectedTerms" | "expectedText" | "language" | "tags">) => VoicePhraseHint[];
|
|
33
|
+
export declare const createCodeSwitchBenchmarkCorrectionHandler: () => VoiceTurnCorrectionHandler;
|
|
34
|
+
export declare const createBenchmarkCorrectionHandler: (profile: VoiceCorrectionHintProfile) => VoiceTurnCorrectionHandler;
|
|
35
|
+
export declare const scoreCorrectedExpectedTerms: (actualText: string, expectedTerms: string[] | undefined) => VoiceExpectedTermAccuracy;
|
|
36
|
+
export declare const applyCorrectedBenchmarkReport: (report: VoiceSTTBenchmarkReport, fixtures: VoiceTestFixture[], profile?: VoiceCorrectionHintProfile) => VoiceSTTBenchmarkReport;
|
|
37
|
+
export declare const applyExperimentalBenchmarkReport: (report: VoiceSTTBenchmarkReport, fixtures: VoiceTestFixture[]) => VoiceSTTBenchmarkReport;
|
|
38
|
+
export declare const applyLexiconCorrectedBenchmarkReport: (report: VoiceSTTBenchmarkReport, fixtures: VoiceTestFixture[], buildLexicon: (fixture: Pick<VoiceTestFixture, "expectedTerms" | "expectedText" | "language" | "tags">) => VoiceLexiconEntry[]) => VoiceSTTBenchmarkReport;
|
|
39
|
+
export declare const buildCorrectionBenchmarkAudit: (rawReport: VoiceSTTBenchmarkReport, fixtures: VoiceTestFixture[]) => VoiceCorrectionBenchmarkAudit;
|
|
40
|
+
export declare const buildSessionCorrectionAudit: (raw: VoiceSessionBenchmarkReport, generic: VoiceSessionBenchmarkReport, experimental: VoiceSessionBenchmarkReport, benchmarkSeeded: VoiceSessionBenchmarkReport, scenarios: Array<Pick<VoiceTestFixture, "expectedTerms" | "expectedText" | "expectedTurnTexts" | "id">>) => VoiceSessionCorrectionAudit;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { VoiceBargeInOptions } from '../types';
|
|
2
|
+
export type VoiceDuplexBenchmarkScenario = {
|
|
3
|
+
expectedInterruptCount: number;
|
|
4
|
+
id: string;
|
|
5
|
+
initialPartial?: string;
|
|
6
|
+
interruptDelayMs?: number;
|
|
7
|
+
level?: number;
|
|
8
|
+
mode: 'audio-send' | 'input-level' | 'partial';
|
|
9
|
+
partial?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
};
|
|
12
|
+
export type VoiceDuplexBenchmarkScenarioResult = {
|
|
13
|
+
actualInterruptCount: number;
|
|
14
|
+
elapsedMs: number;
|
|
15
|
+
expectedInterruptCount: number;
|
|
16
|
+
fixtureId: string;
|
|
17
|
+
interruptLatencyMs?: number;
|
|
18
|
+
mode: VoiceDuplexBenchmarkScenario['mode'];
|
|
19
|
+
passes: boolean;
|
|
20
|
+
title: string;
|
|
21
|
+
};
|
|
22
|
+
export type VoiceDuplexBenchmarkSummary = {
|
|
23
|
+
averageElapsedMs: number;
|
|
24
|
+
averageInterruptLatencyMs?: number;
|
|
25
|
+
passCount: number;
|
|
26
|
+
passRate: number;
|
|
27
|
+
scenarioCount: number;
|
|
28
|
+
};
|
|
29
|
+
export type VoiceDuplexBenchmarkReport = {
|
|
30
|
+
fixtures: VoiceDuplexBenchmarkScenarioResult[];
|
|
31
|
+
generatedAt: number;
|
|
32
|
+
summary: VoiceDuplexBenchmarkSummary;
|
|
33
|
+
};
|
|
34
|
+
export type VoiceDuplexBenchmarkOptions = {
|
|
35
|
+
bargeIn?: VoiceBargeInOptions;
|
|
36
|
+
defaultInterruptDelayMs?: number;
|
|
37
|
+
};
|
|
38
|
+
export declare const getDefaultVoiceDuplexBenchmarkScenarios: () => {
|
|
39
|
+
expectedInterruptCount: number;
|
|
40
|
+
id: string;
|
|
41
|
+
initialPartial?: string;
|
|
42
|
+
interruptDelayMs?: number;
|
|
43
|
+
level?: number;
|
|
44
|
+
mode: "audio-send" | "input-level" | "partial";
|
|
45
|
+
partial?: string;
|
|
46
|
+
title: string;
|
|
47
|
+
}[];
|
|
48
|
+
export declare const runVoiceDuplexBenchmarkScenario: (scenario: VoiceDuplexBenchmarkScenario, options?: VoiceDuplexBenchmarkOptions) => Promise<VoiceDuplexBenchmarkScenarioResult>;
|
|
49
|
+
export declare const summarizeVoiceDuplexBenchmark: (fixtures: VoiceDuplexBenchmarkScenarioResult[]) => VoiceDuplexBenchmarkSummary;
|
|
50
|
+
export declare const runVoiceDuplexBenchmark: (scenarios?: {
|
|
51
|
+
expectedInterruptCount: number;
|
|
52
|
+
id: string;
|
|
53
|
+
initialPartial?: string;
|
|
54
|
+
interruptDelayMs?: number;
|
|
55
|
+
level?: number;
|
|
56
|
+
mode: "audio-send" | "input-level" | "partial";
|
|
57
|
+
partial?: string;
|
|
58
|
+
title: string;
|
|
59
|
+
}[], options?: VoiceDuplexBenchmarkOptions) => Promise<VoiceDuplexBenchmarkReport>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { AudioFormat } from '../types';
|
|
1
|
+
import type { AudioFormat, VoiceExpectedSpeakerTurn } from '../types';
|
|
2
2
|
export type VoiceTestFixtureManifestEntry = {
|
|
3
3
|
id: string;
|
|
4
4
|
title: string;
|
|
5
5
|
audioPath: string;
|
|
6
6
|
expectedText: string;
|
|
7
7
|
expectedTerms?: string[];
|
|
8
|
+
expectedSpeakerTurns?: VoiceExpectedSpeakerTurn[];
|
|
8
9
|
expectedTurnTexts?: string[];
|
|
9
10
|
chunkDurationMs?: number;
|
|
10
11
|
language?: string;
|
|
@@ -18,5 +19,20 @@ export type VoiceTestFixture = Omit<VoiceTestFixtureManifestEntry, 'audioPath'>
|
|
|
18
19
|
audioPath: string;
|
|
19
20
|
format: AudioFormat;
|
|
20
21
|
};
|
|
22
|
+
export type VoiceTelephonyFixtureOptions = {
|
|
23
|
+
includeAccents?: boolean;
|
|
24
|
+
targetSampleRateHz?: number;
|
|
25
|
+
};
|
|
26
|
+
export type VoiceMultiSpeakerFixtureOptions = {
|
|
27
|
+
silenceMs?: number;
|
|
28
|
+
};
|
|
29
|
+
export type VoiceFixtureLoadOptions = {
|
|
30
|
+
directories?: string[];
|
|
31
|
+
includeBundled?: boolean;
|
|
32
|
+
};
|
|
21
33
|
export declare const getVoiceFixtureDirectory: () => Promise<string>;
|
|
22
|
-
export declare const
|
|
34
|
+
export declare const resolveVoiceFixtureDirectories: (input?: string | string[] | VoiceFixtureLoadOptions) => Promise<string[]>;
|
|
35
|
+
export declare const createTelephonyVoiceTestFixtures: (fixtures: VoiceTestFixture[], options?: VoiceTelephonyFixtureOptions) => VoiceTestFixture[];
|
|
36
|
+
export declare const createMultiSpeakerVoiceTestFixtures: (fixtures: VoiceTestFixture[], options?: VoiceMultiSpeakerFixtureOptions) => VoiceTestFixture[];
|
|
37
|
+
export declare const createJargonVoiceTestFixtures: (fixtures: VoiceTestFixture[]) => VoiceTestFixture[];
|
|
38
|
+
export declare const loadVoiceTestFixtures: (fixtureDirectory?: string | string[] | VoiceFixtureLoadOptions) => Promise<VoiceTestFixture[]>;
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export * from './accuracy';
|
|
2
2
|
export * from './benchmark';
|
|
3
|
+
export * from './corrected';
|
|
4
|
+
export * from './duplex';
|
|
3
5
|
export * from './fixtures';
|
|
4
6
|
export * from './resilience';
|
|
7
|
+
export * from './review';
|
|
5
8
|
export * from './sessionBenchmark';
|
|
6
9
|
export * from './stt';
|
|
10
|
+
export * from './telephony';
|
|
11
|
+
export * from './tts';
|