@absolutejs/voice 0.0.22-beta.470 → 0.0.22-beta.472

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.
@@ -0,0 +1,77 @@
1
+ import type { STTAdapter } from "./types";
2
+ import { type VoiceTestFixture } from "./testing/fixtures";
3
+ import { type VoiceSTTBenchmarkOptions, type VoiceSTTBenchmarkReport } from "./testing/benchmark";
4
+ export type VoiceMultilingualLanguageCode = string;
5
+ export type VoiceMultilingualProofLanguageThresholds = {
6
+ label?: string;
7
+ language: VoiceMultilingualLanguageCode;
8
+ maxAverageWordErrorRate?: number;
9
+ minAverageWordAccuracyRate?: number;
10
+ minPassRate?: number;
11
+ minTermRecall?: number;
12
+ };
13
+ export type VoiceMultilingualProofDefaultThresholds = Omit<VoiceMultilingualProofLanguageThresholds, "label" | "language">;
14
+ export type VoiceMultilingualProofAdapterEntry = {
15
+ adapter: STTAdapter;
16
+ adapterId: string;
17
+ benchmarkOptions?: VoiceSTTBenchmarkOptions;
18
+ };
19
+ export type VoiceMultilingualProofOptions = {
20
+ adapters: readonly VoiceMultilingualProofAdapterEntry[];
21
+ defaultThresholds?: VoiceMultilingualProofDefaultThresholds;
22
+ filter?: (fixture: VoiceTestFixture) => boolean;
23
+ fixtureDirectories?: string | readonly string[];
24
+ fixtures?: readonly VoiceTestFixture[];
25
+ perLanguage?: readonly VoiceMultilingualProofLanguageThresholds[];
26
+ };
27
+ export type VoiceMultilingualProofLanguageMetrics = {
28
+ averageTermRecall: number;
29
+ averageWordAccuracyRate: number;
30
+ averageWordErrorRate: number;
31
+ fixtureCount: number;
32
+ passCount: number;
33
+ passRate: number;
34
+ };
35
+ export type VoiceMultilingualProofLanguageReport = {
36
+ applied: VoiceMultilingualProofLanguageThresholds;
37
+ failures: readonly string[];
38
+ fixtureIds: readonly string[];
39
+ label?: string;
40
+ language: VoiceMultilingualLanguageCode;
41
+ metrics: VoiceMultilingualProofLanguageMetrics;
42
+ passes: boolean;
43
+ };
44
+ export type VoiceMultilingualProofAdapterReport = {
45
+ adapterId: string;
46
+ benchmark: VoiceSTTBenchmarkReport;
47
+ failures: readonly string[];
48
+ fixtureCount: number;
49
+ languageReports: readonly VoiceMultilingualProofLanguageReport[];
50
+ overall: VoiceMultilingualProofLanguageMetrics;
51
+ passes: boolean;
52
+ };
53
+ export type VoiceMultilingualProofReport = {
54
+ adapters: readonly VoiceMultilingualProofAdapterReport[];
55
+ generatedAt: number;
56
+ passes: boolean;
57
+ summary: {
58
+ adapterCount: number;
59
+ failedAdapters: readonly string[];
60
+ fixtureCount: number;
61
+ languageCount: number;
62
+ };
63
+ };
64
+ export declare const runVoiceMultilingualProof: (options: VoiceMultilingualProofOptions) => Promise<VoiceMultilingualProofReport>;
65
+ export declare const renderVoiceMultilingualProofMarkdown: (report: VoiceMultilingualProofReport) => string;
66
+ export type VoiceMultilingualProofReadinessOptions = {
67
+ baseHref?: string;
68
+ label?: string;
69
+ };
70
+ export type VoiceMultilingualProofReadinessCheck = {
71
+ detail: string;
72
+ href?: string;
73
+ label: string;
74
+ status: "fail" | "pass" | "warn";
75
+ value?: number | string;
76
+ };
77
+ export declare const buildVoiceMultilingualProofReadinessCheck: (report: VoiceMultilingualProofReport, options?: VoiceMultilingualProofReadinessOptions) => VoiceMultilingualProofReadinessCheck;
@@ -0,0 +1,160 @@
1
+ import type { VoiceAgent, VoiceAgentModel, VoiceAgentTool } from "./agent";
2
+ import { type VoiceDTMFToolOptions } from "./agentTools";
3
+ import { type VoiceAssistant, type VoiceAssistantOptions } from "./assistant";
4
+ import { type VoiceRAGCollectionLike, type VoiceRAGToolOptions } from "./ragTool";
5
+ import type { VoiceSessionRecord } from "./types";
6
+ export type VapiAssistantMessage = {
7
+ content?: string;
8
+ role?: "assistant" | "system" | "user";
9
+ };
10
+ export type VapiAssistantConfigModel = {
11
+ emotionRecognitionEnabled?: boolean;
12
+ maxTokens?: number;
13
+ messages?: readonly VapiAssistantMessage[];
14
+ model?: string;
15
+ numFastTurns?: number;
16
+ provider?: string;
17
+ systemPrompt?: string;
18
+ temperature?: number;
19
+ toolIds?: readonly string[];
20
+ tools?: readonly VapiAssistantConfigTool[];
21
+ };
22
+ export type VapiAssistantConfigVoice = {
23
+ provider?: string;
24
+ speed?: number;
25
+ stability?: number;
26
+ style?: number;
27
+ voiceId?: string;
28
+ };
29
+ export type VapiAssistantConfigTranscriber = {
30
+ confidenceThreshold?: number;
31
+ language?: string;
32
+ model?: string;
33
+ provider?: string;
34
+ };
35
+ export type VapiAssistantConfigTransferDestination = {
36
+ description?: string;
37
+ message?: string;
38
+ metadata?: Record<string, unknown>;
39
+ number?: string;
40
+ sipUri?: string;
41
+ type?: string;
42
+ };
43
+ export type VapiAssistantConfigTool = {
44
+ async?: boolean;
45
+ description?: string;
46
+ destinations?: readonly VapiAssistantConfigTransferDestination[];
47
+ function?: {
48
+ description?: string;
49
+ name?: string;
50
+ parameters?: Record<string, unknown>;
51
+ };
52
+ headers?: Record<string, string>;
53
+ knowledgeBases?: readonly string[] | readonly Record<string, unknown>[];
54
+ method?: string;
55
+ name?: string;
56
+ server?: {
57
+ headers?: Record<string, string>;
58
+ url?: string;
59
+ };
60
+ type?: string;
61
+ url?: string;
62
+ };
63
+ export type VapiAssistantConfig = {
64
+ backgroundDenoisingEnabled?: boolean;
65
+ backgroundSound?: string;
66
+ compliancePlan?: {
67
+ hipaaEnabled?: boolean;
68
+ pciEnabled?: boolean;
69
+ };
70
+ endCallMessage?: string;
71
+ endCallPhrases?: readonly string[];
72
+ firstMessage?: string;
73
+ firstMessageMode?: string;
74
+ knowledgeBaseId?: string;
75
+ maxDurationSeconds?: number;
76
+ model?: VapiAssistantConfigModel;
77
+ monitorPlan?: Record<string, unknown>;
78
+ recordingEnabled?: boolean;
79
+ silenceTimeoutSeconds?: number;
80
+ startSpeakingPlan?: Record<string, unknown>;
81
+ stopSpeakingPlan?: Record<string, unknown>;
82
+ transcriber?: VapiAssistantConfigTranscriber;
83
+ variableValues?: Record<string, unknown>;
84
+ voice?: VapiAssistantConfigVoice;
85
+ voicemailDetection?: {
86
+ provider?: string;
87
+ };
88
+ voicemailMessage?: string;
89
+ };
90
+ export type VoiceFromVapiModelFactoryInput = {
91
+ model?: string;
92
+ provider?: string;
93
+ raw: VapiAssistantConfigModel;
94
+ temperature?: number;
95
+ };
96
+ export type VoiceFromVapiModelFactory<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: VoiceFromVapiModelFactoryInput) => VoiceAgentModel<TContext, TSession, TResult>;
97
+ export type VoiceFromVapiCustomToolInput = {
98
+ raw: VapiAssistantConfigTool;
99
+ };
100
+ export type VoiceFromVapiCustomToolFactory<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: VoiceFromVapiCustomToolInput) => VoiceAgentTool<TContext, TSession, Record<string, unknown>, unknown, TResult> | undefined;
101
+ export type VoiceFromVapiDTMFFactory<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord> = (input: {
102
+ raw: VapiAssistantConfigTool;
103
+ }) => VoiceDTMFToolOptions<TContext, TSession>["send"] | undefined;
104
+ export type VoiceFromVapiKnowledgeBase<TContext = unknown> = {
105
+ collection: VoiceRAGCollectionLike;
106
+ toolOptions?: VoiceRAGToolOptions<TContext>;
107
+ };
108
+ export type VoiceFromVapiUnsupportedReason = {
109
+ detail: string;
110
+ field: string;
111
+ };
112
+ export type VoiceFromVapiRouteHints = {
113
+ backgroundDenoisingEnabled?: boolean;
114
+ backgroundSound?: string;
115
+ endCallMessage?: string;
116
+ endCallPhrases?: readonly string[];
117
+ firstMessage?: string;
118
+ firstMessageMode?: string;
119
+ hipaaEnabled?: boolean;
120
+ maxDurationSeconds?: number;
121
+ pciEnabled?: boolean;
122
+ recordingEnabled?: boolean;
123
+ silenceTimeoutSeconds?: number;
124
+ stt?: {
125
+ confidenceThreshold?: number;
126
+ language?: string;
127
+ model?: string;
128
+ provider?: string;
129
+ };
130
+ tts?: {
131
+ provider?: string;
132
+ speed?: number;
133
+ stability?: number;
134
+ style?: number;
135
+ voiceId?: string;
136
+ };
137
+ voicemailMessage?: string;
138
+ };
139
+ export type VoiceFromVapiAssistantOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
140
+ assistantId?: string;
141
+ customToolFactory?: VoiceFromVapiCustomToolFactory<TContext, TSession, TResult>;
142
+ dtmfSendFactory?: VoiceFromVapiDTMFFactory<TContext, TSession>;
143
+ fetch?: typeof fetch;
144
+ knowledgeBase?: VoiceFromVapiKnowledgeBase<TContext>;
145
+ modelFactory: VoiceFromVapiModelFactory<TContext, TSession, TResult>;
146
+ systemFallback?: string;
147
+ variableResolver?: (path: string, input: {
148
+ context: TContext;
149
+ session: TSession;
150
+ }) => unknown;
151
+ };
152
+ export type VoiceFromVapiAssistantResult<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
153
+ assistant: VoiceAssistant<TContext, TSession, TResult>;
154
+ assistantOptions: VoiceAssistantOptions<TContext, TSession, TResult>;
155
+ modelAgent: VoiceAgent<TContext, TSession, TResult>;
156
+ routeHints: VoiceFromVapiRouteHints;
157
+ tools: ReadonlyArray<VoiceAgentTool<TContext, TSession, Record<string, unknown>, unknown, TResult>>;
158
+ unsupported: readonly VoiceFromVapiUnsupportedReason[];
159
+ };
160
+ export declare const fromVapiAssistantConfig: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(config: VapiAssistantConfig, options: VoiceFromVapiAssistantOptions<TContext, TSession, TResult>) => VoiceFromVapiAssistantResult<TContext, TSession, TResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.470",
3
+ "version": "0.0.22-beta.472",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",