@nuancelabs/js-sdk 0.4.0 → 0.5.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/index.d.ts +54 -0
- package/index.js +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -318,6 +318,26 @@ export declare interface CreateNuanceConversationOptions {
|
|
|
318
318
|
* ```
|
|
319
319
|
*/
|
|
320
320
|
token?: () => Promise<string>;
|
|
321
|
+
/**
|
|
322
|
+
* Who the avatar is in the conversation, such as your own
|
|
323
|
+
* {@link SessionPersonality.system_prompt}. Left out, it is the default
|
|
324
|
+
* personality.
|
|
325
|
+
*
|
|
326
|
+
* Only for a conversation the SDK creates with your API key (see
|
|
327
|
+
* {@link CreateNuanceConversationOptions.headers}). With a
|
|
328
|
+
* {@link CreateNuanceConversationOptions.token}, set it when your server
|
|
329
|
+
* mints the token instead: the token fixes it, and a conversation that sets
|
|
330
|
+
* its own is refused.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* createNuanceConversation({
|
|
335
|
+
* headers: () => ({ Authorization: `Bearer ${process.env.NUANCE_API_KEY}` }),
|
|
336
|
+
* personality: { system_prompt: "You are Sam, at Acme Bank..." },
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
personality?: PersonalityChoice;
|
|
321
341
|
/**
|
|
322
342
|
* Capture constraints for the user's camera.
|
|
323
343
|
*
|
|
@@ -402,6 +422,12 @@ export declare type MediaErrorReason = "permission-denied" | "device-not-found"
|
|
|
402
422
|
*/
|
|
403
423
|
export declare type NetworkQuality = "good" | "poor" | "lost";
|
|
404
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Who the avatar is in a conversation created with
|
|
427
|
+
* {@link CreateNuanceConversationOptions.personality}.
|
|
428
|
+
*/
|
|
429
|
+
export declare interface PersonalityChoice extends SessionPersonality {
|
|
430
|
+
}
|
|
405
431
|
|
|
406
432
|
/**
|
|
407
433
|
* Raised by {@link Conversation.connect} when the server refuses a new session
|
|
@@ -424,6 +450,34 @@ export declare type SessionEndReason = "time-limit" | "ended" | "policy-violatio
|
|
|
424
450
|
|
|
425
451
|
|
|
426
452
|
|
|
453
|
+
/** Who the avatar is in a conversation. */
|
|
454
|
+
export declare interface SessionPersonality {
|
|
455
|
+
/**
|
|
456
|
+
* Your own prompt: who the avatar is, where it works, and what it knows
|
|
457
|
+
* about the person and the situation, written as you would brief a person
|
|
458
|
+
* before a call, in plain text.
|
|
459
|
+
*/
|
|
460
|
+
system_prompt?: string;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* What your server sends to `POST /session-tokens` with its API key. Every
|
|
465
|
+
* field is fixed for the conversation the token starts; send `{}` for the
|
|
466
|
+
* defaults.
|
|
467
|
+
*/
|
|
468
|
+
export declare interface SessionTokenRequest {
|
|
469
|
+
/** Who the avatar is in the conversation. Leave it out for the default personality. */
|
|
470
|
+
personality?: SessionPersonality;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** What `POST /session-tokens` returns. */
|
|
474
|
+
export declare interface SessionTokenResponse {
|
|
475
|
+
/** The session token, `st_…`: pass it to {@link CreateNuanceConversationOptions.token}. */
|
|
476
|
+
token: string;
|
|
477
|
+
/** When the token stops being able to start a conversation (UTC, ISO 8601). */
|
|
478
|
+
expires_at: string;
|
|
479
|
+
}
|
|
480
|
+
|
|
427
481
|
/** When the avatar starts speaking: see {@link CreateNuanceConversationOptions.startOn}. */
|
|
428
482
|
export declare type StartOn = "first-frame" | "full-quality";
|
|
429
483
|
|
package/index.js
CHANGED