@atgs/tapeworm 0.0.2 → 0.1.1
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/README.md +120 -0
- package/dist/agent/agent.d.ts +47 -3
- package/dist/conversation/conversation.d.ts +34 -28
- package/dist/conversation/message.d.ts +189 -0
- package/dist/index.d.ts +8 -7
- package/dist/model/OllamaModel.d.ts +23 -2
- package/dist/model/model.d.ts +15 -43
- package/dist/tapeworm.cjs.js +1 -1
- package/dist/tapeworm.es.js +597 -218
- package/dist/tapeworm.umd.js +1 -1
- package/dist/tool/tool.d.ts +21 -1
- package/dist/tool/toolCall.d.ts +60 -2
- package/dist/tool/toolschema.d.ts +15 -0
- package/package.json +7 -4
package/dist/tapeworm.es.js
CHANGED
|
@@ -1,96 +1,286 @@
|
|
|
1
|
-
class
|
|
1
|
+
class b {
|
|
2
2
|
messages;
|
|
3
3
|
manager;
|
|
4
|
+
/**
|
|
5
|
+
* Initialize an empty conversation using the default manager.
|
|
6
|
+
*/
|
|
4
7
|
constructor() {
|
|
5
|
-
this.messages = [], this.manager = new
|
|
8
|
+
this.messages = [], this.manager = new f();
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Append a message to the history and apply compaction rules.
|
|
12
|
+
* @param message Message to store.
|
|
13
|
+
*/
|
|
7
14
|
append(e) {
|
|
8
15
|
this.messages.push(e), this.messages = this.manager.compact(this.messages);
|
|
9
16
|
}
|
|
10
17
|
}
|
|
11
|
-
class
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
class C {
|
|
19
|
+
/**
|
|
20
|
+
* Compact or adjust a conversation according to a strategy.
|
|
21
|
+
* @param conversation Full list of messages so far.
|
|
22
|
+
* @returns Adjusted message list to keep.
|
|
23
|
+
*/
|
|
24
|
+
compact(e) {
|
|
25
|
+
throw new p(
|
|
26
|
+
"No implementation for conversation manager!"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Allow the manager to consider model-specific constraints (e.g., token limits).
|
|
31
|
+
* @param model Model being used for this conversation.
|
|
32
|
+
*/
|
|
33
|
+
configure(e) {
|
|
34
|
+
throw new p(
|
|
35
|
+
"No implementation for conversation manager!"
|
|
36
|
+
);
|
|
19
37
|
}
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
}
|
|
39
|
+
class f extends C {
|
|
40
|
+
/**
|
|
41
|
+
* Default strategy simply returns the conversation untouched.
|
|
42
|
+
*/
|
|
43
|
+
compact(e) {
|
|
44
|
+
return e;
|
|
22
45
|
}
|
|
23
|
-
|
|
24
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Default manager ignores model configuration because it does no compaction.
|
|
48
|
+
*/
|
|
49
|
+
configure(e) {
|
|
25
50
|
}
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
}
|
|
52
|
+
class p extends Error {
|
|
53
|
+
constructor(e) {
|
|
54
|
+
super(e), this.name = "ConversationManagerNotImplemented";
|
|
28
55
|
}
|
|
56
|
+
}
|
|
57
|
+
class h {
|
|
58
|
+
role;
|
|
59
|
+
content;
|
|
60
|
+
/**
|
|
61
|
+
* Wrap a set of message components with an associated sender role.
|
|
62
|
+
* @param role Source of the message (e.g., user, assistant, tool).
|
|
63
|
+
* @param content Ordered list of message components that make up the message body.
|
|
64
|
+
*/
|
|
65
|
+
constructor(e, t) {
|
|
66
|
+
this.role = e, this.content = t;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create a new message builder for ergonomic construction.
|
|
70
|
+
* @returns A MessageBuilder instance.
|
|
71
|
+
*/
|
|
29
72
|
static builder() {
|
|
30
|
-
return new
|
|
73
|
+
return new N();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Filters the message contents based on the message type.
|
|
77
|
+
*/
|
|
78
|
+
filter(e) {
|
|
79
|
+
return this.content.filter((t) => t.getMessageComponentType() == e);
|
|
31
80
|
}
|
|
32
81
|
}
|
|
33
|
-
class
|
|
82
|
+
class N {
|
|
34
83
|
_role;
|
|
35
84
|
_content;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Set the role associated with the message being built.
|
|
87
|
+
* @param role Source of the message (e.g., user, assistant, tool).
|
|
88
|
+
* @returns This builder for chaining.
|
|
89
|
+
*/
|
|
39
90
|
role(e) {
|
|
40
91
|
return this._role = e, this;
|
|
41
92
|
}
|
|
42
|
-
|
|
43
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Ensure the content array is initialized before appending components.
|
|
95
|
+
*/
|
|
96
|
+
init() {
|
|
97
|
+
this._content == null && (this._content = []);
|
|
44
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Attach a tool call component if provided.
|
|
101
|
+
* @param toolCall Tool call to append to the message.
|
|
102
|
+
* @returns This builder for chaining.
|
|
103
|
+
*/
|
|
104
|
+
toolCall(e) {
|
|
105
|
+
return e == null ? this : (this.init(), this._content.push(e), this);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Attach SEVERAL tool call component if provided.
|
|
109
|
+
* @param toolCall Tool call to append to the message.
|
|
110
|
+
* @returns This builder for chaining.
|
|
111
|
+
*/
|
|
45
112
|
toolCalls(e) {
|
|
46
|
-
|
|
113
|
+
if (e == null)
|
|
114
|
+
return this;
|
|
115
|
+
this.init();
|
|
116
|
+
for (const t of e)
|
|
117
|
+
this._content.push(t);
|
|
118
|
+
return this;
|
|
47
119
|
}
|
|
48
|
-
|
|
49
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Attach a tool result component if provided.
|
|
122
|
+
* @param toolResult Result of a previously executed tool call.
|
|
123
|
+
* @returns This builder for chaining.
|
|
124
|
+
*/
|
|
125
|
+
toolResult(e) {
|
|
126
|
+
return e == null ? this : (this.init(), this._content.push(e), this);
|
|
50
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Attach a thinking component if provided.
|
|
130
|
+
* @param thinking Reflection or chain-of-thought text.
|
|
131
|
+
* @returns This builder for chaining.
|
|
132
|
+
*/
|
|
51
133
|
thinking(e) {
|
|
52
|
-
return this.
|
|
134
|
+
return e == null ? this : (this.init(), this._content.push(k.of(e)), this);
|
|
53
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Attach content to the message if provided.
|
|
138
|
+
* @param content Assistant or user text content.
|
|
139
|
+
* @returns This builder for chaining.
|
|
140
|
+
*/
|
|
141
|
+
content(e) {
|
|
142
|
+
return e == null ? this : (this.init(), this._content.push(x.of(e)), this);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Construct the Message with the accumulated values.
|
|
146
|
+
* @returns Finalized Message instance.
|
|
147
|
+
*/
|
|
54
148
|
build() {
|
|
55
|
-
|
|
149
|
+
if (this._content == null || this._content.length == 0)
|
|
150
|
+
throw new Error("Role-only messages are not supported by Tapeworm.");
|
|
151
|
+
return new h(this._role, this._content);
|
|
56
152
|
}
|
|
57
153
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
154
|
+
const l = {
|
|
155
|
+
Content: "content",
|
|
156
|
+
Thinking: "thinking",
|
|
157
|
+
ToolCall: "toolcall",
|
|
158
|
+
ToolResult: "toolresult"
|
|
159
|
+
};
|
|
160
|
+
class u {
|
|
161
|
+
/**
|
|
162
|
+
* Get the type of this message component, as defined in MessageComponentType
|
|
163
|
+
*/
|
|
164
|
+
getMessageComponentType() {
|
|
165
|
+
throw new Error(
|
|
166
|
+
"Message components that do not have a message component type are not allowed."
|
|
167
|
+
);
|
|
64
168
|
}
|
|
65
169
|
}
|
|
66
|
-
class
|
|
67
|
-
|
|
68
|
-
|
|
170
|
+
class x extends u {
|
|
171
|
+
text;
|
|
172
|
+
/**
|
|
173
|
+
* Create a content component with the provided text.
|
|
174
|
+
* @param text Body of the content block.
|
|
175
|
+
*/
|
|
176
|
+
constructor(e) {
|
|
177
|
+
super(), this.text = e;
|
|
69
178
|
}
|
|
70
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Get the type of this message component, as defined in MessageComponentType.
|
|
181
|
+
* This returns MessageComponentType.Content.
|
|
182
|
+
*/
|
|
183
|
+
getMessageComponentType() {
|
|
184
|
+
return l.Content;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get the content of this MessageComponent.
|
|
188
|
+
* @returns the string contained in this component.
|
|
189
|
+
*/
|
|
190
|
+
get() {
|
|
191
|
+
return this.text;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Shorthand for the constructor
|
|
195
|
+
* @param text - the text this content block represents.
|
|
196
|
+
* @returns a new Content messagecomponent with the text.
|
|
197
|
+
*/
|
|
198
|
+
static of(e) {
|
|
199
|
+
return new this(e);
|
|
71
200
|
}
|
|
72
201
|
}
|
|
73
|
-
class
|
|
202
|
+
class k extends u {
|
|
203
|
+
thought;
|
|
204
|
+
/**
|
|
205
|
+
* Create a thinking component with the provided thought text.
|
|
206
|
+
* @param thought Chain-of-thought or reasoning string.
|
|
207
|
+
*/
|
|
74
208
|
constructor(e) {
|
|
75
|
-
super(
|
|
209
|
+
super(), this.thought = e;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get the type of this message component, as defined in MessageComponentType.
|
|
213
|
+
* This returns MessageComponentType.Content.
|
|
214
|
+
*/
|
|
215
|
+
getMessageComponentType() {
|
|
216
|
+
return l.Thinking;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Get the content of this MessageComponent.
|
|
220
|
+
* @returns the string contained in this component.
|
|
221
|
+
*/
|
|
222
|
+
get() {
|
|
223
|
+
return this.thought;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Shorthand for the constructor
|
|
227
|
+
* @param thought - the text this content block represents.
|
|
228
|
+
* @returns a new Thinking message component with the text.
|
|
229
|
+
*/
|
|
230
|
+
static of(e) {
|
|
231
|
+
return new this(e);
|
|
76
232
|
}
|
|
77
233
|
}
|
|
78
|
-
class
|
|
234
|
+
class m extends u {
|
|
235
|
+
id;
|
|
236
|
+
toolName;
|
|
237
|
+
toolResult;
|
|
238
|
+
/**
|
|
239
|
+
* Create a tool result component for a completed tool call.
|
|
240
|
+
* @param id Identifier of the originating tool call.
|
|
241
|
+
* @param toolName Name of the tool that produced the result.
|
|
242
|
+
* @param toolResult Output returned by the tool.
|
|
243
|
+
*/
|
|
244
|
+
constructor(e, t, o) {
|
|
245
|
+
super(), this.id = e, this.toolName = t, this.toolResult = o;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get the type of this message component, as defined in MessageComponentType.
|
|
249
|
+
* This returns MessageComponentType.ToolResult.
|
|
250
|
+
*/
|
|
251
|
+
getMessageComponentType() {
|
|
252
|
+
return l.ToolResult;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Shorthand for the constructor
|
|
256
|
+
* @param toolCall Original tool call that produced this result.
|
|
257
|
+
* @param toolResult Output to attach to the tool result component.
|
|
258
|
+
* @returns a new ToolResult component mirroring the provided tool call.
|
|
259
|
+
*/
|
|
260
|
+
static of(e, t) {
|
|
261
|
+
return new this(e.id, e.name, t);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
class q {
|
|
79
265
|
/**
|
|
80
266
|
* Execute the model against the provided request.
|
|
81
267
|
* @param request Aggregated messages and tools to send to the model.
|
|
82
268
|
*/
|
|
83
269
|
async invoke(e) {
|
|
84
|
-
throw new
|
|
270
|
+
throw new g(
|
|
271
|
+
"The invoke function for this model was not correctly implemented."
|
|
272
|
+
);
|
|
85
273
|
}
|
|
86
274
|
/**
|
|
87
275
|
* Return the maximum token budget supported by this model.
|
|
88
276
|
*/
|
|
89
277
|
tokenLimit() {
|
|
90
|
-
throw new
|
|
278
|
+
throw new g(
|
|
279
|
+
"The tokenLimit function for this model was not correctly implemented."
|
|
280
|
+
);
|
|
91
281
|
}
|
|
92
282
|
}
|
|
93
|
-
class
|
|
283
|
+
class E {
|
|
94
284
|
messages;
|
|
95
285
|
tools;
|
|
96
286
|
/**
|
|
@@ -98,146 +288,233 @@ class C {
|
|
|
98
288
|
* @param messages Conversation history to send to the model.
|
|
99
289
|
* @param tools Tool definitions available for function calling.
|
|
100
290
|
*/
|
|
101
|
-
constructor(e,
|
|
102
|
-
this.messages = e, this.tools =
|
|
291
|
+
constructor(e, t) {
|
|
292
|
+
this.messages = e, this.tools = t;
|
|
103
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Create a builder for composing a model request.
|
|
296
|
+
* @returns A ModelRequestBuilder instance.
|
|
297
|
+
*/
|
|
104
298
|
static builder() {
|
|
105
|
-
return new
|
|
299
|
+
return new _();
|
|
106
300
|
}
|
|
107
301
|
}
|
|
108
|
-
class
|
|
302
|
+
class _ {
|
|
109
303
|
_messages;
|
|
110
304
|
_tools;
|
|
111
305
|
/**
|
|
112
306
|
* Supply the conversation messages to include.
|
|
307
|
+
* @returns This builder for chaining.
|
|
113
308
|
*/
|
|
114
309
|
messages(e) {
|
|
115
310
|
return this._messages = e, this;
|
|
116
311
|
}
|
|
117
312
|
/**
|
|
118
313
|
* Supply the tool list for this request.
|
|
314
|
+
* @returns This builder for chaining.
|
|
119
315
|
*/
|
|
120
316
|
tools(e) {
|
|
121
317
|
return this._tools = e, this;
|
|
122
318
|
}
|
|
123
319
|
/**
|
|
124
320
|
* Build the ModelRequest, defaulting tools to an empty array.
|
|
321
|
+
* @returns Constructed ModelRequest.
|
|
125
322
|
*/
|
|
126
323
|
build() {
|
|
127
|
-
|
|
324
|
+
if (this._tools == null && (this._tools = []), this._messages == null)
|
|
325
|
+
throw new R(
|
|
326
|
+
"Requests to the model should include content."
|
|
327
|
+
);
|
|
328
|
+
return new E(this._messages, this._tools);
|
|
128
329
|
}
|
|
129
330
|
}
|
|
130
|
-
class
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
331
|
+
class g extends Error {
|
|
332
|
+
constructor(e) {
|
|
333
|
+
super(e), this.name = "ModelNotImplementedError";
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
class R extends Error {
|
|
337
|
+
constructor(e) {
|
|
338
|
+
super(e), this.name = "MessagesNotDefinedError";
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
class v extends u {
|
|
342
|
+
sequence;
|
|
343
|
+
name;
|
|
344
|
+
parameters;
|
|
345
|
+
type;
|
|
346
|
+
id;
|
|
347
|
+
/**
|
|
348
|
+
* Get the type of this message component, as defined in MessageComponentType.
|
|
349
|
+
* This returns MessageComponentType.ToolCall.
|
|
350
|
+
*/
|
|
351
|
+
getMessageComponentType() {
|
|
352
|
+
return l.ToolCall;
|
|
353
|
+
}
|
|
135
354
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param
|
|
138
|
-
* @param
|
|
139
|
-
* @param
|
|
355
|
+
* Create a ToolCall component to represent a model-requested tool invocation.
|
|
356
|
+
* @param sequence Optional ordering from the model for batched tool calls.
|
|
357
|
+
* @param name Name of the tool to invoke.
|
|
358
|
+
* @param parameters Arguments provided by the model.
|
|
359
|
+
* @param type Type of tool call (e.g., function).
|
|
360
|
+
* @param id Provider-generated identifier for correlating results.
|
|
140
361
|
*/
|
|
141
|
-
constructor(e,
|
|
142
|
-
this.
|
|
362
|
+
constructor(e, t, o, s, i) {
|
|
363
|
+
super(), this.sequence = e, this.name = t, this.parameters = o, this.type = s, this.id = i;
|
|
143
364
|
}
|
|
365
|
+
/**
|
|
366
|
+
* Convenience factory for a ToolCallBuilder.
|
|
367
|
+
* @returns A new ToolCallBuilder instance.
|
|
368
|
+
*/
|
|
144
369
|
static builder() {
|
|
145
|
-
return new
|
|
370
|
+
return new P();
|
|
146
371
|
}
|
|
147
372
|
}
|
|
148
|
-
class
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
373
|
+
class P {
|
|
374
|
+
_sequence;
|
|
375
|
+
_name;
|
|
376
|
+
_parameters;
|
|
377
|
+
_type;
|
|
378
|
+
_id;
|
|
153
379
|
/**
|
|
154
|
-
*
|
|
380
|
+
* Set the sequence number for the tool call.
|
|
381
|
+
* @param sequence Optional position of the tool call in a batch.
|
|
382
|
+
* @returns This builder for chaining.
|
|
155
383
|
*/
|
|
156
|
-
|
|
157
|
-
return this.
|
|
384
|
+
sequence(e) {
|
|
385
|
+
return this._sequence = e, this;
|
|
158
386
|
}
|
|
159
387
|
/**
|
|
160
|
-
* Set the
|
|
388
|
+
* Set the name of the tool to invoke.
|
|
389
|
+
* @param name Tool identifier.
|
|
390
|
+
* @returns This builder for chaining.
|
|
161
391
|
*/
|
|
162
|
-
|
|
163
|
-
return this.
|
|
392
|
+
name(e) {
|
|
393
|
+
return this._name = e, this;
|
|
164
394
|
}
|
|
165
395
|
/**
|
|
166
|
-
*
|
|
396
|
+
* Provide the argument payload for the tool call.
|
|
397
|
+
* @param parameters JSON-serializable arguments to pass to the tool.
|
|
398
|
+
* @returns This builder for chaining.
|
|
167
399
|
*/
|
|
168
|
-
|
|
169
|
-
return this.
|
|
400
|
+
parameters(e) {
|
|
401
|
+
return this._parameters = e, this;
|
|
170
402
|
}
|
|
171
403
|
/**
|
|
172
|
-
* Set the
|
|
404
|
+
* Set the type of tool call (e.g., function).
|
|
405
|
+
* @param type Provider-specific tool call type.
|
|
406
|
+
* @returns This builder for chaining.
|
|
173
407
|
*/
|
|
174
|
-
|
|
175
|
-
return this.
|
|
408
|
+
type(e) {
|
|
409
|
+
return this._type = e, this;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Assign the provider tool call identifier for correlation.
|
|
413
|
+
* @param id Unique identifier returned by the model.
|
|
414
|
+
* @returns This builder for chaining.
|
|
415
|
+
*/
|
|
416
|
+
id(e) {
|
|
417
|
+
return e != null && (this._id = e), this;
|
|
176
418
|
}
|
|
177
419
|
/**
|
|
178
|
-
* Build the
|
|
420
|
+
* Build the ToolCall with collected data, defaulting sequence to 0.
|
|
421
|
+
* @returns ToolCall instance ready to attach to a message.
|
|
179
422
|
*/
|
|
180
423
|
build() {
|
|
181
|
-
return
|
|
424
|
+
return this._sequence == null && (this._sequence = 0), this._id == null && (this._id = (Math.random() + 1).toString(36).slice(2, 7)), new v(
|
|
425
|
+
this._sequence,
|
|
426
|
+
this._name,
|
|
427
|
+
this._parameters,
|
|
428
|
+
this._type,
|
|
429
|
+
this._id
|
|
430
|
+
);
|
|
182
431
|
}
|
|
183
432
|
}
|
|
184
|
-
class
|
|
433
|
+
class I extends Error {
|
|
185
434
|
constructor(e) {
|
|
186
|
-
super(e), this.name = "
|
|
435
|
+
super(e), this.name = "ToolNotFoundError";
|
|
187
436
|
}
|
|
188
437
|
}
|
|
189
|
-
class
|
|
438
|
+
class O {
|
|
190
439
|
name;
|
|
191
|
-
|
|
440
|
+
systemPrompt;
|
|
192
441
|
tools;
|
|
193
442
|
model;
|
|
194
443
|
conversation;
|
|
195
444
|
conversationManager;
|
|
196
445
|
toolNameToIndexMap;
|
|
446
|
+
callback;
|
|
447
|
+
constructor(e, t, o, s, i) {
|
|
448
|
+
this.name = e, this.model = o, this.conversationManager = s, this.tools = t, this.callback = i, this.conversationManager.configure(o);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Run the full agent loop for a user query: seed the conversation, invoke the model,
|
|
452
|
+
* and execute any returned tool calls until completion.
|
|
453
|
+
* @param query User-provided input to hand to the agent.
|
|
454
|
+
*/
|
|
197
455
|
async invoke(e) {
|
|
198
|
-
this.conversation == null && (this.conversation = new
|
|
199
|
-
|
|
456
|
+
this.conversation == null && (this.conversation = new b(), this.conversationManager != null && (this.conversation.manager = this.conversationManager), this.systemPrompt != null && this.conversation.append(
|
|
457
|
+
h.builder().role("system").content(this.systemPrompt).build()
|
|
200
458
|
)), this.conversation.append(
|
|
201
|
-
|
|
459
|
+
h.builder().role("user").content(e).build()
|
|
202
460
|
);
|
|
203
|
-
let
|
|
204
|
-
for (; !
|
|
205
|
-
let
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
);
|
|
212
|
-
for (let
|
|
213
|
-
this._runTool(
|
|
461
|
+
let t = !1;
|
|
462
|
+
for (; !t; ) {
|
|
463
|
+
let o = await this._runQuery();
|
|
464
|
+
this.callback(o), this.conversation.append(o), t = !0;
|
|
465
|
+
const s = o.filter(
|
|
466
|
+
l.ToolCall
|
|
467
|
+
);
|
|
468
|
+
if (s != null && s.length != 0) {
|
|
469
|
+
t = !1, s.sort((i, a) => (i.sequence ?? 0) < (a.sequence ?? 0) ? -1 : 1);
|
|
470
|
+
for (let i of s)
|
|
471
|
+
await this._runTool(i);
|
|
214
472
|
}
|
|
215
473
|
}
|
|
216
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Ask the backing model for the next response given the current conversation state.
|
|
477
|
+
* @returns Parsed model response including content, thinking, and tool calls.
|
|
478
|
+
*/
|
|
217
479
|
async _runQuery() {
|
|
218
480
|
return await this.model.invoke(
|
|
219
|
-
new
|
|
481
|
+
new _().messages(this.conversation?.messages).tools(this.tools).build()
|
|
220
482
|
);
|
|
221
483
|
}
|
|
484
|
+
/**
|
|
485
|
+
* Execute a single tool call and append the result (or error) back to the conversation.
|
|
486
|
+
* @param toolCall Tool invocation details returned by the model.
|
|
487
|
+
* @returns Tool execution output, if any.
|
|
488
|
+
*/
|
|
222
489
|
async _runTool(e) {
|
|
223
|
-
if (
|
|
490
|
+
if (this.generateToolNameToIndexMap(), !(e.name in this.toolNameToIndexMap)) {
|
|
224
491
|
this.conversation.append(
|
|
225
|
-
|
|
492
|
+
h.builder().role("tool").toolResult(
|
|
493
|
+
m.of(
|
|
494
|
+
e,
|
|
495
|
+
new I(
|
|
496
|
+
"Agent does not have a tool with this name."
|
|
497
|
+
)
|
|
498
|
+
)
|
|
499
|
+
).build()
|
|
226
500
|
);
|
|
227
501
|
return;
|
|
228
502
|
}
|
|
229
|
-
let
|
|
503
|
+
let t = this.tools[this.toolNameToIndexMap[e.name]];
|
|
230
504
|
try {
|
|
231
|
-
let
|
|
505
|
+
let o = await t.execute(e.parameters);
|
|
232
506
|
this.conversation.append(
|
|
233
|
-
|
|
507
|
+
h.builder().role("tool").toolResult(m.of(e, o)).build()
|
|
234
508
|
);
|
|
235
|
-
} catch (
|
|
509
|
+
} catch (o) {
|
|
236
510
|
this.conversation.append(
|
|
237
|
-
|
|
511
|
+
h.builder().role("tool").toolResult(m.of(e, JSON.stringify(o))).build()
|
|
238
512
|
);
|
|
239
513
|
}
|
|
240
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* Build a lookup from tool name to index for efficient resolution of tool calls.
|
|
517
|
+
*/
|
|
241
518
|
generateToolNameToIndexMap() {
|
|
242
519
|
if (this.toolNameToIndexMap == null) {
|
|
243
520
|
this.toolNameToIndexMap = {};
|
|
@@ -245,67 +522,106 @@ class S {
|
|
|
245
522
|
this.toolNameToIndexMap[this.tools[e].getName()] = e;
|
|
246
523
|
}
|
|
247
524
|
}
|
|
525
|
+
static builder() {
|
|
526
|
+
return new S();
|
|
527
|
+
}
|
|
248
528
|
}
|
|
249
|
-
class
|
|
529
|
+
class S {
|
|
530
|
+
_name;
|
|
531
|
+
_systemPrompt;
|
|
532
|
+
_tools;
|
|
533
|
+
_model;
|
|
534
|
+
_conversation;
|
|
535
|
+
_conversationManager = new f();
|
|
536
|
+
_toolNameToIndexMap;
|
|
537
|
+
_callback = (e) => j(e);
|
|
538
|
+
name(e) {
|
|
539
|
+
return this._name = e, this;
|
|
540
|
+
}
|
|
541
|
+
systemPrompt(e) {
|
|
542
|
+
return this._systemPrompt = e, this;
|
|
543
|
+
}
|
|
544
|
+
tools(e) {
|
|
545
|
+
return this._tools = e, this;
|
|
546
|
+
}
|
|
547
|
+
addTool(e) {
|
|
548
|
+
return this._tools == null && (this._tools = []), this._tools.push(e), this;
|
|
549
|
+
}
|
|
550
|
+
model(e) {
|
|
551
|
+
return this._model = e, this;
|
|
552
|
+
}
|
|
553
|
+
conversationManager(e) {
|
|
554
|
+
return this._conversationManager = e, this;
|
|
555
|
+
}
|
|
556
|
+
callback(e) {
|
|
557
|
+
return this._callback = e, this;
|
|
558
|
+
}
|
|
559
|
+
build() {
|
|
560
|
+
let e = new O(
|
|
561
|
+
this._name,
|
|
562
|
+
this._tools,
|
|
563
|
+
this._model,
|
|
564
|
+
this._conversationManager,
|
|
565
|
+
this._callback
|
|
566
|
+
);
|
|
567
|
+
return this._conversation != null && (e.conversation = this._conversation), this._systemPrompt != null && (e.systemPrompt = this._systemPrompt), e;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
function j(n) {
|
|
571
|
+
for (const e of n.filter(l.Thinking))
|
|
572
|
+
console.log("\x1B[90m" + e.get() + "\x1B[0m");
|
|
573
|
+
for (const e of n.filter(l.Content))
|
|
574
|
+
console.log(e.get());
|
|
575
|
+
for (const e of n.filter(l.ToolCall))
|
|
576
|
+
console.log("\x1B[32mCalling Tool: " + e.name + "\x1B[0m");
|
|
577
|
+
}
|
|
578
|
+
class d extends Error {
|
|
250
579
|
constructor(e) {
|
|
251
580
|
super(e), this.name = "ToolNotDefinedError";
|
|
252
581
|
}
|
|
253
582
|
}
|
|
254
|
-
class
|
|
583
|
+
class F {
|
|
255
584
|
name;
|
|
256
585
|
description;
|
|
257
586
|
tool_schema;
|
|
587
|
+
/**
|
|
588
|
+
* Initialize tool metadata from subclass implementations.
|
|
589
|
+
*/
|
|
258
590
|
constructor() {
|
|
259
591
|
this.name = this.getName(), this.description = this.getDescription(), this.tool_schema = this.getToolSchema();
|
|
260
592
|
}
|
|
593
|
+
/**
|
|
594
|
+
* Name that uniquely identifies this tool.
|
|
595
|
+
* @returns A short, stable identifier string.
|
|
596
|
+
*/
|
|
261
597
|
getName() {
|
|
262
|
-
throw new
|
|
598
|
+
throw new d("Tool name not defined.");
|
|
263
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* Human-readable description of what the tool does.
|
|
602
|
+
* @returns Description string shown to the model.
|
|
603
|
+
*/
|
|
264
604
|
getDescription() {
|
|
265
|
-
throw new
|
|
605
|
+
throw new d("Tool description not defined.");
|
|
266
606
|
}
|
|
607
|
+
/**
|
|
608
|
+
* Structured schema describing tool parameters and output.
|
|
609
|
+
* @returns ToolSchema instance.
|
|
610
|
+
*/
|
|
267
611
|
getToolSchema() {
|
|
268
|
-
throw new
|
|
612
|
+
throw new d("Tool parameter schema not defined.");
|
|
269
613
|
}
|
|
270
614
|
// @ts-ignore
|
|
615
|
+
/**
|
|
616
|
+
* Execute the tool against provided input parameters.
|
|
617
|
+
* @param input Parsed arguments from the model.
|
|
618
|
+
* @returns Tool-specific output.
|
|
619
|
+
*/
|
|
271
620
|
execute(e) {
|
|
272
621
|
return null;
|
|
273
622
|
}
|
|
274
623
|
}
|
|
275
|
-
class
|
|
276
|
-
sequence;
|
|
277
|
-
name;
|
|
278
|
-
parameters;
|
|
279
|
-
type;
|
|
280
|
-
constructor(e, s, t, o) {
|
|
281
|
-
this.sequence = e, this.name = s, this.parameters = t, this.type = o;
|
|
282
|
-
}
|
|
283
|
-
static builder() {
|
|
284
|
-
return new k();
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
class k {
|
|
288
|
-
_sequence;
|
|
289
|
-
_name;
|
|
290
|
-
_parameters;
|
|
291
|
-
_type;
|
|
292
|
-
sequence(e) {
|
|
293
|
-
return this._sequence = e, this;
|
|
294
|
-
}
|
|
295
|
-
name(e) {
|
|
296
|
-
return this._name = e, this;
|
|
297
|
-
}
|
|
298
|
-
parameters(e) {
|
|
299
|
-
return this._parameters = e, this;
|
|
300
|
-
}
|
|
301
|
-
type(e) {
|
|
302
|
-
return this._type = e, this;
|
|
303
|
-
}
|
|
304
|
-
build() {
|
|
305
|
-
return this._sequence == null && (this._sequence = 0), new _(this._sequence, this._name, this._parameters, this._type);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
class q {
|
|
624
|
+
class B {
|
|
309
625
|
parameters;
|
|
310
626
|
output;
|
|
311
627
|
/**
|
|
@@ -313,23 +629,24 @@ class q {
|
|
|
313
629
|
* @param parameters Ordered list of input parameters the tool accepts.
|
|
314
630
|
* @param output Human-readable description of the tool output.
|
|
315
631
|
*/
|
|
316
|
-
constructor(e,
|
|
317
|
-
this.parameters = e, this.output =
|
|
632
|
+
constructor(e, t) {
|
|
633
|
+
this.parameters = e, this.output = t;
|
|
318
634
|
}
|
|
319
635
|
/**
|
|
320
636
|
* Return a tool schema builder, so you can properly construct tools instead of dealing with the constructor
|
|
321
637
|
* @returns a tool schema builder.
|
|
322
638
|
*/
|
|
323
639
|
static builder() {
|
|
324
|
-
return new
|
|
640
|
+
return new D();
|
|
325
641
|
}
|
|
326
642
|
}
|
|
327
|
-
class
|
|
643
|
+
class D {
|
|
328
644
|
_parameters;
|
|
329
645
|
_output;
|
|
330
646
|
/**
|
|
331
647
|
* Add a parameter definition to the schema.
|
|
332
648
|
* @param parameter Fully constructed parameter to append.
|
|
649
|
+
* @returns This builder for chaining.
|
|
333
650
|
*/
|
|
334
651
|
addParameter(e) {
|
|
335
652
|
return this._parameters == null && (this._parameters = []), this._parameters.push(e), this;
|
|
@@ -337,18 +654,20 @@ class x {
|
|
|
337
654
|
/**
|
|
338
655
|
* Describe the output of the tool.
|
|
339
656
|
* @param output Text description of what the tool returns.
|
|
657
|
+
* @returns This builder for chaining.
|
|
340
658
|
*/
|
|
341
659
|
output(e) {
|
|
342
660
|
return this._output = e, this;
|
|
343
661
|
}
|
|
344
662
|
/**
|
|
345
663
|
* Build the ToolSchema instance from the collected fields.
|
|
664
|
+
* @returns Constructed ToolSchema describing parameters and output.
|
|
346
665
|
*/
|
|
347
666
|
build() {
|
|
348
|
-
return this._parameters == null && (this._parameters = []), new
|
|
667
|
+
return this._parameters == null && (this._parameters = []), new B(this._parameters, this._output);
|
|
349
668
|
}
|
|
350
669
|
}
|
|
351
|
-
class
|
|
670
|
+
class J {
|
|
352
671
|
name;
|
|
353
672
|
description;
|
|
354
673
|
type;
|
|
@@ -360,55 +679,69 @@ class O {
|
|
|
360
679
|
* @param type JSON-serializable type name (e.g., string, number).
|
|
361
680
|
* @param required Whether the parameter must be provided.
|
|
362
681
|
*/
|
|
363
|
-
constructor(e,
|
|
364
|
-
this.name = e, this.description =
|
|
682
|
+
constructor(e, t, o, s) {
|
|
683
|
+
this.name = e, this.description = t, this.type = o, this.required = s, this.assertValidType();
|
|
365
684
|
}
|
|
366
685
|
/**
|
|
367
686
|
* Placeholder for validating supported parameter types.
|
|
368
687
|
*/
|
|
369
688
|
assertValidType() {
|
|
370
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* Create a builder for constructing a Parameter.
|
|
692
|
+
* @returns A ParameterBuilder instance.
|
|
693
|
+
*/
|
|
371
694
|
static builder() {
|
|
372
|
-
return new
|
|
695
|
+
return new A();
|
|
373
696
|
}
|
|
374
697
|
}
|
|
375
|
-
class
|
|
698
|
+
class A {
|
|
376
699
|
_name;
|
|
377
700
|
_description;
|
|
378
701
|
_type;
|
|
379
702
|
_required;
|
|
380
703
|
/**
|
|
381
704
|
* Set the parameter name.
|
|
705
|
+
* @returns This builder for chaining.
|
|
382
706
|
*/
|
|
383
707
|
name(e) {
|
|
384
708
|
return this._name = e, this;
|
|
385
709
|
}
|
|
386
710
|
/**
|
|
387
711
|
* Set the parameter description.
|
|
712
|
+
* @returns This builder for chaining.
|
|
388
713
|
*/
|
|
389
714
|
description(e) {
|
|
390
715
|
return this._description = e, this;
|
|
391
716
|
}
|
|
392
717
|
/**
|
|
393
718
|
* Set the parameter type.
|
|
719
|
+
* @returns This builder for chaining.
|
|
394
720
|
*/
|
|
395
721
|
type(e) {
|
|
396
722
|
return this._type = e, this;
|
|
397
723
|
}
|
|
398
724
|
/**
|
|
399
725
|
* Mark the parameter as required or optional.
|
|
726
|
+
* @returns This builder for chaining.
|
|
400
727
|
*/
|
|
401
728
|
required(e) {
|
|
402
729
|
return this._required = e, this;
|
|
403
730
|
}
|
|
404
731
|
/**
|
|
405
732
|
* Build a Parameter instance using the accumulated fields.
|
|
733
|
+
* @returns Constructed Parameter definition.
|
|
406
734
|
*/
|
|
407
735
|
build() {
|
|
408
|
-
return this._required == null && (this._required = !1), new
|
|
736
|
+
return this._required == null && (this._required = !1), new J(
|
|
737
|
+
this._name,
|
|
738
|
+
this._description,
|
|
739
|
+
this._type,
|
|
740
|
+
this._required
|
|
741
|
+
);
|
|
409
742
|
}
|
|
410
743
|
}
|
|
411
|
-
class
|
|
744
|
+
class L extends q {
|
|
412
745
|
endpoint;
|
|
413
746
|
model;
|
|
414
747
|
options;
|
|
@@ -418,107 +751,153 @@ class E extends N {
|
|
|
418
751
|
* @param model Model name/tag to use for inference.
|
|
419
752
|
* @param options Additional Ollama options passed through to the API.
|
|
420
753
|
*/
|
|
421
|
-
constructor(e,
|
|
422
|
-
super(), this.endpoint = e, this.model =
|
|
754
|
+
constructor(e, t, o) {
|
|
755
|
+
super(), this.endpoint = e, this.model = t, this.options = o;
|
|
423
756
|
}
|
|
424
757
|
/**
|
|
425
758
|
* Call the Ollama chat API with the provided conversation and tools.
|
|
426
759
|
* Formats the request, performs the HTTP POST, and translates the response into a ModelResponse.
|
|
427
760
|
*/
|
|
428
761
|
async invoke(e) {
|
|
429
|
-
let
|
|
762
|
+
let t = {
|
|
430
763
|
model: this.model,
|
|
431
764
|
messages: this._formatMessages(e),
|
|
432
765
|
tools: this._formatTools(e),
|
|
433
766
|
...this.options
|
|
434
|
-
},
|
|
435
|
-
|
|
436
|
-
{
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
);
|
|
444
|
-
if (
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
for (let h in o.message.tool_calls) {
|
|
449
|
-
const r = o.message.tool_calls[h];
|
|
450
|
-
let l = "function", g = r[l]?.name, f = r[l]?.index, y = r[l]?.arguments;
|
|
767
|
+
}, o = await fetch(this.endpoint + "/api/chat", {
|
|
768
|
+
method: "POST",
|
|
769
|
+
headers: {
|
|
770
|
+
"Content-Type": "application/json"
|
|
771
|
+
},
|
|
772
|
+
body: JSON.stringify(t)
|
|
773
|
+
});
|
|
774
|
+
if (!o.ok)
|
|
775
|
+
throw new Error(`HTTP error! status: ${o.status}`);
|
|
776
|
+
let s = await o.json(), i = [];
|
|
777
|
+
if (s.message.tool_calls)
|
|
778
|
+
for (let a in s.message.tool_calls) {
|
|
779
|
+
const r = s.message.tool_calls[a];
|
|
780
|
+
let c = "function", T = r[c]?.name, y = r[c]?.index, w = r.id ?? void 0, M = typeof r[c]?.arguments == "string" ? JSON.parse(r[c]?.arguments) : r[c]?.arguments;
|
|
451
781
|
i.push(
|
|
452
|
-
|
|
782
|
+
v.builder().name(T).type(c).parameters(M).sequence(y).id(w).build()
|
|
453
783
|
);
|
|
454
784
|
}
|
|
455
|
-
return
|
|
785
|
+
return h.builder().toolCalls(i).role(s.message.role).content(s.message.content).thinking(s.message.thinking).build();
|
|
456
786
|
}
|
|
457
787
|
/**
|
|
458
788
|
* Convert internal tool definitions into the JSON schema format expected by Ollama.
|
|
789
|
+
* @param request Model request containing declared tools.
|
|
790
|
+
* @returns Array of tool schema objects formatted for the Ollama API.
|
|
459
791
|
*/
|
|
460
792
|
_formatTools(e) {
|
|
461
|
-
let
|
|
793
|
+
let t = [];
|
|
462
794
|
for (let o of e.tools) {
|
|
463
|
-
let
|
|
795
|
+
let s = {}, i = [];
|
|
464
796
|
for (let r of o.getToolSchema().parameters)
|
|
465
|
-
|
|
466
|
-
let
|
|
797
|
+
s[r.name] = {}, s[r.name].type = r.type, s[r.name].description = r.description, r.required && i.push(r.name);
|
|
798
|
+
let a = {
|
|
467
799
|
type: "function",
|
|
468
800
|
function: {
|
|
469
801
|
name: o.getName(),
|
|
470
802
|
description: o.getDescription(),
|
|
471
803
|
parameters: {
|
|
472
804
|
type: "object",
|
|
473
|
-
properties:
|
|
474
|
-
required:
|
|
805
|
+
properties: s,
|
|
806
|
+
required: i
|
|
475
807
|
}
|
|
476
808
|
}
|
|
477
809
|
};
|
|
478
|
-
|
|
810
|
+
t.push(a);
|
|
479
811
|
}
|
|
480
|
-
return
|
|
812
|
+
return t;
|
|
481
813
|
}
|
|
482
814
|
/**
|
|
483
815
|
* Convert internal message objects into Ollama's chat message shape.
|
|
484
816
|
* Passes through assistant/system/user roles and maps tool role into the expected structure.
|
|
817
|
+
* @param request Model request containing the message history.
|
|
818
|
+
* @returns Array of serialized messages ready for Ollama.
|
|
485
819
|
*/
|
|
486
820
|
_formatMessages(e) {
|
|
487
|
-
let
|
|
488
|
-
for (let
|
|
489
|
-
if (
|
|
490
|
-
|
|
821
|
+
let t = [];
|
|
822
|
+
for (let o of e.messages) {
|
|
823
|
+
if (o.role == "assistant" || o.role == "system" || o.role == "user") {
|
|
824
|
+
t.push(this._formatSingleMessage(o));
|
|
491
825
|
continue;
|
|
492
826
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
827
|
+
if (o.role == "tool") {
|
|
828
|
+
for (const s of o.content)
|
|
829
|
+
if (s.getMessageComponentType() == l.ToolResult) {
|
|
830
|
+
const i = s;
|
|
831
|
+
t.push({
|
|
832
|
+
role: o.role,
|
|
833
|
+
name: i.toolName,
|
|
834
|
+
content: JSON.stringify(i.toolResult)
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
}
|
|
500
838
|
}
|
|
501
|
-
return
|
|
839
|
+
return t;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Format everything sent by a user or LLM (no tools)
|
|
843
|
+
* @param message Message to serialize for Ollama.
|
|
844
|
+
* @returns Serialized message payload.
|
|
845
|
+
*/
|
|
846
|
+
_formatSingleMessage(e) {
|
|
847
|
+
let t = {
|
|
848
|
+
role: e.role
|
|
849
|
+
}, o, s, i;
|
|
850
|
+
for (const a of e.content) {
|
|
851
|
+
if (a.getMessageComponentType() == l.Content) {
|
|
852
|
+
const r = a;
|
|
853
|
+
o == null && (o = ""), o += r.get();
|
|
854
|
+
}
|
|
855
|
+
if (a.getMessageComponentType() == l.Thinking) {
|
|
856
|
+
const r = a;
|
|
857
|
+
i == null && (i = ""), i += r.get();
|
|
858
|
+
}
|
|
859
|
+
if (a.getMessageComponentType() == l.ToolCall) {
|
|
860
|
+
const r = a;
|
|
861
|
+
s == null && (s = []), s.push(this._formatToolCall(r));
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return o != null && (t.content = o), s != null && (t.tool_calls = s), i != null && (t.thinking = i), t;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Convert a ToolCall into the structure Ollama expects.
|
|
868
|
+
* @param toolCall ToolCall to serialize.
|
|
869
|
+
* @returns Minimal representation containing function name and arguments.
|
|
870
|
+
*/
|
|
871
|
+
_formatToolCall(e) {
|
|
872
|
+
return {
|
|
873
|
+
function: {
|
|
874
|
+
name: e.name,
|
|
875
|
+
arguments: e.parameters
|
|
876
|
+
}
|
|
877
|
+
};
|
|
502
878
|
}
|
|
503
879
|
}
|
|
504
880
|
export {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
N as
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
881
|
+
O as Agent,
|
|
882
|
+
x as Content,
|
|
883
|
+
b as Conversation,
|
|
884
|
+
C as ConversationManager,
|
|
885
|
+
f as DefaultConversationManager,
|
|
886
|
+
h as Message,
|
|
887
|
+
N as MessageBuilder,
|
|
888
|
+
u as MessageComponent,
|
|
889
|
+
l as MessageComponentType,
|
|
890
|
+
q as Model,
|
|
891
|
+
E as ModelRequest,
|
|
892
|
+
_ as ModelRequestBuilder,
|
|
893
|
+
L as OllamaModel,
|
|
894
|
+
J as Parameter,
|
|
895
|
+
A as ParameterBuilder,
|
|
896
|
+
k as Thinking,
|
|
897
|
+
F as Tool,
|
|
898
|
+
v as ToolCall,
|
|
899
|
+
P as ToolCallBuilder,
|
|
900
|
+
m as ToolResult,
|
|
901
|
+
B as ToolSchema,
|
|
902
|
+
D as ToolSchemaBuilder
|
|
524
903
|
};
|