phonic 0.18.3 → 0.18.5
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 -5
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ const phonic = new Phonic("ph_...");
|
|
|
37
37
|
### Get voices
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
const { data, error } = await phonic.voices.list({ model: "
|
|
40
|
+
const { data, error } = await phonic.voices.list({ model: "merritt" });
|
|
41
41
|
|
|
42
42
|
if (error === null) {
|
|
43
43
|
console.log(data.voices);
|
|
@@ -48,7 +48,7 @@ if (error === null) {
|
|
|
48
48
|
### Get voice by id
|
|
49
49
|
|
|
50
50
|
```ts
|
|
51
|
-
const { data, error } = await phonic.voices.get("
|
|
51
|
+
const { data, error } = await phonic.voices.get("grant");
|
|
52
52
|
|
|
53
53
|
if (error === null) {
|
|
54
54
|
console.log(data.voice);
|
|
@@ -102,12 +102,13 @@ const { data, error } = await phonic.sts.outboundCall("+19189396241", {
|
|
|
102
102
|
welcome_message: "Hello, how can I help you?",
|
|
103
103
|
project: "main",
|
|
104
104
|
system_prompt: "You are a helpful assistant.",
|
|
105
|
-
voice_id: "
|
|
105
|
+
voice_id: "grant",
|
|
106
106
|
enable_silent_audio_fallback: true,
|
|
107
107
|
vad_prebuffer_duration_ms: 1800,
|
|
108
108
|
vad_min_speech_duration_ms: 40,
|
|
109
109
|
vad_min_silence_duration_ms: 550,
|
|
110
110
|
vad_threshold: 0.6,
|
|
111
|
+
tools: ["send_dtmf_tone", "end_conversation"], // these are the only available tools so far
|
|
111
112
|
});
|
|
112
113
|
```
|
|
113
114
|
|
|
@@ -129,12 +130,13 @@ const { data, error } = await phonic.sts.twilio.outboundCall(
|
|
|
129
130
|
welcome_message: "Hello, how can I help you?",
|
|
130
131
|
project: "main",
|
|
131
132
|
system_prompt: "You are a helpful assistant.",
|
|
132
|
-
voice_id: "
|
|
133
|
+
voice_id: "grant",
|
|
133
134
|
enable_silent_audio_fallback: true,
|
|
134
135
|
vad_prebuffer_duration_ms: 1800,
|
|
135
136
|
vad_min_speech_duration_ms: 40,
|
|
136
137
|
vad_min_silence_duration_ms: 550,
|
|
137
138
|
vad_threshold: 0.6,
|
|
139
|
+
tools: ["send_dtmf_tone", "end_conversation"], // these are the only available tools so far
|
|
138
140
|
}
|
|
139
141
|
);
|
|
140
142
|
```
|
|
@@ -151,13 +153,14 @@ const phonicWebSocket = phonic.sts.websocket({
|
|
|
151
153
|
project: "main",
|
|
152
154
|
system_prompt: "You are a helpful assistant.",
|
|
153
155
|
welcome_message: "Hello, how can I help you?",
|
|
154
|
-
voice_id: "
|
|
156
|
+
voice_id: "grant",
|
|
155
157
|
output_format: "mulaw_8000",
|
|
156
158
|
enable_silent_audio_fallback: true,
|
|
157
159
|
vad_prebuffer_duration_ms: 1800,
|
|
158
160
|
vad_min_speech_duration_ms: 40,
|
|
159
161
|
vad_min_silence_duration_ms: 550,
|
|
160
162
|
vad_threshold: 0.6,
|
|
163
|
+
tools: ["send_dtmf_tone", "end_conversation"], // these are the only available tools so far
|
|
161
164
|
});
|
|
162
165
|
```
|
|
163
166
|
|
|
@@ -278,6 +281,16 @@ Sent after the last "audio_chunk" is sent.
|
|
|
278
281
|
|
|
279
282
|
Sent when the user interrupts the assistant, after the user has finished speaking.
|
|
280
283
|
|
|
284
|
+
#### `assistant_ended_conversation`
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
{
|
|
288
|
+
type: "assistant_ended_conversation";
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Sent when the assistant decides to end the conversation.
|
|
293
|
+
|
|
281
294
|
## License
|
|
282
295
|
|
|
283
296
|
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -80,6 +80,7 @@ declare class Conversations {
|
|
|
80
80
|
}): DataOrError<ConversationsSuccessResponse>;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
type PhonicSTSTool = "send_dtmf_tone" | "end_conversation";
|
|
83
84
|
type PhonicSTSConfig = {
|
|
84
85
|
project: string;
|
|
85
86
|
input_format: "pcm_44100" | "mulaw_8000";
|
|
@@ -89,6 +90,7 @@ type PhonicSTSConfig = {
|
|
|
89
90
|
output_format?: "pcm_44100" | "mulaw_8000";
|
|
90
91
|
enable_silent_audio_fallback?: boolean;
|
|
91
92
|
experimental_params?: Record<string, unknown>;
|
|
93
|
+
tools?: Array<PhonicSTSTool>;
|
|
92
94
|
vad_prebuffer_duration_ms?: number;
|
|
93
95
|
vad_min_speech_duration_ms?: number;
|
|
94
96
|
vad_min_silence_duration_ms?: number;
|
|
@@ -109,6 +111,8 @@ type PhonicSTSWebSocketResponseMessage = {
|
|
|
109
111
|
} | {
|
|
110
112
|
type: "interrupted_response";
|
|
111
113
|
interruptedResponse: string;
|
|
114
|
+
} | {
|
|
115
|
+
type: "assistant_ended_conversation";
|
|
112
116
|
} | {
|
|
113
117
|
type: "error";
|
|
114
118
|
error: {
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ declare class Conversations {
|
|
|
80
80
|
}): DataOrError<ConversationsSuccessResponse>;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
type PhonicSTSTool = "send_dtmf_tone" | "end_conversation";
|
|
83
84
|
type PhonicSTSConfig = {
|
|
84
85
|
project: string;
|
|
85
86
|
input_format: "pcm_44100" | "mulaw_8000";
|
|
@@ -89,6 +90,7 @@ type PhonicSTSConfig = {
|
|
|
89
90
|
output_format?: "pcm_44100" | "mulaw_8000";
|
|
90
91
|
enable_silent_audio_fallback?: boolean;
|
|
91
92
|
experimental_params?: Record<string, unknown>;
|
|
93
|
+
tools?: Array<PhonicSTSTool>;
|
|
92
94
|
vad_prebuffer_duration_ms?: number;
|
|
93
95
|
vad_min_speech_duration_ms?: number;
|
|
94
96
|
vad_min_silence_duration_ms?: number;
|
|
@@ -109,6 +111,8 @@ type PhonicSTSWebSocketResponseMessage = {
|
|
|
109
111
|
} | {
|
|
110
112
|
type: "interrupted_response";
|
|
111
113
|
interruptedResponse: string;
|
|
114
|
+
} | {
|
|
115
|
+
type: "assistant_ended_conversation";
|
|
112
116
|
} | {
|
|
113
117
|
type: "error";
|
|
114
118
|
error: {
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED