@d-id/client-sdk 3.0.0-staging.416 → 3.0.0-staging.417
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 +43 -116
- package/dist/{index-DCAt0P7O.js → index-BhhDKHW-.js} +6 -4
- package/dist/index-BhhDKHW-.js.map +1 -0
- package/dist/index.d.ts +318 -102
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +2 -1
- package/dist/livekit-client.esm-QkbCKsng.js +1 -0
- package/dist/{livekit-manager-Cj0YXe2U.js → livekit-manager-DF70NOGW.js} +2 -1
- package/dist/livekit-manager-DF70NOGW.js.map +1 -0
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -231,6 +231,11 @@ export declare interface AgentManager {
|
|
|
231
231
|
*
|
|
232
232
|
* Read-only: the property cannot be reassigned, and the SDK never replaces it — the manager
|
|
233
233
|
* talks to the agent it was created for, for its whole life.
|
|
234
|
+
* @example
|
|
235
|
+
* ```ts
|
|
236
|
+
* nameElement.textContent = agentManager.agent.name ?? 'Agent';
|
|
237
|
+
* thumbnailElement.src = agentManager.agent.thumbnail ?? '';
|
|
238
|
+
* ```
|
|
234
239
|
*/
|
|
235
240
|
readonly agent: Agent;
|
|
236
241
|
/**
|
|
@@ -239,6 +244,13 @@ export declare interface AgentManager {
|
|
|
239
244
|
* @returns {@link StreamType.Fluent} for a fluent stream (one video for the idle and talking
|
|
240
245
|
* states), {@link StreamType.Legacy} for the two-element legacy mode, or `undefined` before
|
|
241
246
|
* {@link AgentManager.connect | connect()} has established a session.
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* import { StreamType } from '@d-id/client-sdk';
|
|
250
|
+
*
|
|
251
|
+
* // A legacy stream is the one the application swaps the idle video in and out of.
|
|
252
|
+
* const swapsIdleVideo = agentManager.getStreamType() === StreamType.Legacy;
|
|
253
|
+
* ```
|
|
242
254
|
*/
|
|
243
255
|
getStreamType(): StreamType | undefined;
|
|
244
256
|
/**
|
|
@@ -250,6 +262,11 @@ export declare interface AgentManager {
|
|
|
250
262
|
* interrupting is allowed right now.
|
|
251
263
|
*
|
|
252
264
|
* @returns `true` when {@link AgentManager.interrupt | interrupt()} can do anything.
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* await agentManager.connect();
|
|
268
|
+
* setStopButtonVisible(agentManager.isInterruptAvailable());
|
|
269
|
+
* ```
|
|
253
270
|
*/
|
|
254
271
|
isInterruptAvailable(): boolean;
|
|
255
272
|
/**
|
|
@@ -261,6 +278,12 @@ export declare interface AgentManager {
|
|
|
261
278
|
* Read-only, and a copy of {@link Agent.starter_message} rather than the same array, so
|
|
262
279
|
* sorting or filtering a local copy of it cannot change what
|
|
263
280
|
* {@link AgentManager.agent | agent} reports.
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* for (const message of agentManager.starterMessages) {
|
|
284
|
+
* addSuggestionButton(message, () => void agentManager.chat(message));
|
|
285
|
+
* }
|
|
286
|
+
* ```
|
|
264
287
|
*/
|
|
265
288
|
readonly starterMessages: readonly string[];
|
|
266
289
|
/**
|
|
@@ -273,6 +296,11 @@ export declare interface AgentManager {
|
|
|
273
296
|
* @throws {@link HttpError} When the service does not answer with a token, or the request comes
|
|
274
297
|
* back non-2xx for any other reason.
|
|
275
298
|
* @throws {@link NetworkError} When the request never reaches the server.
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* const { token, region } = await agentManager.getSttToken();
|
|
302
|
+
* startRecognition(token, region);
|
|
303
|
+
* ```
|
|
276
304
|
*/
|
|
277
305
|
getSttToken(): Promise<SttTokenResponse>;
|
|
278
306
|
/**
|
|
@@ -289,7 +317,9 @@ export declare interface AgentManager {
|
|
|
289
317
|
* mode the manager was created with ({@link ChatMode.Functional} by default).
|
|
290
318
|
* @example
|
|
291
319
|
* ```ts
|
|
292
|
-
*
|
|
320
|
+
* import { ChatMode } from '@d-id/client-sdk';
|
|
321
|
+
*
|
|
322
|
+
* if (agentManager.getChatMode() === ChatMode.Maintenance) {
|
|
293
323
|
* showBanner('The agent is temporarily unavailable.');
|
|
294
324
|
* }
|
|
295
325
|
* ```
|
|
@@ -377,6 +407,15 @@ export declare interface AgentManager {
|
|
|
377
407
|
* flight; wait for it to settle first.
|
|
378
408
|
* @throws {@link HttpError} When creating the new stream comes back non-2xx.
|
|
379
409
|
* @throws {@link NetworkError} When that request never reaches the server.
|
|
410
|
+
* @example
|
|
411
|
+
* ```ts
|
|
412
|
+
* try {
|
|
413
|
+
* // The session expired. Start a new stream and keep the conversation.
|
|
414
|
+
* await agentManager.reconnect();
|
|
415
|
+
* } catch {
|
|
416
|
+
* // A connect() or another reconnect() is still in flight; let it settle first.
|
|
417
|
+
* }
|
|
418
|
+
* ```
|
|
380
419
|
*/
|
|
381
420
|
reconnect(): Promise<void>;
|
|
382
421
|
/**
|
|
@@ -387,6 +426,14 @@ export declare interface AgentManager {
|
|
|
387
426
|
* agent can be used again.
|
|
388
427
|
*
|
|
389
428
|
* @returns Resolves once everything is closed.
|
|
429
|
+
* @example
|
|
430
|
+
* ```ts
|
|
431
|
+
* // The user left the conversation: close the session so it stops running.
|
|
432
|
+
* await agentManager.disconnect();
|
|
433
|
+
*
|
|
434
|
+
* // The manager stays usable — connect() opens a new session with a new chat.
|
|
435
|
+
* await agentManager.connect();
|
|
436
|
+
* ```
|
|
390
437
|
*/
|
|
391
438
|
disconnect(): Promise<void>;
|
|
392
439
|
/**
|
|
@@ -438,6 +485,18 @@ export declare interface AgentManager {
|
|
|
438
485
|
* @returns Resolves once the transport has switched to the new track.
|
|
439
486
|
* @throws {@link ValidationError} When the session is not an Expressive (V4) one, or
|
|
440
487
|
* {@link AgentManager.connect | connect()} has not run yet.
|
|
488
|
+
* @example
|
|
489
|
+
* ```ts
|
|
490
|
+
* const stream = await navigator.mediaDevices.getUserMedia({ audio: { deviceId } });
|
|
491
|
+
* const [track] = stream.getAudioTracks();
|
|
492
|
+
*
|
|
493
|
+
* try {
|
|
494
|
+
* await agentManager.replaceMicrophoneTrack(track);
|
|
495
|
+
* } catch {
|
|
496
|
+
* // Nothing published yet, so there is no track to swap: publish instead.
|
|
497
|
+
* await agentManager.publishMicrophoneStream(stream);
|
|
498
|
+
* }
|
|
499
|
+
* ```
|
|
441
500
|
*/
|
|
442
501
|
replaceMicrophoneTrack(track: MediaStreamTrack): Promise<void>;
|
|
443
502
|
/**
|
|
@@ -451,6 +510,13 @@ export declare interface AgentManager {
|
|
|
451
510
|
* @returns Resolves once the track is published.
|
|
452
511
|
* @throws {@link ValidationError} When the session is not an Expressive (V4) one, or
|
|
453
512
|
* {@link AgentManager.connect | connect()} has not run yet.
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* if (agentManager.agent.vision?.enabled) {
|
|
516
|
+
* const cameraStream = await navigator.mediaDevices.getUserMedia({ video: true });
|
|
517
|
+
* await agentManager.publishCameraStream(cameraStream);
|
|
518
|
+
* }
|
|
519
|
+
* ```
|
|
454
520
|
*/
|
|
455
521
|
publishCameraStream(stream: MediaStream): Promise<void>;
|
|
456
522
|
/**
|
|
@@ -460,6 +526,11 @@ export declare interface AgentManager {
|
|
|
460
526
|
* and when nothing is published, it resolves without doing anything.
|
|
461
527
|
*
|
|
462
528
|
* @returns Resolves once the track is removed.
|
|
529
|
+
* @example
|
|
530
|
+
* ```ts
|
|
531
|
+
* // No guard needed: a no-op wherever there is nothing published.
|
|
532
|
+
* await agentManager.unpublishCameraStream();
|
|
533
|
+
* ```
|
|
463
534
|
*/
|
|
464
535
|
unpublishCameraStream(): Promise<void>;
|
|
465
536
|
/**
|
|
@@ -503,6 +574,13 @@ export declare interface AgentManager {
|
|
|
503
574
|
* in the transcript.
|
|
504
575
|
* @throws {@link HttpError} When the rating request comes back non-2xx.
|
|
505
576
|
* @throws {@link NetworkError} When the rating request never reaches the server.
|
|
577
|
+
* @example
|
|
578
|
+
* ```ts
|
|
579
|
+
* const rating = await agentManager.rate(messageId, 1);
|
|
580
|
+
*
|
|
581
|
+
* // The user changed their mind: pass the rating's id back rather than adding another.
|
|
582
|
+
* await agentManager.rate(messageId, -1, rating.id);
|
|
583
|
+
* ```
|
|
506
584
|
*/
|
|
507
585
|
rate(messageId: string, score: 1 | -1, rateId?: string): Promise<Rating>;
|
|
508
586
|
/**
|
|
@@ -514,6 +592,11 @@ export declare interface AgentManager {
|
|
|
514
592
|
* @throws {@link ValidationError} When no chat has started.
|
|
515
593
|
* @throws {@link HttpError} When the delete request comes back non-2xx.
|
|
516
594
|
* @throws {@link NetworkError} When the delete request never reaches the server.
|
|
595
|
+
* @example
|
|
596
|
+
* ```ts
|
|
597
|
+
* const rating = await agentManager.rate(messageId, 1);
|
|
598
|
+
* await agentManager.deleteRate(rating.id);
|
|
599
|
+
* ```
|
|
517
600
|
*/
|
|
518
601
|
deleteRate(id: string): Promise<Rating>;
|
|
519
602
|
/**
|
|
@@ -535,6 +618,13 @@ export declare interface AgentManager {
|
|
|
535
618
|
* @throws {@link HttpError} When the feedback request comes back non-2xx — including a `400`
|
|
536
619
|
* when the agent does not have end-of-call feedback enabled.
|
|
537
620
|
* @throws {@link NetworkError} When the feedback request never reaches the server.
|
|
621
|
+
* @example
|
|
622
|
+
* ```ts
|
|
623
|
+
* // The Agents API rejects the request unless the agent has end-of-call feedback on.
|
|
624
|
+
* if (agentManager.agent.end_of_call_feedback?.enabled) {
|
|
625
|
+
* await agentManager.submitFeedback(5, 'The answers were clear and quick.');
|
|
626
|
+
* }
|
|
627
|
+
* ```
|
|
538
628
|
*/
|
|
539
629
|
submitFeedback(rating: 1 | 2 | 3 | 4 | 5, answer?: string): Promise<SubmitFeedbackResponse>;
|
|
540
630
|
/**
|
|
@@ -587,20 +677,25 @@ export declare interface AgentManager {
|
|
|
587
677
|
/**
|
|
588
678
|
* Switches the chat to another mode.
|
|
589
679
|
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* arrives on nor a chat to send to. Call {@link AgentManager.connect | connect()} again after
|
|
596
|
-
* a change that tore the session down. {@link AgentManagerCallbacks.onModeChange | onModeChange}
|
|
597
|
-
* fires once the change has been applied; passing the mode already in effect does nothing.
|
|
680
|
+
* Any mode but {@link ChatMode.Functional} disconnects the stream, and a change into
|
|
681
|
+
* `Functional` disconnects a session that was not built for a conversation (one opened in
|
|
682
|
+
* {@link ChatMode.DirectPlayback}, for example); call {@link AgentManager.connect | connect()}
|
|
683
|
+
* again after such a change. {@link AgentManagerCallbacks.onModeChange | onModeChange} fires
|
|
684
|
+
* once the change is applied; passing the mode already in effect does nothing.
|
|
598
685
|
*
|
|
599
686
|
* @param mode - The {@link ChatMode} to switch to.
|
|
600
|
-
* @returns A promise resolved when the mode is in effect and any disconnect
|
|
601
|
-
* completed.
|
|
687
|
+
* @returns A promise resolved when the mode is in effect and any disconnect has completed.
|
|
602
688
|
* @throws {@link ValidationError} Rejects on Expressive (V4) agents for {@link ChatMode.Off} and
|
|
603
689
|
* {@link ChatMode.DirectPlayback}, which those agents do not support.
|
|
690
|
+
* @example
|
|
691
|
+
* ```ts
|
|
692
|
+
* import { ChatMode } from '@d-id/client-sdk';
|
|
693
|
+
*
|
|
694
|
+
* await agentManager.changeMode(ChatMode.TextOnly); // Disconnects the stream.
|
|
695
|
+
*
|
|
696
|
+
* await agentManager.changeMode(ChatMode.Functional);
|
|
697
|
+
* await agentManager.connect();
|
|
698
|
+
* ```
|
|
604
699
|
*/
|
|
605
700
|
changeMode(mode: ChatMode): Promise<void>;
|
|
606
701
|
/**
|
|
@@ -617,6 +712,11 @@ export declare interface AgentManager {
|
|
|
617
712
|
*
|
|
618
713
|
* @param properties - A flat JSON object whose properties are added to every analytics event
|
|
619
714
|
* the SDK sends from now on.
|
|
715
|
+
* @example
|
|
716
|
+
* ```ts
|
|
717
|
+
* // The user signed in halfway through the session.
|
|
718
|
+
* agentManager.enrichAnalytics({ plan: 'pro', locale: navigator.language });
|
|
719
|
+
* ```
|
|
620
720
|
*/
|
|
621
721
|
enrichAnalytics(properties: Record<string, unknown>): void;
|
|
622
722
|
/**
|
|
@@ -662,6 +762,11 @@ export declare interface AgentManager {
|
|
|
662
762
|
* {@link AgentManagerCallbacks.onError | onError} and the promise still resolves.
|
|
663
763
|
* @throws {@link ValidationError} When the session is not an Expressive (V4) one, or
|
|
664
764
|
* {@link AgentManager.connect | connect()} has not run yet.
|
|
765
|
+
* @example
|
|
766
|
+
* ```ts
|
|
767
|
+
* await agentManager.setSttLanguage('en-US');
|
|
768
|
+
* await agentManager.setSttLanguage('Spanish');
|
|
769
|
+
* ```
|
|
665
770
|
*/
|
|
666
771
|
setSttLanguage(language: string): Promise<void>;
|
|
667
772
|
/**
|
|
@@ -714,6 +819,15 @@ export declare interface AgentManager {
|
|
|
714
819
|
* transport's, not the SDK's, and a larger result fails the call. See
|
|
715
820
|
* {@link ClientToolHandler}.
|
|
716
821
|
* @throws {@link ValidationError} When the agent is a Talks (V2) or Clips (V3) one.
|
|
822
|
+
* @example
|
|
823
|
+
* ```ts
|
|
824
|
+
* if (agentManager.agent.avatar.type === 'expressive') {
|
|
825
|
+
* agentManager.registerClientTool('get_cart_total', async args => {
|
|
826
|
+
* const total = await cart.total(args.currency as string);
|
|
827
|
+
* return JSON.stringify({ total });
|
|
828
|
+
* });
|
|
829
|
+
* }
|
|
830
|
+
* ```
|
|
717
831
|
*/
|
|
718
832
|
registerClientTool(name: string, handler: ClientToolHandler): void;
|
|
719
833
|
/**
|
|
@@ -724,6 +838,11 @@ export declare interface AgentManager {
|
|
|
724
838
|
* was never registered, and any agent type, is a no-op — so it is safe in a cleanup path.
|
|
725
839
|
*
|
|
726
840
|
* @param name - Name of the tool whose handler should be removed.
|
|
841
|
+
* @example
|
|
842
|
+
* ```ts
|
|
843
|
+
* // Safe in a cleanup path: it never throws, whatever the agent type.
|
|
844
|
+
* agentManager.unregisterClientTool('get_cart_total');
|
|
845
|
+
* ```
|
|
727
846
|
*/
|
|
728
847
|
unregisterClientTool(name: string): void;
|
|
729
848
|
}
|
|
@@ -778,19 +897,23 @@ export declare interface AgentManager {
|
|
|
778
897
|
* tell a deliberate end from a dropped connection. Talks (V2) and Clips (V3) agents report
|
|
779
898
|
* only `ok`, `unknown_error`, `network_issue` and `inactivity`; `message_limit`, `time_limit`
|
|
780
899
|
* and `ended_by_agent` come from Expressive (V4) agents. A close reason the SDK does not
|
|
781
|
-
*
|
|
900
|
+
* recognize is forwarded as-is, so compare `reason` against the enum rather than parsing it;
|
|
782
901
|
* any other value is an opaque transport diagnostic.
|
|
783
902
|
* {@link AgentManager.reconnect | reconnect()} still works after a deliberate end; it starts a
|
|
784
903
|
* new stream rather than resuming the old one.
|
|
785
904
|
* @example
|
|
786
905
|
* ```ts
|
|
787
|
-
*
|
|
788
|
-
* console.log('onConnectionStateChange(): ', state, reason);
|
|
906
|
+
* import { ConnectionState, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
789
907
|
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
908
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
909
|
+
* onConnectionStateChange(state, reason) {
|
|
910
|
+
* console.log('onConnectionStateChange(): ', state, reason);
|
|
911
|
+
*
|
|
912
|
+
* if (state === ConnectionState.Connected) {
|
|
913
|
+
* console.log("I'm ready to go!");
|
|
914
|
+
* }
|
|
915
|
+
* },
|
|
916
|
+
* };
|
|
794
917
|
* ```
|
|
795
918
|
*/
|
|
796
919
|
onConnectionStateChange?: (state: ConnectionState, reason?: string) => void;
|
|
@@ -810,17 +933,25 @@ export declare interface AgentManager {
|
|
|
810
933
|
* {@link StreamingState.Stop | STOP} once it has finished.
|
|
811
934
|
* @example
|
|
812
935
|
* ```ts
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
* videoElement.
|
|
821
|
-
*
|
|
822
|
-
*
|
|
823
|
-
*
|
|
936
|
+
* import { StreamingState, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
937
|
+
*
|
|
938
|
+
* let srcObject: MediaStream | null = null;
|
|
939
|
+
*
|
|
940
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
941
|
+
* onSrcObjectReady(value) {
|
|
942
|
+
* srcObject = value;
|
|
943
|
+
* videoElement.srcObject = value;
|
|
944
|
+
* },
|
|
945
|
+
* onVideoStateChange(state) {
|
|
946
|
+
* if (state === StreamingState.Stop) {
|
|
947
|
+
* videoElement.srcObject = null;
|
|
948
|
+
* videoElement.src = agentManager.agent.idle_video ?? '';
|
|
949
|
+
* } else {
|
|
950
|
+
* videoElement.src = '';
|
|
951
|
+
* videoElement.srcObject = srcObject;
|
|
952
|
+
* }
|
|
953
|
+
* },
|
|
954
|
+
* };
|
|
824
955
|
* ```
|
|
825
956
|
*/
|
|
826
957
|
onVideoStateChange?: (state: StreamingState) => void;
|
|
@@ -847,9 +978,12 @@ export declare interface AgentManager {
|
|
|
847
978
|
* @param srcObject - The live media stream to render.
|
|
848
979
|
* @example
|
|
849
980
|
* ```ts
|
|
850
|
-
*
|
|
981
|
+
* import type { AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
982
|
+
*
|
|
983
|
+
* // Kept so `onVideoStateChange` can put it back after the idle video.
|
|
984
|
+
* let srcObject: MediaStream | null = null;
|
|
851
985
|
*
|
|
852
|
-
* const callbacks = {
|
|
986
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
853
987
|
* onSrcObjectReady(value) {
|
|
854
988
|
* videoElement.srcObject = value;
|
|
855
989
|
* srcObject = value;
|
|
@@ -875,13 +1009,16 @@ export declare interface AgentManager {
|
|
|
875
1009
|
* (a message passed to {@link AgentManager.chat | chat()}, or a transcribed utterance).
|
|
876
1010
|
* @example
|
|
877
1011
|
* ```ts
|
|
878
|
-
*
|
|
879
|
-
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
1012
|
+
* import type { AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1013
|
+
*
|
|
1014
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1015
|
+
* onNewMessage(messages, type) {
|
|
1016
|
+
* // `partial` fires repeatedly as the answer streams in; `answer` is the final one.
|
|
1017
|
+
* if (type === 'answer') {
|
|
1018
|
+
* console.log(messages[messages.length - 1].content);
|
|
1019
|
+
* }
|
|
1020
|
+
* },
|
|
1021
|
+
* };
|
|
885
1022
|
* ```
|
|
886
1023
|
*/
|
|
887
1024
|
onNewMessage?: (messages: Message[], type: 'answer' | 'partial' | 'user') => void;
|
|
@@ -898,6 +1035,17 @@ export declare interface AgentManager {
|
|
|
898
1035
|
* way.
|
|
899
1036
|
*
|
|
900
1037
|
* @param chatId - Id of the chat that was just created.
|
|
1038
|
+
* @example
|
|
1039
|
+
* ```ts
|
|
1040
|
+
* import type { AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1041
|
+
*
|
|
1042
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1043
|
+
* onNewChat(chatId) {
|
|
1044
|
+
* // Keep it to correlate the conversation with your own records.
|
|
1045
|
+
* localStorage.setItem('did-chat-id', chatId);
|
|
1046
|
+
* },
|
|
1047
|
+
* };
|
|
1048
|
+
* ```
|
|
901
1049
|
*/
|
|
902
1050
|
onNewChat?: (chatId: string) => void;
|
|
903
1051
|
/**
|
|
@@ -907,6 +1055,23 @@ export declare interface AgentManager {
|
|
|
907
1055
|
* a different mode than the one requested (for example {@link ChatMode.Maintenance}).
|
|
908
1056
|
*
|
|
909
1057
|
* @param mode - The {@link ChatMode} now in effect.
|
|
1058
|
+
* @example
|
|
1059
|
+
* ```ts
|
|
1060
|
+
* import { ChatMode, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1061
|
+
*
|
|
1062
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1063
|
+
* onModeChange(mode) {
|
|
1064
|
+
* // `chat()` rejects in Maintenance too, so the composer goes with the banner below.
|
|
1065
|
+
* setComposerEnabled(
|
|
1066
|
+
* mode !== ChatMode.Off && mode !== ChatMode.DirectPlayback && mode !== ChatMode.Maintenance
|
|
1067
|
+
* );
|
|
1068
|
+
*
|
|
1069
|
+
* if (mode === ChatMode.Maintenance) {
|
|
1070
|
+
* showBanner('The agent is temporarily unavailable.');
|
|
1071
|
+
* }
|
|
1072
|
+
* },
|
|
1073
|
+
* };
|
|
1074
|
+
* ```
|
|
910
1075
|
*/
|
|
911
1076
|
onModeChange?: (mode: ChatMode) => void;
|
|
912
1077
|
/**
|
|
@@ -921,9 +1086,13 @@ export declare interface AgentManager {
|
|
|
921
1086
|
* {@link ConnectivityState.Weak | WEAK} or {@link ConnectivityState.Unknown | UNKNOWN}.
|
|
922
1087
|
* @example
|
|
923
1088
|
* ```ts
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
*
|
|
1089
|
+
* import { ConnectivityState, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1090
|
+
*
|
|
1091
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1092
|
+
* onConnectivityStateChange(state) {
|
|
1093
|
+
* setQualityWarningVisible(state === ConnectivityState.Weak);
|
|
1094
|
+
* },
|
|
1095
|
+
* };
|
|
927
1096
|
* ```
|
|
928
1097
|
*/
|
|
929
1098
|
onConnectivityStateChange?: (state: ConnectivityState) => void;
|
|
@@ -946,12 +1115,16 @@ export declare interface AgentManager {
|
|
|
946
1115
|
* carries the end user's own message.
|
|
947
1116
|
* @example
|
|
948
1117
|
* ```ts
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
952
|
-
*
|
|
953
|
-
*
|
|
954
|
-
* }
|
|
1118
|
+
* import { isDIDError, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1119
|
+
*
|
|
1120
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1121
|
+
* onError(error, errorData) {
|
|
1122
|
+
* reportToYourErrorService({
|
|
1123
|
+
* ...(isDIDError(error) ? error.toJson() : { kind: 'Error', message: error.message }),
|
|
1124
|
+
* ...errorData,
|
|
1125
|
+
* });
|
|
1126
|
+
* },
|
|
1127
|
+
* };
|
|
955
1128
|
* ```
|
|
956
1129
|
*/
|
|
957
1130
|
onError?: (error: Error, errorData?: ErrorContext) => void;
|
|
@@ -973,6 +1146,17 @@ export declare interface AgentManager {
|
|
|
973
1146
|
* {@link AgentManager.getStreamType | getStreamType()}.
|
|
974
1147
|
*
|
|
975
1148
|
* @param state - The {@link AgentActivityState} the agent has moved to.
|
|
1149
|
+
* @example
|
|
1150
|
+
* ```ts
|
|
1151
|
+
* import { AgentActivityState, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1152
|
+
*
|
|
1153
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1154
|
+
* onAgentActivityStateChange(state) {
|
|
1155
|
+
* setTypingIndicatorVisible(state === AgentActivityState.Loading);
|
|
1156
|
+
* setComposerEnabled(state === AgentActivityState.Idle);
|
|
1157
|
+
* },
|
|
1158
|
+
* };
|
|
1159
|
+
* ```
|
|
976
1160
|
*/
|
|
977
1161
|
onAgentActivityStateChange?: (state: AgentActivityState) => void;
|
|
978
1162
|
/**
|
|
@@ -982,6 +1166,17 @@ export declare interface AgentManager {
|
|
|
982
1166
|
* are useful when correlating a session with D-ID support or with your own logs.
|
|
983
1167
|
*
|
|
984
1168
|
* @param stream - The new stream's `streamId`, `sessionId` and `agentId`.
|
|
1169
|
+
* @example
|
|
1170
|
+
* ```ts
|
|
1171
|
+
* import type { AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1172
|
+
*
|
|
1173
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1174
|
+
* onStreamCreated({ streamId, sessionId }) {
|
|
1175
|
+
* // The two ids D-ID support asks for when a session misbehaves.
|
|
1176
|
+
* console.log('stream', streamId, 'session', sessionId);
|
|
1177
|
+
* },
|
|
1178
|
+
* };
|
|
1179
|
+
* ```
|
|
985
1180
|
*/
|
|
986
1181
|
onStreamCreated?: (stream: StreamCreatedInfo) => void;
|
|
987
1182
|
/**
|
|
@@ -989,10 +1184,22 @@ export declare interface AgentManager {
|
|
|
989
1184
|
*
|
|
990
1185
|
* Expressive (V4) agents only. The handler takes two arguments and returns nothing: `event`,
|
|
991
1186
|
* one of {@link ToolCallEvent.Started}, {@link ToolCallEvent.Done} or
|
|
992
|
-
* {@link ToolCallEvent.Error}; and `data`, the payload that event
|
|
1187
|
+
* {@link ToolCallEvent.Error}; and `data`, the payload that event carries —
|
|
993
1188
|
* {@link ToolCallStartedPayload}, {@link ToolCallDonePayload} or
|
|
994
1189
|
* {@link ToolCallErrorPayload} respectively. The signature that does the narrowing is on
|
|
995
|
-
* {@link ToolEventCallback},
|
|
1190
|
+
* {@link ToolEventCallback}, which also carries a handler that branches on all three events.
|
|
1191
|
+
* @example
|
|
1192
|
+
* ```ts
|
|
1193
|
+
* import { ToolCallEvent, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1194
|
+
*
|
|
1195
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1196
|
+
* onToolEvent(event, data) {
|
|
1197
|
+
* if (event === ToolCallEvent.Error) {
|
|
1198
|
+
* showBanner(`${data.name} failed: ${data.error ?? 'no reason given'}`);
|
|
1199
|
+
* }
|
|
1200
|
+
* },
|
|
1201
|
+
* };
|
|
1202
|
+
* ```
|
|
996
1203
|
*/
|
|
997
1204
|
onToolEvent?: ToolEventCallback;
|
|
998
1205
|
/**
|
|
@@ -1004,6 +1211,16 @@ export declare interface AgentManager {
|
|
|
1004
1211
|
* {@link AgentManager.isInterruptAvailable | isInterruptAvailable()}, which says whether
|
|
1005
1212
|
* the session supports interrupting at all. Use this one to enable or disable an interrupt
|
|
1006
1213
|
* button. Talks (V2) and Clips (V3) agents never report a change.
|
|
1214
|
+
* @example
|
|
1215
|
+
* ```ts
|
|
1216
|
+
* import type { AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1217
|
+
*
|
|
1218
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1219
|
+
* onInterruptibleChange(interruptible) {
|
|
1220
|
+
* setStopButtonEnabled(interruptible);
|
|
1221
|
+
* },
|
|
1222
|
+
* };
|
|
1223
|
+
* ```
|
|
1007
1224
|
*/
|
|
1008
1225
|
onInterruptibleChange?: (
|
|
1009
1226
|
/** `true` while there is something to interrupt, `false` while there is not. */
|
|
@@ -1011,8 +1228,20 @@ export declare interface AgentManager {
|
|
|
1011
1228
|
/**
|
|
1012
1229
|
* Called whenever the set of tool calls running in the session changes.
|
|
1013
1230
|
*
|
|
1014
|
-
* Expressive (V4) agents only.
|
|
1015
|
-
* this callback always clears
|
|
1231
|
+
* Expressive (V4) agents only. On disconnect it fires with an empty array if any call was
|
|
1232
|
+
* still running, so a spinner driven by this callback always clears; with nothing outstanding
|
|
1233
|
+
* there is nothing to clear and nothing is emitted. Each entry is a {@link RunningToolCall}.
|
|
1234
|
+
* @example
|
|
1235
|
+
* ```ts
|
|
1236
|
+
* import { isAwaitingTool, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
1237
|
+
*
|
|
1238
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
1239
|
+
* onRunningToolCallsChange(calls) {
|
|
1240
|
+
* setSpinnerVisible(isAwaitingTool(calls));
|
|
1241
|
+
* setStatusText(calls.map(call => call.name).join(', '));
|
|
1242
|
+
* },
|
|
1243
|
+
* };
|
|
1244
|
+
* ```
|
|
1016
1245
|
*/
|
|
1017
1246
|
onRunningToolCallsChange?: (
|
|
1018
1247
|
/** Every tool call running right now, empty when none is. */
|
|
@@ -1112,7 +1341,7 @@ export declare interface AgentManager {
|
|
|
1112
1341
|
* Your own identifier for the end user.
|
|
1113
1342
|
*
|
|
1114
1343
|
* It is stored in `localStorage`, sent as part of the `type: 'key'` authorization header and
|
|
1115
|
-
* attached to analytics, so the same visitor is
|
|
1344
|
+
* attached to analytics, so the same visitor is recognized across page loads. When it is
|
|
1116
1345
|
* omitted the SDK generates an id and reuses it.
|
|
1117
1346
|
*/
|
|
1118
1347
|
externalId?: string;
|
|
@@ -1159,7 +1388,7 @@ export declare interface AgentManager {
|
|
|
1159
1388
|
/**
|
|
1160
1389
|
* Amazon provider details: the provider type and the requested voice id.
|
|
1161
1390
|
*
|
|
1162
|
-
* Pass it as {@link TextStreamScript.provider} to have Amazon
|
|
1391
|
+
* Pass it as {@link TextStreamScript.provider} to have Amazon synthesize the text. It is the one
|
|
1163
1392
|
* provider with no `voice_config`: the voice is selected by `voice_id` alone.
|
|
1164
1393
|
*
|
|
1165
1394
|
* @category Voice
|
|
@@ -1237,7 +1466,7 @@ export declare interface AgentManager {
|
|
|
1237
1466
|
* A script that makes the agent lip-sync an audio file you host, with no text-to-speech involved.
|
|
1238
1467
|
*
|
|
1239
1468
|
* The other payload {@link AgentManager.speak | speak()} accepts. Use it when the audio already
|
|
1240
|
-
* exists — a recording, or speech you
|
|
1469
|
+
* exists — a recording, or speech you synthesized yourself — instead of having a provider generate
|
|
1241
1470
|
* it from text.
|
|
1242
1471
|
*
|
|
1243
1472
|
* @example Audio file
|
|
@@ -1334,7 +1563,7 @@ export declare interface AgentManager {
|
|
|
1334
1563
|
* exception: a failure LiveKit raises inside a media call on an Expressive (V4) agent — no
|
|
1335
1564
|
* microphone publication to replace, a room that is not connected — rejects with a plain `Error`,
|
|
1336
1565
|
* and so do a few low-level guards inside {@link AgentManager.connect | connect()}, such as a
|
|
1337
|
-
* `livekit-client` package that is not installed, a transport the SDK does not
|
|
1566
|
+
* `livekit-client` package that is not installed, a transport the SDK does not recognize, or a
|
|
1338
1567
|
* stream the server created without a session id. An unknown
|
|
1339
1568
|
* {@link AgentManagerOptions.auth | auth} type is a plain `Error` too. So keep the
|
|
1340
1569
|
* `else throw error` branch in a handler built on {@link isDIDError}.
|
|
@@ -1411,7 +1640,8 @@ export declare interface AgentManager {
|
|
|
1411
1640
|
* @example An HttpError from a request that was refused
|
|
1412
1641
|
* ```json
|
|
1413
1642
|
* {
|
|
1414
|
-
* "kind": "
|
|
1643
|
+
* "kind": "HttpError",
|
|
1644
|
+
* "code": "InsufficientCreditsError",
|
|
1415
1645
|
* "message": "Account has insufficient credits",
|
|
1416
1646
|
* "httpStatus": 402,
|
|
1417
1647
|
* "endpoint": "/agt_x/chat/cht_y",
|
|
@@ -1549,12 +1779,10 @@ export declare interface AgentManager {
|
|
|
1549
1779
|
*/
|
|
1550
1780
|
Functional = "Functional",
|
|
1551
1781
|
/**
|
|
1552
|
-
* Text answers only: the chat works, but no video is produced.
|
|
1782
|
+
* Text answers only: the chat works over the Agents API, but no video is produced.
|
|
1553
1783
|
*
|
|
1554
|
-
*
|
|
1555
|
-
* {@link
|
|
1556
|
-
* {@link AgentManager.speak | speak()} adds a text script to the transcript but streams no
|
|
1557
|
-
* video: it resolves with a `duration` of `0` and an empty `videoId`.
|
|
1784
|
+
* Talks (V2) and Clips (V3) agents. Expressive (V4) agents chat over the streaming session,
|
|
1785
|
+
* which {@link AgentManager.connect | connect()} always opens in {@link ChatMode.Functional}.
|
|
1558
1786
|
*/
|
|
1559
1787
|
TextOnly = "TextOnly",
|
|
1560
1788
|
/**
|
|
@@ -1576,34 +1804,22 @@ export declare interface AgentManager {
|
|
|
1576
1804
|
*/
|
|
1577
1805
|
Playground = "Playground",
|
|
1578
1806
|
/**
|
|
1579
|
-
* Speak-only: no chat is created
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
1582
|
-
* {@link AgentManager.changeMode | changeMode()} reject it with a {@link ValidationError} for
|
|
1583
|
-
* Expressive (V4) agents.
|
|
1807
|
+
* Speak-only: no chat is created and no notifications web socket is opened, while video still
|
|
1808
|
+
* streams. Use it when the application drives the agent entirely through
|
|
1809
|
+
* {@link AgentManager.speak | speak()}.
|
|
1584
1810
|
*
|
|
1585
|
-
*
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1588
|
-
* agent entirely through {@link AgentManager.speak | speak()} and never asks its LLM anything.
|
|
1589
|
-
* The stream keeps running only when this is the mode {@link createAgentManager} was given;
|
|
1590
|
-
* switching into it later with {@link AgentManager.changeMode | changeMode()} disconnects the
|
|
1591
|
-
* stream like any other non-{@link ChatMode.Functional} mode.
|
|
1811
|
+
* Talks (V2) and Clips (V3) agents only; rejected with a {@link ValidationError} for Expressive
|
|
1812
|
+
* (V4) agents. {@link AgentManager.chat | chat()} rejects with a {@link ValidationError} in
|
|
1813
|
+
* this mode.
|
|
1592
1814
|
*/
|
|
1593
1815
|
DirectPlayback = "DirectPlayback",
|
|
1594
1816
|
/**
|
|
1595
|
-
* Chat is switched off: no chat is created for the session, while video still streams.
|
|
1596
|
-
*
|
|
1597
|
-
* Talks (V2) and Clips (V3) agents only; {@link createAgentManager} and
|
|
1598
|
-
* {@link AgentManager.changeMode | changeMode()} reject it with a {@link ValidationError} for
|
|
1599
|
-
* Expressive (V4) agents.
|
|
1817
|
+
* Chat is switched off: no chat is created for the session, while video still streams. Unlike
|
|
1818
|
+
* {@link ChatMode.DirectPlayback} it keeps the notifications web socket.
|
|
1600
1819
|
*
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
1604
|
-
* where {@link ChatMode.DirectPlayback} skips it. As with {@link ChatMode.DirectPlayback}, the
|
|
1605
|
-
* stream keeps running only when this is the mode set at creation; switching into it later with
|
|
1606
|
-
* {@link AgentManager.changeMode | changeMode()} disconnects the stream.
|
|
1820
|
+
* Talks (V2) and Clips (V3) agents only; rejected with a {@link ValidationError} for Expressive
|
|
1821
|
+
* (V4) agents. {@link AgentManager.chat | chat()} rejects with a {@link ValidationError} in
|
|
1822
|
+
* this mode.
|
|
1607
1823
|
*/
|
|
1608
1824
|
Off = "Off"
|
|
1609
1825
|
}
|
|
@@ -1957,7 +2173,7 @@ export declare interface AgentManager {
|
|
|
1957
2173
|
/**
|
|
1958
2174
|
* ElevenLabs provider details: the provider type and the requested voice id. Available to premium users.
|
|
1959
2175
|
*
|
|
1960
|
-
* Pass it as {@link TextStreamScript.provider} to have ElevenLabs
|
|
2176
|
+
* Pass it as {@link TextStreamScript.provider} to have ElevenLabs synthesize the text, optionally
|
|
1961
2177
|
* with {@link VoiceConfigElevenlabs} to control how closely the voice is reproduced.
|
|
1962
2178
|
*
|
|
1963
2179
|
* @category Voice
|
|
@@ -2204,7 +2420,7 @@ export declare interface AgentManager {
|
|
|
2204
2420
|
* `click` when they pressed a stop control, and `manual` for an interruption the application
|
|
2205
2421
|
* decided on itself.
|
|
2206
2422
|
*
|
|
2207
|
-
* The SDK records it with the interruption for analytics. It changes
|
|
2423
|
+
* The SDK records it with the interruption for analytics. It changes behavior in one case
|
|
2208
2424
|
* only: Expressive (V4) agents ignore a `text` interrupt, because their orchestrator does not
|
|
2209
2425
|
* cancel the answer already in flight. Talks (V2) and Clips (V3) agents interrupt the current
|
|
2210
2426
|
* video whatever the value.
|
|
@@ -2226,9 +2442,9 @@ export declare interface AgentManager {
|
|
|
2226
2442
|
* @returns `true` while the agent is suspended on a blocking tool call.
|
|
2227
2443
|
* @example
|
|
2228
2444
|
* ```ts
|
|
2229
|
-
* import { isAwaitingTool } from '@d-id/client-sdk';
|
|
2445
|
+
* import { isAwaitingTool, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
2230
2446
|
*
|
|
2231
|
-
* const callbacks = {
|
|
2447
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
2232
2448
|
* onRunningToolCallsChange(calls) {
|
|
2233
2449
|
* setSpinnerVisible(isAwaitingTool(calls));
|
|
2234
2450
|
* },
|
|
@@ -2384,8 +2600,8 @@ export declare interface AgentManager {
|
|
|
2384
2600
|
*
|
|
2385
2601
|
* {@link parseMessageParts} splits a message's {@link Message.content | content} into these, and
|
|
2386
2602
|
* the SDK keeps the result on {@link Message.parts}. Switch on `type` when rendering. Anything the
|
|
2387
|
-
* parser did not
|
|
2388
|
-
* nothing is dropped or reordered; a
|
|
2603
|
+
* parser did not recognize is preserved verbatim as a `text` part, in its original order, and
|
|
2604
|
+
* nothing is dropped or reordered; a recognized image, video or link replaces the markup it was
|
|
2389
2605
|
* written as, so the parts are not a concatenation of the original string.
|
|
2390
2606
|
*
|
|
2391
2607
|
* @category Chat
|
|
@@ -2553,12 +2769,12 @@ export declare interface AgentManager {
|
|
|
2553
2769
|
* {@link Message.parts}, so this is for content that comes from somewhere else — a transcript you
|
|
2554
2770
|
* render outside the SDK, or text you assembled before handing it to a renderer.
|
|
2555
2771
|
* {@link AgentManagerOptions.initialMessages | initialMessages} no longer need it: pass `parts: []`
|
|
2556
|
-
* and the SDK runs this for you. It
|
|
2772
|
+
* and the SDK runs this for you. It recognizes markdown
|
|
2557
2773
|
* images (``), the video thumbnail form (`[](video)`), markdown links
|
|
2558
2774
|
* (`[label](url)`) and HTML anchors (`<a href="url">label</a>`); an image whose URL looks like a
|
|
2559
2775
|
* video becomes a `video` part instead, and a GIF is tagged with a `mimeType`, both under the rules
|
|
2560
|
-
* {@link MessagePart} sets out. Everything the parser does not
|
|
2561
|
-
* `text` part, in its original order, and nothing is dropped or reordered; each
|
|
2776
|
+
* {@link MessagePart} sets out. Everything the parser does not recognize is preserved verbatim as a
|
|
2777
|
+
* `text` part, in its original order, and nothing is dropped or reordered; each recognized part
|
|
2562
2778
|
* replaces the markup it was written as, so the parts are not a concatenation of the input.
|
|
2563
2779
|
*
|
|
2564
2780
|
* @param content - The message text to split, as it appears in {@link Message.content}.
|
|
@@ -2585,7 +2801,7 @@ export declare interface AgentManager {
|
|
|
2585
2801
|
* The value of the `type` field that discriminates the provider objects — {@link Providers.Microsoft}
|
|
2586
2802
|
* selects a {@link MicrosoftTtsProvider}, {@link Providers.Elevenlabs} an
|
|
2587
2803
|
* {@link ElevenlabsTtsProvider}, and so on — and of {@link Voice.provider} when you look a voice up
|
|
2588
|
-
* in D-ID's
|
|
2804
|
+
* in D-ID's catalog. Which providers an account may use depends on its plan.
|
|
2589
2805
|
*
|
|
2590
2806
|
* @category Voice
|
|
2591
2807
|
*/
|
|
@@ -2797,7 +3013,7 @@ export declare interface AgentManager {
|
|
|
2797
3013
|
* {@link ConnectionState.Disconnected | 'disconnected'}, and is how you tell a session the server
|
|
2798
3014
|
* closed on purpose from a connection that simply dropped — `reason` is an opaque transport
|
|
2799
3015
|
* diagnostic in the latter case, so compare it against these values rather than parsing it. A
|
|
2800
|
-
* close reason the SDK does not
|
|
3016
|
+
* close reason the SDK does not recognize is forwarded as-is, which is the other reason to compare
|
|
2801
3017
|
* against the enum. Which members can arrive depends on the agent type: Talks (V2) and Clips (V3)
|
|
2802
3018
|
* agents report only {@link StreamEndReason.Ok | Ok},
|
|
2803
3019
|
* {@link StreamEndReason.UnknownError | UnknownError},
|
|
@@ -2808,9 +3024,9 @@ export declare interface AgentManager {
|
|
|
2808
3024
|
*
|
|
2809
3025
|
* @example Reacting to the limits an Expressive (V4) session reports
|
|
2810
3026
|
* ```ts
|
|
2811
|
-
* import { ConnectionState, StreamEndReason } from '@d-id/client-sdk';
|
|
3027
|
+
* import { ConnectionState, StreamEndReason, type AgentManagerCallbacks } from '@d-id/client-sdk';
|
|
2812
3028
|
*
|
|
2813
|
-
* const callbacks = {
|
|
3029
|
+
* const callbacks: AgentManagerCallbacks = {
|
|
2814
3030
|
* onConnectionStateChange(state, reason) {
|
|
2815
3031
|
* if (state !== ConnectionState.Disconnected) return;
|
|
2816
3032
|
*
|
|
@@ -3023,7 +3239,7 @@ export declare interface AgentManager {
|
|
|
3023
3239
|
}
|
|
3024
3240
|
|
|
3025
3241
|
/**
|
|
3026
|
-
* A script that makes the agent say text you supply,
|
|
3242
|
+
* A script that makes the agent say text you supply, synthesized by a text-to-speech provider.
|
|
3027
3243
|
*
|
|
3028
3244
|
* The usual payload for {@link AgentManager.speak | speak()}. The agent's LLM is not involved, so
|
|
3029
3245
|
* the agent says exactly what {@link TextStreamScript.input | input} contains — which is what makes
|
|
@@ -3056,7 +3272,7 @@ export declare interface AgentManager {
|
|
|
3056
3272
|
*/
|
|
3057
3273
|
type: 'text';
|
|
3058
3274
|
/**
|
|
3059
|
-
* The text-to-speech provider and voice that
|
|
3275
|
+
* The text-to-speech provider and voice that synthesize
|
|
3060
3276
|
* {@link TextStreamScript.input | input}, from the list of supported providers.
|
|
3061
3277
|
*
|
|
3062
3278
|
* One of the objects in {@link TtsProvider}: a `type` naming the provider, the
|
|
@@ -3066,7 +3282,7 @@ export declare interface AgentManager {
|
|
|
3066
3282
|
*/
|
|
3067
3283
|
provider?: TtsProvider;
|
|
3068
3284
|
/**
|
|
3069
|
-
* The text to be
|
|
3285
|
+
* The text to be synthesized into speech.
|
|
3070
3286
|
*
|
|
3071
3287
|
* Each provider has its own limit on the text length.
|
|
3072
3288
|
* @example "This is an example text"
|
|
@@ -3389,7 +3605,7 @@ export declare interface AgentManager {
|
|
|
3389
3605
|
}
|
|
3390
3606
|
|
|
3391
3607
|
/**
|
|
3392
|
-
* One voice in D-ID's
|
|
3608
|
+
* One voice in D-ID's catalog of text-to-speech voices.
|
|
3393
3609
|
*
|
|
3394
3610
|
* The SDK does not fetch voices itself; the type is exported so an application that lists them —
|
|
3395
3611
|
* to build a voice picker, say — can type the result and then feed {@link Voice.id | id} and
|
|
@@ -3456,7 +3672,7 @@ export declare interface AgentManager {
|
|
|
3456
3672
|
*/
|
|
3457
3673
|
stability?: number;
|
|
3458
3674
|
/**
|
|
3459
|
-
* How closely the
|
|
3675
|
+
* How closely the synthesized speech should adhere to the original voice it was cloned from.
|
|
3460
3676
|
*
|
|
3461
3677
|
* A number from 0 to 1: higher follows the original more strictly.
|
|
3462
3678
|
* @example 0.5
|