@sinch/functions-runtime 0.6.0 → 0.6.1
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 +22 -5
- package/dist/bin/sinch-runtime.js +1 -1
- package/dist/{chunk-TOTJB6SW.js → chunk-DHM4MH2A.js} +584 -60
- package/dist/chunk-DHM4MH2A.js.map +1 -0
- package/dist/index.d.ts +200 -8
- package/dist/index.js +1 -1
- package/dist/voice/v2.d.ts +97 -8
- package/dist/voice/v2.js +1 -3
- package/package.json +1 -1
- package/dist/chunk-TOTJB6SW.js.map +0 -1
package/README.md
CHANGED
|
@@ -347,10 +347,15 @@ reaches the matching adapter — `providerOptions.deepgram` above does nothing i
|
|
|
347
347
|
changed to `'openai'`. The STREAM leg `realtimeAgent` dials itself is capped by the same
|
|
348
348
|
`MAX_CALL_DURATION` function variable `dialAgent` reads (default 1800 seconds).
|
|
349
349
|
|
|
350
|
-
**Per-call overrides.** `prompt`, `greeting`, `voice` and `
|
|
351
|
-
value or a `(call, context) => value | Promise<value>` function, resolved once per
|
|
352
|
-
the vendor session opens, so the greeting above can say "Hello, Maria" instead of a
|
|
353
|
-
|
|
350
|
+
**Per-call overrides.** `prompt`, `greeting`, `voice`, `transferTo` and `language` each take
|
|
351
|
+
either a plain value or a `(call, context) => value | Promise<value>` function, resolved once per
|
|
352
|
+
call — before the vendor session opens, so the greeting above can say "Hello, Maria" instead of a
|
|
353
|
+
generic line. `language` is a BCP-47 tag (e.g. `'en-US'`, `'es-MX'`) that pins the provider's
|
|
354
|
+
speech recognition instead of letting it auto-detect; defaults to `'en-US'`. `timezone` (plain
|
|
355
|
+
string, not per-call — a property of the deployment, not the caller) defaults to
|
|
356
|
+
`'America/Chicago'` and drives the current date/time line prepended to every provider's resolved
|
|
357
|
+
prompt. `model` (in `providerOptions`) is not per-call; only `prompt`/`greeting`/`voice`/
|
|
358
|
+
`transferTo`/`language` are. `prompt: (call, ctx) =>
|
|
354
359
|
ctx.assets(...)` is how a longer prompt comes from a file in `assets/` instead of being inlined —
|
|
355
360
|
`ctx.assets` reads it as plain text, so any `{{placeholder}}` substitution the prompt needs is
|
|
356
361
|
ordinary string work in that same function, not a templating feature this helper provides.
|
|
@@ -392,7 +397,19 @@ either party, and every completed tool call, in order — see `onEnd` above), `o
|
|
|
392
397
|
`onError`/`onEnd`, call control from inside a tool handler (`ctx.hangup()`, `ctx.transfer(number)`
|
|
393
398
|
— the same move-the-leg mechanism as the voice builder's `transferTo*`/`voiceRelay`'s
|
|
394
399
|
`call.transferToPhone`: busy, unanswered or failed drops the caller rather than returning them
|
|
395
|
-
here), audio format and barge-in clearing, and prompt/greeting delivery.
|
|
400
|
+
here), audio format and barge-in clearing, and prompt/greeting delivery.
|
|
401
|
+
|
|
402
|
+
**Usage and turn timing.** `ctx.usage` (`inputTokens`/`outputTokens`/`audioSeconds`) is the call's
|
|
403
|
+
running total so far, updated as the vendor reports it — tokens/seconds only, no dollar prices.
|
|
404
|
+
Each `TranscriptEntry` also carries, where the provider reports it: `latencyMs` (time from the
|
|
405
|
+
caller's turn finishing to this reply's first spoken sentence, or a tool's own run time),
|
|
406
|
+
`totalMs` (agent turns only: time to the whole reply completing, including any tool rounds —
|
|
407
|
+
unset if the turn was abandoned by a barge-in), `speechStartAt`/`speechEndAt` (user turns; filled
|
|
408
|
+
by an energy-VAD fallback on raw caller audio when a provider doesn't report its own boundary),
|
|
409
|
+
and `playbackStartAt`/`playbackEndAt`/`interrupted` (agent turns; left unset when a provider
|
|
410
|
+
reports no playback signal). Fields a provider doesn't support stay unset rather than guessed at.
|
|
411
|
+
|
|
412
|
+
**What isn't normalised:** voice and
|
|
396
413
|
model ids beyond a small portable set, a vendor's own split STT/LLM/TTS choices (Deepgram's
|
|
397
414
|
`sttModel`/`llmProvider`/`llmModel` above, for instance), and turn-detection/latency feel — tune
|
|
398
415
|
those per vendor through `providerOptions`. Audio defaults to 8kHz telephony, matching the Voice
|