@onereach/step-voice 7.0.47-VOIC1748.1 → 7.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dst/Voice Agent.d.ts +7 -0
- package/dst/Voice Agent.js +18 -1
- package/package.json +1 -1
package/dst/Voice Agent.d.ts
CHANGED
|
@@ -63,6 +63,11 @@ interface AgentSystemToolConfig {
|
|
|
63
63
|
description?: string;
|
|
64
64
|
parameters?: Record<string, unknown>;
|
|
65
65
|
}
|
|
66
|
+
type KnowledgeMode = 'tool' | 'pipeline';
|
|
67
|
+
interface AgentKnowledgeConfig {
|
|
68
|
+
id: string;
|
|
69
|
+
mode: KnowledgeMode;
|
|
70
|
+
}
|
|
66
71
|
interface INPUT {
|
|
67
72
|
handlers: Handler[];
|
|
68
73
|
subagents: Subagent[];
|
|
@@ -92,6 +97,7 @@ interface INPUT {
|
|
|
92
97
|
tool_feedback?: ToolCallFeedbackConfig;
|
|
93
98
|
soft_timeout?: SoftTimeoutConfig;
|
|
94
99
|
system_tools?: AgentSystemToolConfig[];
|
|
100
|
+
knowledge?: AgentKnowledgeConfig[];
|
|
95
101
|
}
|
|
96
102
|
export default class VoiceAgent extends VoiceStep<Partial<INPUT>> {
|
|
97
103
|
runStep(): Promise<void>;
|
|
@@ -109,6 +115,7 @@ export default class VoiceAgent extends VoiceStep<Partial<INPUT>> {
|
|
|
109
115
|
private validatePerToolFeedback;
|
|
110
116
|
private validateSoftTimeout;
|
|
111
117
|
private validateSystemTools;
|
|
118
|
+
private validateKnowledge;
|
|
112
119
|
private parseAgentServiceOptions;
|
|
113
120
|
exitToThread(): Promise<void>;
|
|
114
121
|
}
|
package/dst/Voice Agent.js
CHANGED
|
@@ -79,7 +79,7 @@ class VoiceAgent extends voice_1.default {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
this.triggers.otherwise(async () => {
|
|
82
|
-
const { handlers = [], subagents = [], system_instruction = '', developer_messages = [], greeting_message = '', prevent_greeting_interruption = false, idle_detection_enabled = false, idle_timeout_secs = 8, idle_max_retries = 3, idle_prompts = [], idle_goodbye_message = '', dtmf_enabled = false, dtmf_timeout = 2, dtmf_termination_digit = '#', dtmf_prefix = 'DTMF: ', custom_config_enabled = false, agent_url_overwritten = false, tool_feedback, soft_timeout, system_tools, agent_url = '', mode = '', stt = {}, llm = {}, tts = {}, realtime = {} } = this.data;
|
|
82
|
+
const { handlers = [], subagents = [], system_instruction = '', developer_messages = [], greeting_message = '', prevent_greeting_interruption = false, idle_detection_enabled = false, idle_timeout_secs = 8, idle_max_retries = 3, idle_prompts = [], idle_goodbye_message = '', dtmf_enabled = false, dtmf_timeout = 2, dtmf_termination_digit = '#', dtmf_prefix = 'DTMF: ', custom_config_enabled = false, agent_url_overwritten = false, tool_feedback, soft_timeout, system_tools, knowledge = [], agent_url = '', mode = '', stt = {}, llm = {}, tts = {}, realtime = {} } = this.data;
|
|
83
83
|
if (lodash_1.default.isEmpty(system_instruction)) {
|
|
84
84
|
this.throwError(new Error('Voice Agent: system instruction is required'));
|
|
85
85
|
}
|
|
@@ -155,6 +155,9 @@ class VoiceAgent extends voice_1.default {
|
|
|
155
155
|
if (system_tools != null) {
|
|
156
156
|
config.system_tools = this.validateSystemTools(system_tools);
|
|
157
157
|
}
|
|
158
|
+
if (!lodash_1.default.isEmpty(knowledge)) {
|
|
159
|
+
config.knowledge = this.validateKnowledge(knowledge);
|
|
160
|
+
}
|
|
158
161
|
const params = { config };
|
|
159
162
|
if (agentCustomUrl) {
|
|
160
163
|
params.url = agentCustomUrl;
|
|
@@ -416,6 +419,20 @@ class VoiceAgent extends voice_1.default {
|
|
|
416
419
|
description: lodash_1.default.isEmpty(entry.description) ? undefined : entry.description
|
|
417
420
|
}));
|
|
418
421
|
}
|
|
422
|
+
validateKnowledge(knowledge) {
|
|
423
|
+
if (!Array.isArray(knowledge)) {
|
|
424
|
+
this.throwError(new Error('Voice Agent: knowledge must be an array'));
|
|
425
|
+
}
|
|
426
|
+
const modes = ['tool', 'pipeline'];
|
|
427
|
+
return lodash_1.default.uniqBy(knowledge
|
|
428
|
+
.filter(entry => entry != null && typeof entry === 'object')
|
|
429
|
+
.map((entry) => ({
|
|
430
|
+
id: lodash_1.default.trim(String(entry.id ?? '')),
|
|
431
|
+
// An unrecognised mode degrades to tool search rather than failing a live call.
|
|
432
|
+
mode: lodash_1.default.includes(modes, entry.mode) ? entry.mode : 'tool'
|
|
433
|
+
}))
|
|
434
|
+
.filter(entry => !lodash_1.default.isEmpty(entry.id)), entry => entry.id);
|
|
435
|
+
}
|
|
419
436
|
parseAgentServiceOptions(label, options) {
|
|
420
437
|
if (options == null || options === '')
|
|
421
438
|
return undefined;
|