mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-07-04 19:32:01 +00:00
support google s2s host, version, sessionResumption (#1498)
This commit is contained in:
@@ -36,6 +36,9 @@ class TaskLlmGoogle_S2S extends Task {
|
|||||||
this.model = this.parent.model || 'models/gemini-2.0-flash-live-001';
|
this.model = this.parent.model || 'models/gemini-2.0-flash-live-001';
|
||||||
this.auth = this.parent.auth;
|
this.auth = this.parent.auth;
|
||||||
this.connectionOptions = this.parent.connectOptions;
|
this.connectionOptions = this.parent.connectOptions;
|
||||||
|
const {host, version} = this.connectionOptions || {};
|
||||||
|
this.host = host;
|
||||||
|
this.version = version;
|
||||||
|
|
||||||
const {apiKey} = this.auth || {};
|
const {apiKey} = this.auth || {};
|
||||||
if (!apiKey) throw new Error('auth.apiKey is required for Google S2S');
|
if (!apiKey) throw new Error('auth.apiKey is required for Google S2S');
|
||||||
@@ -46,7 +49,7 @@ class TaskLlmGoogle_S2S extends Task {
|
|||||||
this.eventHook = this.data.eventHook;
|
this.eventHook = this.data.eventHook;
|
||||||
this.toolHook = this.data.toolHook;
|
this.toolHook = this.data.toolHook;
|
||||||
|
|
||||||
const {setup} = this.data.llmOptions;
|
const {setup, sessionResumption} = this.data.llmOptions;
|
||||||
|
|
||||||
if (typeof setup !== 'object') {
|
if (typeof setup !== 'object') {
|
||||||
throw new Error('llmOptions with an initial setup is required for Google S2S');
|
throw new Error('llmOptions with an initial setup is required for Google S2S');
|
||||||
@@ -54,6 +57,7 @@ class TaskLlmGoogle_S2S extends Task {
|
|||||||
this.setup = {
|
this.setup = {
|
||||||
...setup,
|
...setup,
|
||||||
model: this.model,
|
model: this.model,
|
||||||
|
...(sessionResumption && {sessionResumption}),
|
||||||
// make sure output is always audio
|
// make sure output is always audio
|
||||||
generationConfig: {
|
generationConfig: {
|
||||||
...(setup.generationConfig || {}),
|
...(setup.generationConfig || {}),
|
||||||
@@ -138,6 +142,10 @@ class TaskLlmGoogle_S2S extends Task {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const args = [ep.uuid, 'session.create', this.apiKey];
|
const args = [ep.uuid, 'session.create', this.apiKey];
|
||||||
|
if (this.host) {
|
||||||
|
args.push(this.host);
|
||||||
|
if (this.version) args.push(this.version);
|
||||||
|
}
|
||||||
await this._api(ep, args);
|
await this._api(ep, args);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error({err}, 'TaskLlmGoogle_S2S:_startListening');
|
this.logger.error({err}, 'TaskLlmGoogle_S2S:_startListening');
|
||||||
|
|||||||
Reference in New Issue
Block a user