@dtelecom/agents-js 0.2.1 → 0.3.0
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/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +100 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -34
- package/dist/index.mjs.map +1 -1
- package/dist/memory/index.d.mts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/providers/index.d.mts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +42 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +42 -0
- package/dist/providers/index.mjs.map +1 -1
- package/dist/{types-BBKtiPvm.d.mts → types-Di_jxIgs.d.mts} +25 -5
- package/dist/{types-BBKtiPvm.d.ts → types-Di_jxIgs.d.ts} +25 -5
- package/package.json +1 -1
|
@@ -164,6 +164,19 @@ interface Message {
|
|
|
164
164
|
role: 'system' | 'user' | 'assistant';
|
|
165
165
|
content: string;
|
|
166
166
|
}
|
|
167
|
+
interface ToolDefinition {
|
|
168
|
+
type: 'function';
|
|
169
|
+
function: {
|
|
170
|
+
name: string;
|
|
171
|
+
description: string;
|
|
172
|
+
parameters: Record<string, unknown>;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
interface ToolCallResult {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
arguments: string;
|
|
179
|
+
}
|
|
167
180
|
interface LLMChunk {
|
|
168
181
|
type: 'token' | 'segment' | 'tool_call' | 'done';
|
|
169
182
|
token?: string;
|
|
@@ -171,10 +184,7 @@ interface LLMChunk {
|
|
|
171
184
|
lang: string;
|
|
172
185
|
text: string;
|
|
173
186
|
};
|
|
174
|
-
toolCall?:
|
|
175
|
-
name: string;
|
|
176
|
-
arguments: string;
|
|
177
|
-
};
|
|
187
|
+
toolCall?: ToolCallResult;
|
|
178
188
|
usage?: {
|
|
179
189
|
promptTokens: number;
|
|
180
190
|
completionTokens: number;
|
|
@@ -183,6 +193,8 @@ interface LLMChunk {
|
|
|
183
193
|
interface LLMChatOptions {
|
|
184
194
|
/** Skip structured output (responseFormat) for this call — return plain text tokens. */
|
|
185
195
|
plainText?: boolean;
|
|
196
|
+
/** Tool definitions to pass to the LLM for function calling. */
|
|
197
|
+
tools?: ToolDefinition[];
|
|
186
198
|
}
|
|
187
199
|
interface LLMPlugin {
|
|
188
200
|
chat(messages: Message[], signal?: AbortSignal, options?: LLMChatOptions): AsyncGenerator<LLMChunk>;
|
|
@@ -226,6 +238,8 @@ interface AgentConfig {
|
|
|
226
238
|
memory?: MemoryConfig;
|
|
227
239
|
/** Max context tokens before triggering summarization (default: 5000) */
|
|
228
240
|
maxContextTokens?: number;
|
|
241
|
+
/** Tool definitions for LLM function calling. */
|
|
242
|
+
tools?: ToolDefinition[];
|
|
229
243
|
}
|
|
230
244
|
interface AgentStartOptions {
|
|
231
245
|
room: string;
|
|
@@ -260,6 +274,8 @@ interface PipelineOptions {
|
|
|
260
274
|
memory?: RoomMemory;
|
|
261
275
|
/** Max context tokens before triggering summarization (default: 5000) */
|
|
262
276
|
maxContextTokens?: number;
|
|
277
|
+
/** Tool definitions for LLM function calling. */
|
|
278
|
+
tools?: ToolDefinition[];
|
|
263
279
|
}
|
|
264
280
|
type AgentState = 'idle' | 'listening' | 'thinking' | 'speaking';
|
|
265
281
|
interface AgentEvents {
|
|
@@ -272,6 +288,8 @@ interface AgentEvents {
|
|
|
272
288
|
response: (text: string) => void;
|
|
273
289
|
/** Agent state: idle → listening (STT active) → thinking (LLM) → speaking (audio) → idle. */
|
|
274
290
|
agentState: (state: AgentState) => void;
|
|
291
|
+
/** Emitted when the LLM invokes a tool. */
|
|
292
|
+
toolCall: (toolCall: ToolCallResult) => void;
|
|
275
293
|
error: (error: Error) => void;
|
|
276
294
|
connected: () => void;
|
|
277
295
|
disconnected: (reason?: string) => void;
|
|
@@ -283,7 +301,9 @@ interface PipelineEvents {
|
|
|
283
301
|
sentence: (text: string) => void;
|
|
284
302
|
response: (text: string) => void;
|
|
285
303
|
agentState: (state: AgentState) => void;
|
|
304
|
+
/** Emitted when the LLM invokes a tool. */
|
|
305
|
+
toolCall: (toolCall: ToolCallResult) => void;
|
|
286
306
|
error: (error: Error) => void;
|
|
287
307
|
}
|
|
288
308
|
|
|
289
|
-
export { type AgentConfig as A, type DataMessageHandler as D, Embedder as E, type LLMPlugin as L, type Message as M, type PipelineOptions as P, type RespondMode as R, type STTStream as S, type TranscriptionResult as T, type AgentStartOptions as a, type AgentState as b, type AgentEvents as c, AudioOutput as d, type LLMChatOptions as e, type LLMChunk as f, type MemoryConfig as g, type PipelineEvents as h, type STTPlugin as i, type STTStreamOptions as j, type TTSPlugin as k,
|
|
309
|
+
export { type AgentConfig as A, type DataMessageHandler as D, Embedder as E, type LLMPlugin as L, type Message as M, type PipelineOptions as P, type RespondMode as R, type STTStream as S, type TranscriptionResult as T, type AgentStartOptions as a, type AgentState as b, type AgentEvents as c, AudioOutput as d, type LLMChatOptions as e, type LLMChunk as f, type MemoryConfig as g, type PipelineEvents as h, type STTPlugin as i, type STTStreamOptions as j, type TTSPlugin as k, type ToolCallResult as l, type ToolDefinition as m, RoomMemory as n, type RoomMemoryConfig as o };
|
|
@@ -164,6 +164,19 @@ interface Message {
|
|
|
164
164
|
role: 'system' | 'user' | 'assistant';
|
|
165
165
|
content: string;
|
|
166
166
|
}
|
|
167
|
+
interface ToolDefinition {
|
|
168
|
+
type: 'function';
|
|
169
|
+
function: {
|
|
170
|
+
name: string;
|
|
171
|
+
description: string;
|
|
172
|
+
parameters: Record<string, unknown>;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
interface ToolCallResult {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
arguments: string;
|
|
179
|
+
}
|
|
167
180
|
interface LLMChunk {
|
|
168
181
|
type: 'token' | 'segment' | 'tool_call' | 'done';
|
|
169
182
|
token?: string;
|
|
@@ -171,10 +184,7 @@ interface LLMChunk {
|
|
|
171
184
|
lang: string;
|
|
172
185
|
text: string;
|
|
173
186
|
};
|
|
174
|
-
toolCall?:
|
|
175
|
-
name: string;
|
|
176
|
-
arguments: string;
|
|
177
|
-
};
|
|
187
|
+
toolCall?: ToolCallResult;
|
|
178
188
|
usage?: {
|
|
179
189
|
promptTokens: number;
|
|
180
190
|
completionTokens: number;
|
|
@@ -183,6 +193,8 @@ interface LLMChunk {
|
|
|
183
193
|
interface LLMChatOptions {
|
|
184
194
|
/** Skip structured output (responseFormat) for this call — return plain text tokens. */
|
|
185
195
|
plainText?: boolean;
|
|
196
|
+
/** Tool definitions to pass to the LLM for function calling. */
|
|
197
|
+
tools?: ToolDefinition[];
|
|
186
198
|
}
|
|
187
199
|
interface LLMPlugin {
|
|
188
200
|
chat(messages: Message[], signal?: AbortSignal, options?: LLMChatOptions): AsyncGenerator<LLMChunk>;
|
|
@@ -226,6 +238,8 @@ interface AgentConfig {
|
|
|
226
238
|
memory?: MemoryConfig;
|
|
227
239
|
/** Max context tokens before triggering summarization (default: 5000) */
|
|
228
240
|
maxContextTokens?: number;
|
|
241
|
+
/** Tool definitions for LLM function calling. */
|
|
242
|
+
tools?: ToolDefinition[];
|
|
229
243
|
}
|
|
230
244
|
interface AgentStartOptions {
|
|
231
245
|
room: string;
|
|
@@ -260,6 +274,8 @@ interface PipelineOptions {
|
|
|
260
274
|
memory?: RoomMemory;
|
|
261
275
|
/** Max context tokens before triggering summarization (default: 5000) */
|
|
262
276
|
maxContextTokens?: number;
|
|
277
|
+
/** Tool definitions for LLM function calling. */
|
|
278
|
+
tools?: ToolDefinition[];
|
|
263
279
|
}
|
|
264
280
|
type AgentState = 'idle' | 'listening' | 'thinking' | 'speaking';
|
|
265
281
|
interface AgentEvents {
|
|
@@ -272,6 +288,8 @@ interface AgentEvents {
|
|
|
272
288
|
response: (text: string) => void;
|
|
273
289
|
/** Agent state: idle → listening (STT active) → thinking (LLM) → speaking (audio) → idle. */
|
|
274
290
|
agentState: (state: AgentState) => void;
|
|
291
|
+
/** Emitted when the LLM invokes a tool. */
|
|
292
|
+
toolCall: (toolCall: ToolCallResult) => void;
|
|
275
293
|
error: (error: Error) => void;
|
|
276
294
|
connected: () => void;
|
|
277
295
|
disconnected: (reason?: string) => void;
|
|
@@ -283,7 +301,9 @@ interface PipelineEvents {
|
|
|
283
301
|
sentence: (text: string) => void;
|
|
284
302
|
response: (text: string) => void;
|
|
285
303
|
agentState: (state: AgentState) => void;
|
|
304
|
+
/** Emitted when the LLM invokes a tool. */
|
|
305
|
+
toolCall: (toolCall: ToolCallResult) => void;
|
|
286
306
|
error: (error: Error) => void;
|
|
287
307
|
}
|
|
288
308
|
|
|
289
|
-
export { type AgentConfig as A, type DataMessageHandler as D, Embedder as E, type LLMPlugin as L, type Message as M, type PipelineOptions as P, type RespondMode as R, type STTStream as S, type TranscriptionResult as T, type AgentStartOptions as a, type AgentState as b, type AgentEvents as c, AudioOutput as d, type LLMChatOptions as e, type LLMChunk as f, type MemoryConfig as g, type PipelineEvents as h, type STTPlugin as i, type STTStreamOptions as j, type TTSPlugin as k,
|
|
309
|
+
export { type AgentConfig as A, type DataMessageHandler as D, Embedder as E, type LLMPlugin as L, type Message as M, type PipelineOptions as P, type RespondMode as R, type STTStream as S, type TranscriptionResult as T, type AgentStartOptions as a, type AgentState as b, type AgentEvents as c, AudioOutput as d, type LLMChatOptions as e, type LLMChunk as f, type MemoryConfig as g, type PipelineEvents as h, type STTPlugin as i, type STTStreamOptions as j, type TTSPlugin as k, type ToolCallResult as l, type ToolDefinition as m, RoomMemory as n, type RoomMemoryConfig as o };
|