mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
@@ -32,12 +32,14 @@ class TaskLlmUltravox_S2S extends Task {
|
||||
this.auth = this.parent.auth;
|
||||
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');
|
||||
this.apiKey = apiKey;
|
||||
this.agentId = agent_id;
|
||||
this.actionHook = this.data.actionHook;
|
||||
this.eventHook = this.data.eventHook;
|
||||
this.toolHook = this.data.toolHook;
|
||||
this.llmOptions = this.data.llmOptions || {};
|
||||
|
||||
this.results = {
|
||||
completionReason: 'normal conversation end'
|
||||
@@ -105,24 +107,29 @@ class TaskLlmUltravox_S2S extends Task {
|
||||
}
|
||||
);
|
||||
// merge with any existing tools
|
||||
this.data.llmOptions.selectedTools = [
|
||||
this.llmOptions.selectedTools = [
|
||||
...convertedTools,
|
||||
...(this.data.llmOptions.selectedTools || [])
|
||||
...(this.llmOptions.selectedTools || [])
|
||||
];
|
||||
}
|
||||
|
||||
const payload = {
|
||||
...this.data.llmOptions,
|
||||
model: this.model,
|
||||
...this.llmOptions,
|
||||
...(!this.agentId && {
|
||||
model: this.model,
|
||||
}),
|
||||
medium: {
|
||||
...(this.data.llmOptions.medium || {}),
|
||||
...(this.llmOptions.medium || {}),
|
||||
serverWebSocket: {
|
||||
inputSampleRate: 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',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user