diff --git a/.changeset/tidy-phones-configure.md b/.changeset/tidy-phones-configure.md new file mode 100644 index 000000000..b911b2236 --- /dev/null +++ b/.changeset/tidy-phones-configure.md @@ -0,0 +1,5 @@ +--- +'@livekit/agents-plugin-phonic': patch +--- + +Add `additionalParams` support to the Phonic realtime model. diff --git a/plugins/phonic/package.json b/plugins/phonic/package.json index fd32d39f0..7c8d93f0b 100644 --- a/plugins/phonic/package.json +++ b/plugins/phonic/package.json @@ -41,7 +41,7 @@ "typescript": "^5.0.0" }, "dependencies": { - "phonic": "^0.32.5" + "phonic": "^0.32.9" }, "peerDependencies": { "@livekit/agents": "workspace:*", diff --git a/plugins/phonic/src/realtime/realtime_model.ts b/plugins/phonic/src/realtime/realtime_model.ts index 6ccfb2102..b2c3d245b 100644 --- a/plugins/phonic/src/realtime/realtime_model.ts +++ b/plugins/phonic/src/realtime/realtime_model.ts @@ -53,6 +53,7 @@ export interface RealtimeModelOptions { noInputPokeSec?: number; noInputPokeText?: string; noInputEndConversationSec?: number; + additionalParams?: NonNullable; forbidSpeechAfterToolCall?: string[]; onConversationCreated?: (conversationId: string) => void; /** Set by `updateInstructions` via `voice.Agent` rather than the RealtimeModel constructor */ @@ -155,6 +156,10 @@ export class RealtimeModel extends llm.RealtimeModel { * Seconds of silence before ending conversation */ noInputEndConversationSec?: number; + /** + * Additional runtime parameters forwarded to Phonic + */ + additionalParams?: NonNullable; /** * Names of tools after which Phonic should NOT auto-generate a spoken reply. * @@ -231,6 +236,7 @@ export class RealtimeModel extends llm.RealtimeModel { noInputPokeSec: options.noInputPokeSec, noInputPokeText: options.noInputPokeText, noInputEndConversationSec: options.noInputEndConversationSec, + additionalParams: options.additionalParams, forbidSpeechAfterToolCall: options.forbidSpeechAfterToolCall, onConversationCreated: options.onConversationCreated, connOptions: options.connOptions ?? DEFAULT_API_CONNECT_OPTIONS, @@ -964,6 +970,7 @@ export class RealtimeSession extends llm.RealtimeSession { no_input_poke_sec: this.options.noInputPokeSec, no_input_poke_text: this.options.noInputPokeText, no_input_end_conversation_sec: this.options.noInputEndConversationSec, + additional_params: this.options.additionalParams, stream_ahead_of_real_time: true, }; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 82d1874db..7d4f3ae97 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1131,8 +1131,8 @@ importers: plugins/phonic: dependencies: phonic: - specifier: ^0.32.5 - version: 0.32.7 + specifier: ^0.32.9 + version: 0.32.9 devDependencies: '@livekit/agents': specifier: workspace:* @@ -4456,8 +4456,8 @@ packages: pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} - phonic@0.32.7: - resolution: {integrity: sha512-F0rAJrj78QLTyBO05Z/w2wMw56CaA5IRge1U3BK1TA144esxMcvJ+3qXZGWf4BVf/UaTStBLLfcTrJOgflpa9Q==} + phonic@0.32.9: + resolution: {integrity: sha512-eYY7CY9PULChjxxs0xqS7qawDksu2tq4vW9raWC+gNOQi6iwvI+ibIcnKinp0HEP9nDgTNyil8/J+xodHERwPg==} engines: {node: '>=18.0.0'} picocolors@1.1.1: @@ -8442,7 +8442,7 @@ snapshots: pathe@2.0.3: {} - phonic@0.32.7: + phonic@0.32.9: dependencies: ws: 8.20.0 transitivePeerDependencies: