mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
@@ -32,12 +32,14 @@ class TaskLlmUltravox_S2S extends Task {
|
|||||||
this.auth = this.parent.auth;
|
this.auth = this.parent.auth;
|
||||||
this.connectionOptions = this.parent.connectOptions;
|
this.connectionOptions = this.parent.connectOptions;
|
||||||
|
|
||||||
const {apiKey} = this.auth || {};
|
const {apiKey, agent_id} = this.auth || {};
|
||||||
if (!apiKey) throw new Error('auth.apiKey is required for Vendor: Ultravox');
|
if (!apiKey) throw new Error('auth.apiKey is required for Vendor: Ultravox');
|
||||||
this.apiKey = apiKey;
|
this.apiKey = apiKey;
|
||||||
|
this.agentId = agent_id;
|
||||||
this.actionHook = this.data.actionHook;
|
this.actionHook = this.data.actionHook;
|
||||||
this.eventHook = this.data.eventHook;
|
this.eventHook = this.data.eventHook;
|
||||||
this.toolHook = this.data.toolHook;
|
this.toolHook = this.data.toolHook;
|
||||||
|
this.llmOptions = this.data.llmOptions || {};
|
||||||
|
|
||||||
this.results = {
|
this.results = {
|
||||||
completionReason: 'normal conversation end'
|
completionReason: 'normal conversation end'
|
||||||
@@ -105,24 +107,29 @@ class TaskLlmUltravox_S2S extends Task {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
// merge with any existing tools
|
// merge with any existing tools
|
||||||
this.data.llmOptions.selectedTools = [
|
this.llmOptions.selectedTools = [
|
||||||
...convertedTools,
|
...convertedTools,
|
||||||
...(this.data.llmOptions.selectedTools || [])
|
...(this.llmOptions.selectedTools || [])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
...this.data.llmOptions,
|
...this.llmOptions,
|
||||||
|
...(!this.agentId && {
|
||||||
model: this.model,
|
model: this.model,
|
||||||
|
}),
|
||||||
medium: {
|
medium: {
|
||||||
...(this.data.llmOptions.medium || {}),
|
...(this.llmOptions.medium || {}),
|
||||||
serverWebSocket: {
|
serverWebSocket: {
|
||||||
inputSampleRate: 8000,
|
inputSampleRate: 8000,
|
||||||
outputSampleRate: 8000,
|
outputSampleRate: 8000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const {statusCode, body} = await request('https://api.ultravox.ai/api/calls', {
|
const baseUrl = 'https://api.ultravox.ai';
|
||||||
|
const url = this.agentId ?
|
||||||
|
`${baseUrl}/api/agents/${this.agentId}/calls` : `${baseUrl}/api/calls`;
|
||||||
|
const {statusCode, body} = await request(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|||||||
Reference in New Issue
Block a user