Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eighty-olives-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@livekit/agents-plugin-phonic': patch
---

Update Phonic plugin languages fields
4 changes: 3 additions & 1 deletion plugins/phonic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ Set the `PHONIC_API_KEY` environment variable, or pass `apiKey` directly to `Rea
| `welcomeMessage` | `string` | Message the agent says when the conversation starts. Ignored when `generateWelcomeMessage` is true |
| `generateWelcomeMessage` | `boolean` | Auto-generate the welcome message (ignores `welcomeMessage`) |
| `project` | `string` | Project name (default: `main`) |
| `languages` | `string[]` | ISO 639-1 language codes the agent should recognize and speak |
| `defaultLanguage` | `string` | ISO 639-1 default language for recognition and speech |
| `additionalLanguages` | `string[]` | Further ISO 639-1 codes (must not repeat `defaultLanguage`) |
| `multilingualMode` | `'auto'` \| `'request'` | Per-utterance language detection vs. change on user request (recommended: `request`) |
| `audioSpeed` | `number` | Audio playback speed |
| `phonicTools` | `string[]` | [Phonic Webhook tool](https://docs.phonic.co/docs/using-tools/tools_overview#webhook-tools) names available to the assistant |
| `boostedKeywords` | `string[]` | Keywords to boost in speech recognition |
Expand Down
2 changes: 1 addition & 1 deletion plugins/phonic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"typescript": "^5.0.0"
},
"dependencies": {
"phonic": "^0.31.2"
"phonic": "^0.31.8"
},
"peerDependencies": {
"@livekit/agents": "workspace:*",
Expand Down
30 changes: 25 additions & 5 deletions plugins/phonic/src/realtime/realtime_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export interface RealtimeModelOptions {
project?: string;
connOptions: APIConnectOptions;
baseUrl?: string;
languages?: string[];
defaultLanguage?: string;
additionalLanguages?: string[];
multilingualMode?: 'auto' | 'request';
audioSpeed?: number;
phonicTools?: string[];
boostedKeywords?: string[];
Expand Down Expand Up @@ -85,9 +87,17 @@ export class RealtimeModel extends llm.RealtimeModel {
*/
project?: string;
/**
* ISO 639-1 language codes the agent should recognize and speak
* ISO 639-1 default language for recognition and speech
*/
languages?: string[];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to leave this in there for backwards compatibility for a bit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, added this field back in.

defaultLanguage?: string;
/**
* Further ISO 639-1 codes (must not include `defaultLanguage`)
*/
additionalLanguages?: string[];
/**
* `auto`: detect language per utterance. `request`: switch only when the user asks (recommended).
*/
multilingualMode?: 'auto' | 'request';
/**
* Audio playback speed
*/
Expand Down Expand Up @@ -144,7 +154,9 @@ export class RealtimeModel extends llm.RealtimeModel {
project: options.project,
welcomeMessage: options.welcomeMessage,
generateWelcomeMessage: options.generateWelcomeMessage,
languages: options.languages,
defaultLanguage: options.defaultLanguage,
additionalLanguages: options.additionalLanguages,
multilingualMode: options.multilingualMode,
audioSpeed: options.audioSpeed,
phonicTools: options.phonicTools,
boostedKeywords: options.boostedKeywords,
Expand Down Expand Up @@ -457,7 +469,15 @@ export class RealtimeSession extends llm.RealtimeSession {
voice_id: this.options.voice,
input_format: 'pcm_44100',
output_format: 'pcm_44100',
recognized_languages: this.options.languages,
...(this.options.defaultLanguage !== undefined && {
default_language: this.options.defaultLanguage,
}),
...(this.options.additionalLanguages !== undefined && {
additional_languages: this.options.additionalLanguages,
}),
...(this.options.multilingualMode !== undefined && {
multilingual_mode: this.options.multilingualMode,
}),
audio_speed: this.options.audioSpeed,
tools: [...(this.options.phonicTools ?? []), ...this.toolDefinitions],
boosted_keywords: this.options.boostedKeywords,
Expand Down
33 changes: 26 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading