@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.
package/README.md CHANGED
@@ -8,6 +8,93 @@ Use it when you want Vapi/Retell/Bland-style voice-agent capability, but you wan
8
8
 
9
9
  ## What's new
10
10
 
11
+ ### 0.0.22-beta.472 · Phase 6 — multilingual STT proof gate
12
+
13
+ `runVoiceMultilingualProof(...)` turns the `voice-fixtures-multilingual` corpus (FLEURS + BSC Catalan-Spanish code-switch + CoSHE Hindi-English code-switch) into a gateable readiness/proof artifact. Buyers evaluating Vapi-replacement can now run any combination of STT adapters against the multilingual corpus and assert per-language WER / pass-rate / term-recall budgets in CI.
14
+
15
+ ```ts
16
+ import {
17
+ buildVoiceMultilingualProofReadinessCheck,
18
+ renderVoiceMultilingualProofMarkdown,
19
+ runVoiceMultilingualProof,
20
+ } from "@absolutejs/voice";
21
+ import { deepgram } from "@absolutejs/voice-deepgram";
22
+ import { speechmatics } from "@absolutejs/voice-speechmatics";
23
+ import { soniox } from "@absolutejs/voice-soniox";
24
+
25
+ const report = await runVoiceMultilingualProof({
26
+ adapters: [
27
+ { adapter: deepgram({ apiKey, model: "nova-3" }), adapterId: "deepgram-nova3" },
28
+ { adapter: speechmatics({ apiKey, region: "eu2" }), adapterId: "speechmatics-enhanced" },
29
+ { adapter: soniox({ apiKey, enableLanguageIdentification: true }), adapterId: "soniox" },
30
+ ],
31
+ defaultThresholds: { maxAverageWordErrorRate: 0.30, minPassRate: 0.7 },
32
+ perLanguage: [
33
+ { language: "ca-es", label: "Catalan-Spanish code-switch", maxAverageWordErrorRate: 0.45 },
34
+ { language: "hi-en", label: "Hindi-English code-switch", maxAverageWordErrorRate: 0.50 },
35
+ ],
36
+ });
37
+
38
+ const readiness = buildVoiceMultilingualProofReadinessCheck(report, {
39
+ baseHref: "/voice/multilingual-proof",
40
+ });
41
+ // drop `readiness` into your VoiceProductionReadinessReport.checks array
42
+
43
+ await Bun.write("docs/multilingual-proof.md", renderVoiceMultilingualProofMarkdown(report));
44
+ ```
45
+
46
+ Highlights:
47
+ - Loads fixtures from `VOICE_FIXTURE_DIR` (or any caller-supplied directory list / pre-loaded `VoiceTestFixture[]`), filters by an optional predicate, and runs each adapter through the existing `runSTTAdapterBenchmark` harness — no new STT plumbing required.
48
+ - Buckets fixture results by `fixture.language` and applies per-language thresholds (`maxAverageWordErrorRate`, `minAverageWordAccuracyRate`, `minPassRate`, `minTermRecall`) layered over caller-provided `defaultThresholds`.
49
+ - Returns a structured report (`adapters[].languageReports[]` with metrics + failures, plus per-adapter and global `passes` flags) plus a Markdown renderer for human review and a `VoiceProductionReadinessCheck`-shaped helper for drop-in readiness wiring.
50
+ - Pairs naturally with every STT adapter shipped in `voice-adapters` (deepgram, assemblyai, azure streaming, speechmatics, gladia, soniox, google-speech streaming + buffered, openai-whisper buffered).
51
+
52
+ ### 0.0.22-beta.471 · Vapi parity — `fromVapiAssistantConfig` adapter
53
+
54
+ Mechanical migration from a Vapi Assistant JSON to a voice assistant. Pass the JSON dump (or a typed subset), provide a `modelFactory` that maps Vapi's `model.provider`+`model.model` to a voice `VoiceAgentModel`, and get back `{ assistant, tools, routeHints, unsupported }`.
55
+
56
+ ```ts
57
+ import {
58
+ createOpenAIVoiceAssistantModel,
59
+ fromVapiAssistantConfig,
60
+ type VapiAssistantConfig,
61
+ } from "@absolutejs/voice";
62
+
63
+ const config: VapiAssistantConfig = JSON.parse(vapiDump);
64
+
65
+ const { assistant, tools, routeHints, unsupported } = fromVapiAssistantConfig(config, {
66
+ assistantId: "support",
67
+ fetch,
68
+ knowledgeBase: { collection: ragCollection },
69
+ modelFactory: ({ provider, model, temperature }) => {
70
+ if (provider === "openai") {
71
+ return createOpenAIVoiceAssistantModel({
72
+ apiKey: process.env.OPENAI_API_KEY!,
73
+ model: model ?? "gpt-4.1-mini",
74
+ temperature,
75
+ });
76
+ }
77
+ throw new Error(`Unsupported provider: ${provider}`);
78
+ },
79
+ variableResolver: (path, { context }) => {
80
+ if (path === "customer.name") return context.customerName;
81
+ return undefined;
82
+ },
83
+ dtmfSendFactory: () => ({ args, api }) =>
84
+ api.transfer({ target: "ivr", metadata: { digits: args.digits } }),
85
+ });
86
+
87
+ console.log("Migrated", tools.length, "tools;", unsupported.length, "fields need manual review:");
88
+ for (const reason of unsupported) console.log(` - ${reason.field}: ${reason.detail}`);
89
+ ```
90
+
91
+ Mappings:
92
+ - **`model.provider` + `model.model` + `temperature`** → your `modelFactory` (you control which provider adapter to use; the adapter doesn't bake in API keys).
93
+ - **`messages[].role === "system"` (or `systemPrompt`)** → assistant `system` field; `{{var}}` bare expansions auto-compile to a function-form prompt that resolves built-ins (`{{now}}`, `{{date}}`, `{{time}}`) and your `variableResolver` for everything else. LiquidJS filters are reported in `unsupported`.
94
+ - **`tools[].type`** → named-tool factories from beta.470: `endCall` → `createVoiceEndCallTool`, `transferCall` → `createVoiceTransferCallTool` (numbers/SIP URIs auto-mapped), `voicemail` → `createVoiceVoicemailDetectionTool`, `apiRequest` / `function` (with `server.url`) → `createVoiceApiRequestTool`, `query` (or top-level `knowledgeBaseId`) → `createVoiceRAGTool` if you pass a `knowledgeBase` option. `dtmf` requires a `dtmfSendFactory` so it can reach your telephony adapter. `function` tools without `server.url` are forwarded to your optional `customToolFactory`.
95
+ - **`voice.*` (TTS) + `transcriber.*` (STT) + `firstMessage` / `firstMessageMode` / `silenceTimeoutSeconds` / `maxDurationSeconds` / `endCall*` / `recordingEnabled` / `compliancePlan.*` / `backgroundSound` / `voicemailMessage`** → `routeHints` you pass into your `voice()` plugin / carrier route at mount time.
96
+ - **`monitorPlan`, `startSpeakingPlan`, `stopSpeakingPlan`, `voicemailDetection.provider`, `model.toolIds`, `firstMessageMode`** → reported in `unsupported` with concrete migration instructions.
97
+
11
98
  ### 0.0.22-beta.470 · Vapi parity — named tool catalog
12
99
 
13
100
  Five named-tool factories that mirror Vapi's built-in `tools[].type` entries 1:1. Drop them straight into `createVoiceAssistant({ tools: [...] })` to get the same buyer ergonomics without writing the wiring yourself.
package/dist/index.d.ts CHANGED
@@ -72,6 +72,8 @@ export { createVoiceAgent, createVoiceAgentSquad, createVoiceAgentTool, } from "
72
72
  export { createVoiceRAGTool } from "./ragTool";
73
73
  export type { VoiceRAGCollectionLike, VoiceRAGQueryResult, VoiceRAGSearchInput, VoiceRAGToolArgs, VoiceRAGToolOptions, VoiceRAGToolResult, } from "./ragTool";
74
74
  export { createVoiceApiRequestTool, createVoiceDTMFTool, createVoiceEndCallTool, createVoiceTransferCallTool, createVoiceVoicemailDetectionTool, } from "./agentTools";
75
+ export { fromVapiAssistantConfig } from "./vapiAdapter";
76
+ export type { VapiAssistantConfig, VapiAssistantConfigModel, VapiAssistantConfigTool, VapiAssistantConfigTranscriber, VapiAssistantConfigTransferDestination, VapiAssistantConfigVoice, VapiAssistantMessage, VoiceFromVapiAssistantOptions, VoiceFromVapiAssistantResult, VoiceFromVapiCustomToolFactory, VoiceFromVapiCustomToolInput, VoiceFromVapiDTMFFactory, VoiceFromVapiKnowledgeBase, VoiceFromVapiModelFactory, VoiceFromVapiModelFactoryInput, VoiceFromVapiRouteHints, VoiceFromVapiUnsupportedReason, } from "./vapiAdapter";
75
77
  export type { VoiceApiRequestToolArgs, VoiceApiRequestToolFetch, VoiceApiRequestToolHttpMethod, VoiceApiRequestToolOptions, VoiceApiRequestToolResult, VoiceDTMFToolArgs, VoiceDTMFToolOptions, VoiceDTMFToolResult, VoiceEndCallToolArgs, VoiceEndCallToolOptions, VoiceEndCallToolResult, VoiceTransferCallToolArgs, VoiceTransferCallToolDestination, VoiceTransferCallToolOptions, VoiceTransferCallToolResult, VoiceVoicemailDetectionToolArgs, VoiceVoicemailDetectionToolOptions, VoiceVoicemailDetectionToolResult, } from "./agentTools";
76
78
  export { assertVoiceAgentSquadContractEvidence, assertVoiceAgentSquadContract, evaluateVoiceAgentSquadContractEvidence, runVoiceAgentSquadContract, } from "./agentSquadContract";
77
79
  export { createVoiceToolIdempotencyKey, createVoiceToolRuntime, } from "./toolRuntime";
@@ -221,4 +223,6 @@ export { shapeTelephonyAssistantText } from "./telephony/response";
221
223
  export type { TelephonyResponseShapeMode, TelephonyResponseShapeOptions, } from "./telephony/response";
222
224
  export { buildVoiceProofPackInput, buildVoiceProofPack, buildVoiceProofPackFromObservabilityExport, createVoiceProofPackBuildContext, createVoiceProofRefreshSnapshot, createVoiceProofPackStaleWhileRefreshSource, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack, } from "./proofPack";
223
225
  export type { VoiceProofPack, VoiceProofPackBuildContext, VoiceProofPackBuildContextOptions, VoiceProofPackBuildTiming, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackInputBuilderLoaderInput, VoiceProofPackInputBuilderOperationsLoaderInput, VoiceProofPackInputBuilderOptions, VoiceProofPackInputBuilderSupportBundle, VoiceProofPackRefreshState, VoiceProofPackRefreshStatus, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackSourceValue, VoiceProofPackStatus, VoiceProofPackStaleWhileRefreshSource, VoiceProofPackStaleWhileRefreshSourceOptions, VoiceProofPackWriteResult, VoiceProofRefreshSnapshot, VoiceProofRefreshSnapshotOptions, } from "./proofPack";
226
+ export { buildVoiceMultilingualProofReadinessCheck, renderVoiceMultilingualProofMarkdown, runVoiceMultilingualProof, } from "./multilingualProof";
227
+ export type { VoiceMultilingualLanguageCode, VoiceMultilingualProofAdapterEntry, VoiceMultilingualProofAdapterReport, VoiceMultilingualProofDefaultThresholds, VoiceMultilingualProofLanguageMetrics, VoiceMultilingualProofLanguageReport, VoiceMultilingualProofLanguageThresholds, VoiceMultilingualProofOptions, VoiceMultilingualProofReadinessCheck, VoiceMultilingualProofReadinessOptions, VoiceMultilingualProofReport, } from "./multilingualProof";
224
228
  export * from "./types";