@happyrobot-ai/sdk 0.1.43 → 0.1.44
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 +18 -4
- package/package.json +1 -1
- package/resources/voice.d.ts +3 -1
- package/resources/voice.js +12 -0
- package/types/voice.types.d.ts +16 -0
- package/voice/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -136,7 +136,7 @@ const { workflow } = await createFromTemplate(client, {
|
|
|
136
136
|
| `client.issues` | `IssuesResource` | Quality issue (flag) status management |
|
|
137
137
|
| `client.auditRemarks` | `AuditRemarksResource` | Audit remark feedback management |
|
|
138
138
|
| `client.chat` | `ChatResource` | Chat session management, messaging, and file uploads |
|
|
139
|
-
| `client.voice` | `VoiceResource` | Voice call token creation
|
|
139
|
+
| `client.voice` | `VoiceResource` | Voice catalog lookup and call token creation |
|
|
140
140
|
|
|
141
141
|
---
|
|
142
142
|
|
|
@@ -1046,9 +1046,23 @@ await connection.disconnect();
|
|
|
1046
1046
|
|
|
1047
1047
|
### `HappyRobotClient` (server-side)
|
|
1048
1048
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1049
|
+
List the voices available to the current workspace in its cluster. Use a
|
|
1050
|
+
language prefix for all accents, or a locale for a location-specific result:
|
|
1051
|
+
|
|
1052
|
+
```ts
|
|
1053
|
+
const voices = await client.voice.list({ language: "en-GB" });
|
|
1054
|
+
|
|
1055
|
+
for (const voice of voices) {
|
|
1056
|
+
console.log(voice.id, voice.name, voice.locales);
|
|
1057
|
+
}
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
`voice.id` is the value used in workflow `agent.voices` configuration.
|
|
1061
|
+
|
|
1062
|
+
| Method | Description |
|
|
1063
|
+
| ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
1064
|
+
| `client.voice.list({ language? })` | List voices available to the current workspace. `language` accepts prefixes like `en` or locales like `en-GB`. |
|
|
1065
|
+
| `client.voice.createToken({ workflow_id, data?, env?, ttl_seconds? })` | Create a LiveKit token for voice calls. `ttl_seconds` defaults to 21600 (min 60, max 86400). |
|
|
1052
1066
|
|
|
1053
1067
|
### `HappyRobotVoiceClient` (browser-side)
|
|
1054
1068
|
|
package/package.json
CHANGED
package/resources/voice.d.ts
CHANGED
|
@@ -23,10 +23,12 @@
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
import type { HttpClient } from "../core/http";
|
|
26
|
-
import type { CreateVoiceTokenBody, CreateVoiceTokenResponse } from "../types/voice.types";
|
|
26
|
+
import type { CreateVoiceTokenBody, CreateVoiceTokenResponse, ListVoicesQuery, ListVoicesResponse } from "../types/voice.types";
|
|
27
27
|
export declare class VoiceResource {
|
|
28
28
|
private readonly http;
|
|
29
29
|
constructor(http: HttpClient);
|
|
30
|
+
/** List visible voices available in the configured HappyRobot cluster. */
|
|
31
|
+
list(query?: ListVoicesQuery): Promise<ListVoicesResponse>;
|
|
30
32
|
/**
|
|
31
33
|
* Create a LiveKit token for browser-side voice calls.
|
|
32
34
|
*
|
package/resources/voice.js
CHANGED
|
@@ -30,6 +30,18 @@ class VoiceResource {
|
|
|
30
30
|
constructor(http) {
|
|
31
31
|
this.http = http;
|
|
32
32
|
}
|
|
33
|
+
/** List visible voices available in the configured HappyRobot cluster. */
|
|
34
|
+
async list(query) {
|
|
35
|
+
return this.http.request({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: "/voices",
|
|
38
|
+
...(query
|
|
39
|
+
? {
|
|
40
|
+
query: query,
|
|
41
|
+
}
|
|
42
|
+
: {}),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
33
45
|
/**
|
|
34
46
|
* Create a LiveKit token for browser-side voice calls.
|
|
35
47
|
*
|
package/types/voice.types.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
export interface ListVoicesQuery {
|
|
2
|
+
language?: string;
|
|
3
|
+
}
|
|
4
|
+
export interface Voice {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
provider: "elevenlabs" | "happyrobot" | "elevenlabs-non-streaming" | "cartesia";
|
|
8
|
+
provider_voice_id: string | null;
|
|
9
|
+
model_id: string | null;
|
|
10
|
+
model_family: "turbo" | "flash" | "eleven_v3" | "happyrobot" | "sonic";
|
|
11
|
+
language: string;
|
|
12
|
+
languages: string[];
|
|
13
|
+
locales: string[];
|
|
14
|
+
gender: "male" | "female";
|
|
15
|
+
}
|
|
16
|
+
export type ListVoicesResponse = Voice[];
|
|
1
17
|
type CreateVoiceTokenBase = {
|
|
2
18
|
/** Payload data passed to the voice agent as participant attributes (`workflow_id` only). */
|
|
3
19
|
data?: Record<string, unknown>;
|
package/voice/index.d.ts
CHANGED
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export { HappyRobotVoiceClient } from "../voice-client";
|
|
21
21
|
export type { VoiceConnectionHandlers, VoiceConnection } from "../voice-client";
|
|
22
|
-
export type { CreateVoiceTokenBody, CreateVoiceTokenResponse, } from "../types/voice.types";
|
|
22
|
+
export type { CreateVoiceTokenBody, CreateVoiceTokenResponse, ListVoicesQuery, ListVoicesResponse, Voice, } from "../types/voice.types";
|