mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Feat/llm update (#936)
* add support for llm:update during LLM session * make sure to end openai session when Llm task is killed * wip * wip * wip * wip * wip * wip * wip
This commit is contained in:
@@ -1590,17 +1590,29 @@ Duration=${duration} `
|
||||
}
|
||||
|
||||
_lccToolOutput(tool_call_id, opts, callSid) {
|
||||
// this whole thing requires us to be in a Dial verb
|
||||
// only valid if we are in an LLM verb
|
||||
const task = this.currentTask;
|
||||
if (!task || !task.name.startsWith('Llm')) {
|
||||
return this.logger.info('CallSession:_lccToolOutput - invalid command since we are not in an llm');
|
||||
}
|
||||
|
||||
task.processToolOutput(tool_call_id, opts)
|
||||
task.processToolOutput(tool_call_id, opts, callSid)
|
||||
.catch((err) => this.logger.error(err, 'CallSession:_lccToolOutput'));
|
||||
}
|
||||
|
||||
|
||||
_lccLlmUpdate(opts, callSid) {
|
||||
// only valid if we are in an LLM verb
|
||||
const task = this.currentTask;
|
||||
if (!task || !task.name.startsWith('Llm')) {
|
||||
return this.logger.info('CallSession:_lccLlmUpdate - invalid command since we are not in an llm');
|
||||
}
|
||||
|
||||
task.processLlmUpdate(opts, callSid)
|
||||
.catch((err) => this.logger.error(err, 'CallSession:_lccLlmUpdate'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* perform call hangup by jambonz
|
||||
*/
|
||||
@@ -1660,6 +1672,12 @@ Duration=${duration} `
|
||||
else if (opts.boostAudioSignal) {
|
||||
return this._lccBoostAudioSignal(opts, callSid);
|
||||
}
|
||||
else if (opts.llm_tool_output) {
|
||||
return this._lccToolOutput(opts.tool_call_id, opts.llm_tool_output, callSid);
|
||||
}
|
||||
else if (opts.llm_update) {
|
||||
return this._lccLlmUpdate(opts.llm_update, callSid);
|
||||
}
|
||||
|
||||
// whisper may be the only thing we are asked to do, or it may that
|
||||
// we are doing a whisper after having muted, paused recording etc..
|
||||
@@ -1961,6 +1979,10 @@ Duration=${duration} `
|
||||
this._lccToolOutput(tool_call_id, data, call_sid);
|
||||
break;
|
||||
|
||||
case 'llm:update':
|
||||
this._lccLlmUpdate(data, call_sid);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.logger.info(`CallSession:_onCommand - invalid command ${command}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user