@intelliweave/embedded 1.7.59 → 1.8.61
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/component/component.d.ts +333 -47
- package/dist/component/component.js +31 -25
- package/dist/intelliweave-wordpress.zip +0 -0
- package/dist/node/node.d.ts +336 -48
- package/dist/node/node.js +22 -16
- package/dist/react/react.d.ts +333 -47
- package/dist/react/react.js +32 -26
- package/dist/script-tag/script-tag.js +62 -49
- package/dist/webpack/index.d.ts +336 -48
- package/dist/webpack/index.js +32 -26
- package/package.json +4 -2
package/dist/webpack/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Optional } from 'utility-types';
|
|
2
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
3
|
import * as onnxruntime_web from 'onnxruntime-web';
|
|
3
4
|
import { InferenceSession, Tensor } from 'onnxruntime-web';
|
|
4
5
|
import React from 'react';
|
|
@@ -81,6 +82,173 @@ interface TokenWindowGroupItem<CustomDataType> {
|
|
|
81
82
|
disabled?: boolean;
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
// ==================================================================================================
|
|
86
|
+
// JSON Schema Draft 07
|
|
87
|
+
// ==================================================================================================
|
|
88
|
+
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
89
|
+
// --------------------------------------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Primitive type
|
|
93
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
94
|
+
*/
|
|
95
|
+
type JSONSchema7TypeName =
|
|
96
|
+
| "string" //
|
|
97
|
+
| "number"
|
|
98
|
+
| "integer"
|
|
99
|
+
| "boolean"
|
|
100
|
+
| "object"
|
|
101
|
+
| "array"
|
|
102
|
+
| "null";
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Primitive type
|
|
106
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
107
|
+
*/
|
|
108
|
+
type JSONSchema7Type =
|
|
109
|
+
| string //
|
|
110
|
+
| number
|
|
111
|
+
| boolean
|
|
112
|
+
| JSONSchema7Object
|
|
113
|
+
| JSONSchema7Array
|
|
114
|
+
| null;
|
|
115
|
+
|
|
116
|
+
// Workaround for infinite type recursion
|
|
117
|
+
interface JSONSchema7Object {
|
|
118
|
+
[key: string]: JSONSchema7Type;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Workaround for infinite type recursion
|
|
122
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
123
|
+
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Meta schema
|
|
127
|
+
*
|
|
128
|
+
* Recommended values:
|
|
129
|
+
* - 'http://json-schema.org/schema#'
|
|
130
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
131
|
+
* - 'http://json-schema.org/draft-07/schema#'
|
|
132
|
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
133
|
+
*
|
|
134
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
135
|
+
*/
|
|
136
|
+
type JSONSchema7Version = string;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* JSON Schema v7
|
|
140
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
141
|
+
*/
|
|
142
|
+
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
143
|
+
interface JSONSchema7 {
|
|
144
|
+
$id?: string | undefined;
|
|
145
|
+
$ref?: string | undefined;
|
|
146
|
+
$schema?: JSONSchema7Version | undefined;
|
|
147
|
+
$comment?: string | undefined;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
151
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
152
|
+
*/
|
|
153
|
+
$defs?: {
|
|
154
|
+
[key: string]: JSONSchema7Definition;
|
|
155
|
+
} | undefined;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
159
|
+
*/
|
|
160
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
161
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
162
|
+
const?: JSONSchema7Type | undefined;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
166
|
+
*/
|
|
167
|
+
multipleOf?: number | undefined;
|
|
168
|
+
maximum?: number | undefined;
|
|
169
|
+
exclusiveMaximum?: number | undefined;
|
|
170
|
+
minimum?: number | undefined;
|
|
171
|
+
exclusiveMinimum?: number | undefined;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
175
|
+
*/
|
|
176
|
+
maxLength?: number | undefined;
|
|
177
|
+
minLength?: number | undefined;
|
|
178
|
+
pattern?: string | undefined;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
182
|
+
*/
|
|
183
|
+
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
184
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
185
|
+
maxItems?: number | undefined;
|
|
186
|
+
minItems?: number | undefined;
|
|
187
|
+
uniqueItems?: boolean | undefined;
|
|
188
|
+
contains?: JSONSchema7Definition | undefined;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
192
|
+
*/
|
|
193
|
+
maxProperties?: number | undefined;
|
|
194
|
+
minProperties?: number | undefined;
|
|
195
|
+
required?: string[] | undefined;
|
|
196
|
+
properties?: {
|
|
197
|
+
[key: string]: JSONSchema7Definition;
|
|
198
|
+
} | undefined;
|
|
199
|
+
patternProperties?: {
|
|
200
|
+
[key: string]: JSONSchema7Definition;
|
|
201
|
+
} | undefined;
|
|
202
|
+
additionalProperties?: JSONSchema7Definition | undefined;
|
|
203
|
+
dependencies?: {
|
|
204
|
+
[key: string]: JSONSchema7Definition | string[];
|
|
205
|
+
} | undefined;
|
|
206
|
+
propertyNames?: JSONSchema7Definition | undefined;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
210
|
+
*/
|
|
211
|
+
if?: JSONSchema7Definition | undefined;
|
|
212
|
+
then?: JSONSchema7Definition | undefined;
|
|
213
|
+
else?: JSONSchema7Definition | undefined;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
217
|
+
*/
|
|
218
|
+
allOf?: JSONSchema7Definition[] | undefined;
|
|
219
|
+
anyOf?: JSONSchema7Definition[] | undefined;
|
|
220
|
+
oneOf?: JSONSchema7Definition[] | undefined;
|
|
221
|
+
not?: JSONSchema7Definition | undefined;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
225
|
+
*/
|
|
226
|
+
format?: string | undefined;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
230
|
+
*/
|
|
231
|
+
contentMediaType?: string | undefined;
|
|
232
|
+
contentEncoding?: string | undefined;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
236
|
+
*/
|
|
237
|
+
definitions?: {
|
|
238
|
+
[key: string]: JSONSchema7Definition;
|
|
239
|
+
} | undefined;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
243
|
+
*/
|
|
244
|
+
title?: string | undefined;
|
|
245
|
+
description?: string | undefined;
|
|
246
|
+
default?: JSONSchema7Type | undefined;
|
|
247
|
+
readOnly?: boolean | undefined;
|
|
248
|
+
writeOnly?: boolean | undefined;
|
|
249
|
+
examples?: JSONSchema7Type | undefined;
|
|
250
|
+
}
|
|
251
|
+
|
|
84
252
|
/** ChatGPT config options */
|
|
85
253
|
interface ChatGPTConfig {
|
|
86
254
|
/** API key */
|
|
@@ -113,11 +281,7 @@ interface ChatGPTToolConfig {
|
|
|
113
281
|
/** Description of the tool */
|
|
114
282
|
description: string;
|
|
115
283
|
/** Parameters for the tool */
|
|
116
|
-
params:
|
|
117
|
-
name: string;
|
|
118
|
-
type: string;
|
|
119
|
-
description: string;
|
|
120
|
-
}[];
|
|
284
|
+
params: JSONSchema7;
|
|
121
285
|
/** Callback function to process the tool */
|
|
122
286
|
callback: (params: any) => any;
|
|
123
287
|
/** If true, this tool call will be removed from the message history after it is executed. */
|
|
@@ -191,6 +355,102 @@ declare class ChatGPT {
|
|
|
191
355
|
resetConversation(): void;
|
|
192
356
|
}
|
|
193
357
|
|
|
358
|
+
/**
|
|
359
|
+
* Allows an MCP server to be used as a knowledge source for IntelliWeave.
|
|
360
|
+
*/
|
|
361
|
+
declare class MCPKnowledgeClient {
|
|
362
|
+
/** MCP client */
|
|
363
|
+
client?: Client;
|
|
364
|
+
/** All tools discovered on the MCP server. Only available after connect() has completed. */
|
|
365
|
+
tools: Awaited<ReturnType<Client['listTools']>>['tools'];
|
|
366
|
+
/** All toold discovered, mapped to IntelliWeave knowledge base actions */
|
|
367
|
+
iwActions: KnowledgeBaseItem[];
|
|
368
|
+
/** Statistics */
|
|
369
|
+
stats: {
|
|
370
|
+
toolsCalled: number;
|
|
371
|
+
};
|
|
372
|
+
/** Configuration */
|
|
373
|
+
config: {
|
|
374
|
+
/** Source ID */
|
|
375
|
+
id?: string;
|
|
376
|
+
/** URL to the MCP server endpoint */
|
|
377
|
+
baseURL?: string;
|
|
378
|
+
/** Custom connection function. If specified, baseURL is optional. */
|
|
379
|
+
connect?: () => Promise<Client>;
|
|
380
|
+
/**
|
|
381
|
+
* The name of the tool which provides knowledge searching. If specified, the search() will exclude this function and instead
|
|
382
|
+
* call it and show returned results. If not specified, the search() will just return all tools.
|
|
383
|
+
*/
|
|
384
|
+
searchToolName?: string;
|
|
385
|
+
/** Keep search function available for the AI to use. */
|
|
386
|
+
searchToolVisible?: boolean;
|
|
387
|
+
};
|
|
388
|
+
/** Constructor */
|
|
389
|
+
constructor(config: MCPKnowledgeClient['config']);
|
|
390
|
+
/** In-progress connection attempt */
|
|
391
|
+
private connectionPromise?;
|
|
392
|
+
/** Connect to the client */
|
|
393
|
+
connect(): Promise<Client<{
|
|
394
|
+
method: string;
|
|
395
|
+
params?: {
|
|
396
|
+
[x: string]: unknown;
|
|
397
|
+
_meta?: {
|
|
398
|
+
[x: string]: unknown;
|
|
399
|
+
progressToken?: string | number | undefined;
|
|
400
|
+
} | undefined;
|
|
401
|
+
} | undefined;
|
|
402
|
+
}, {
|
|
403
|
+
method: string;
|
|
404
|
+
params?: {
|
|
405
|
+
[x: string]: unknown;
|
|
406
|
+
_meta?: {
|
|
407
|
+
[x: string]: unknown;
|
|
408
|
+
} | undefined;
|
|
409
|
+
} | undefined;
|
|
410
|
+
}, {
|
|
411
|
+
[x: string]: unknown;
|
|
412
|
+
_meta?: {
|
|
413
|
+
[x: string]: unknown;
|
|
414
|
+
} | undefined;
|
|
415
|
+
}>>;
|
|
416
|
+
connectInternal(): Promise<Client<{
|
|
417
|
+
method: string;
|
|
418
|
+
params?: {
|
|
419
|
+
[x: string]: unknown;
|
|
420
|
+
_meta?: {
|
|
421
|
+
[x: string]: unknown;
|
|
422
|
+
progressToken?: string | number | undefined;
|
|
423
|
+
} | undefined;
|
|
424
|
+
} | undefined;
|
|
425
|
+
}, {
|
|
426
|
+
method: string;
|
|
427
|
+
params?: {
|
|
428
|
+
[x: string]: unknown;
|
|
429
|
+
_meta?: {
|
|
430
|
+
[x: string]: unknown;
|
|
431
|
+
} | undefined;
|
|
432
|
+
} | undefined;
|
|
433
|
+
}, {
|
|
434
|
+
[x: string]: unknown;
|
|
435
|
+
_meta?: {
|
|
436
|
+
[x: string]: unknown;
|
|
437
|
+
} | undefined;
|
|
438
|
+
}>>;
|
|
439
|
+
/** Disconnect from server */
|
|
440
|
+
disconnect(): Promise<void>;
|
|
441
|
+
/** Fetch list of tools from the MCP server */
|
|
442
|
+
private fetchTools;
|
|
443
|
+
/** Cache last search result */
|
|
444
|
+
lastSearchQuery: string;
|
|
445
|
+
lastSearchResults: KnowledgeBaseItem[];
|
|
446
|
+
/** Perform a search query */
|
|
447
|
+
search(query: string): Promise<KnowledgeBaseItem[]>;
|
|
448
|
+
/** Perform search using the configured search function */
|
|
449
|
+
private performSearchCall;
|
|
450
|
+
/** Perform tool call. */
|
|
451
|
+
private performToolCall;
|
|
452
|
+
}
|
|
453
|
+
|
|
194
454
|
/**
|
|
195
455
|
* Register knowledge base sources and perform searches.
|
|
196
456
|
*/
|
|
@@ -230,7 +490,11 @@ declare class KnowledgeBase {
|
|
|
230
490
|
registerSourceFromURL(url: string, id?: string): void;
|
|
231
491
|
/** Clone this instance */
|
|
232
492
|
clone(): KnowledgeBase;
|
|
493
|
+
/** Registers an MCP server as a knowledge base source */
|
|
494
|
+
registerMCPSource(config: MCPKnowledgeClient['config']): MCPKnowledgeClient;
|
|
233
495
|
}
|
|
496
|
+
/** Knowledge fetcher */
|
|
497
|
+
type KnowledgeFetcher = (query: string) => (KnowledgeBaseItem[] | Promise<KnowledgeBaseItem[]>);
|
|
234
498
|
/** Knowledge base source */
|
|
235
499
|
interface KnowledgeBaseSource {
|
|
236
500
|
/** Source ID */
|
|
@@ -244,11 +508,15 @@ interface KnowledgeBaseSource {
|
|
|
244
508
|
/** If true, this source will not be queried. */
|
|
245
509
|
disabled?: boolean;
|
|
246
510
|
/** Source query function. This function should return a list of knowledge base entries that optionally match the query. */
|
|
247
|
-
query?:
|
|
511
|
+
query?: KnowledgeFetcher;
|
|
248
512
|
/** URL query for remote sources */
|
|
249
513
|
url?: string;
|
|
250
514
|
/** Pre-packaged knowledge base entries */
|
|
251
515
|
entries?: KnowledgeBaseItem[];
|
|
516
|
+
/** Remote knowledge server type (default is 'iw') */
|
|
517
|
+
backendType?: 'mcp' | 'iw';
|
|
518
|
+
/** If using MCP, this is the name of the tool to use to search for knowledge */
|
|
519
|
+
mcpSearchToolName?: string;
|
|
252
520
|
}
|
|
253
521
|
/** Knowledge base item */
|
|
254
522
|
interface KnowledgeBaseItem {
|
|
@@ -268,12 +536,8 @@ interface KnowledgeBaseItem {
|
|
|
268
536
|
isContext?: boolean;
|
|
269
537
|
/** If true, this item will not be visible to the AI. */
|
|
270
538
|
disabled?: boolean;
|
|
271
|
-
/** List of parameters for an action function. */
|
|
272
|
-
parameters?:
|
|
273
|
-
name: string;
|
|
274
|
-
type: 'string' | 'boolean' | 'number';
|
|
275
|
-
description: string;
|
|
276
|
-
})[];
|
|
539
|
+
/** List of parameters for an action function. Can either use IW's format, or a JSON Schema object. */
|
|
540
|
+
parameters?: KnowledgeBaseActionParameterSchema;
|
|
277
541
|
/**
|
|
278
542
|
* Item action. The parameters are defined in `parameters`. The response is stringified and sent to the AI.
|
|
279
543
|
* You can return any JSON-serializable object. You can also return a string describing to the AI the action
|
|
@@ -283,6 +547,14 @@ interface KnowledgeBaseItem {
|
|
|
283
547
|
/** If true, this item will be removed from the AI's message history after it gets called. This is a special case for LLMs that struggle with follow-up function calls and need to use the KB search functino first. */
|
|
284
548
|
removeFromMessageHistory?: boolean;
|
|
285
549
|
}
|
|
550
|
+
/** Parameter definition used by IntelliWeave */
|
|
551
|
+
interface IntelliWeaveParameterDefinition {
|
|
552
|
+
name: string;
|
|
553
|
+
type: 'string' | 'boolean' | 'number';
|
|
554
|
+
description: string;
|
|
555
|
+
}
|
|
556
|
+
/** Tool call input schema. Can either use IW's format, or a JSON Schema object */
|
|
557
|
+
type KnowledgeBaseActionParameterSchema = JSONSchema7 | IntelliWeaveParameterDefinition[];
|
|
286
558
|
/** Format for incoming KB webook. Sent from IntelliWeave to your endpoint. */
|
|
287
559
|
interface KnowledgeBaseWebhookRequest {
|
|
288
560
|
/** Type of the request. */
|
|
@@ -334,49 +606,53 @@ declare class AILogic {
|
|
|
334
606
|
/** Constructor */
|
|
335
607
|
constructor(ai: IntelliWeave);
|
|
336
608
|
/** Ask the AI a yes/no question associated with the specified data. Data must be JSON-serializable, or a string of any kind of data. */
|
|
337
|
-
boolean(
|
|
609
|
+
boolean(config: IntelliWeaveInstructConfig): Promise<boolean>;
|
|
610
|
+
/** Ask the AI to select a choice from a list of options. */
|
|
611
|
+
choose(config: IntelliWeaveInstructConfig & {
|
|
612
|
+
/** List of choices the AI can pick from. */
|
|
613
|
+
options: string[];
|
|
614
|
+
}): Promise<string | undefined>;
|
|
338
615
|
/**
|
|
339
|
-
|
|
340
|
-
@param question The question to ask the AI.
|
|
341
|
-
@param data The data to provide to the AI. This can be a string or a JSON-serializable object.
|
|
342
|
-
@param options The list of options to choose from.
|
|
616
|
+
* Ask the AI to extract data from input data. The AI will return the extracted data. Possibly an array of multiple extractions.
|
|
343
617
|
*/
|
|
344
|
-
|
|
618
|
+
extract<T = any>(config: IntelliWeaveInstructConfig & {
|
|
619
|
+
/** Allow multiple items to be returned. If true, returns an array instead of an object. */
|
|
620
|
+
allowMultiple?: boolean;
|
|
621
|
+
/** Fields to extract in each object. */
|
|
622
|
+
extractions: {
|
|
623
|
+
/** Field name */
|
|
624
|
+
name: string;
|
|
625
|
+
/** Field data type */
|
|
626
|
+
type: 'string' | 'number' | 'boolean' | 'date' | 'email' | 'phone' | 'address';
|
|
627
|
+
/** Describe to the AI what data to put in this field. */
|
|
628
|
+
description?: string;
|
|
629
|
+
}[];
|
|
630
|
+
}): Promise<T[]>;
|
|
345
631
|
/**
|
|
346
|
-
*
|
|
347
|
-
* Example: extract(myData, true, [
|
|
348
|
-
* { name: "id", type: "string", description: "The user's ID number." },
|
|
349
|
-
* { name: "firstName", type: "string", description: "The user's first name" },
|
|
350
|
-
* ])
|
|
351
|
-
* @param question The question to ask the AI.
|
|
352
|
-
* @param data The data to provide to the AI. This can be a string or a JSON-serializable object.
|
|
353
|
-
* @param allowMultiple Whether to allow multiple extractions or not.
|
|
354
|
-
* @param extractions The list of extractions to perform. Each extraction is an object with the following properties:
|
|
355
|
-
* - name: The name of the extraction. This will be the key in the returned object.
|
|
356
|
-
* - type: The type of the extraction. This can be "string", "number", "boolean", "date", "email", "url", "phone", "address", "name", "organization", "person", "location", "time", "duration", "money", "percentage", "quantity", "custom".
|
|
357
|
-
* - description: A description of the extraction. This is optional.
|
|
358
|
-
*/
|
|
359
|
-
extract(question: string, data: any, allowMultiple: boolean, extractions: {
|
|
360
|
-
name: string;
|
|
361
|
-
type: string;
|
|
362
|
-
description?: string;
|
|
363
|
-
}[]): Promise<any>;
|
|
364
|
-
/**
|
|
365
|
-
* Generate a Markdown document based on the input query from the user.
|
|
632
|
+
* Generate a Markdown document based on the data from the user.
|
|
366
633
|
*
|
|
367
|
-
* @param
|
|
368
|
-
* @
|
|
634
|
+
* @param config Instruct config.
|
|
635
|
+
* @returns A markdown document.
|
|
369
636
|
*/
|
|
370
|
-
generateMarkdown(
|
|
637
|
+
generateMarkdown(config: Omit<IntelliWeaveInstructConfig, 'instruction'>): Promise<string>;
|
|
371
638
|
/**
|
|
372
639
|
* Perform an instruction.
|
|
373
640
|
*
|
|
374
|
-
* @param
|
|
375
|
-
* @param query The user query to pass to the AI.
|
|
376
|
-
* @param callback The callback that will be called when streaming the response. Each call will contain the full text that has been generated so far.
|
|
641
|
+
* @param config Instruct config.
|
|
377
642
|
* @returns The final response from the AI.
|
|
378
643
|
*/
|
|
379
|
-
instruct(
|
|
644
|
+
instruct(config: IntelliWeaveInstructConfig): Promise<string>;
|
|
645
|
+
}
|
|
646
|
+
/** Config for any instruct call */
|
|
647
|
+
interface IntelliWeaveInstructConfig {
|
|
648
|
+
/** Instruction */
|
|
649
|
+
instruction: string;
|
|
650
|
+
/** Input data or query to process */
|
|
651
|
+
data: any;
|
|
652
|
+
/** Whether to allow the AI to use the knowledge base or not. If false, the AI will not use the knowledge base. */
|
|
653
|
+
allowKB?: boolean;
|
|
654
|
+
/** Callback that will be called when streaming the response. Each call will contain the full text that has been generated so far. */
|
|
655
|
+
callback?: (txt: string) => void;
|
|
380
656
|
}
|
|
381
657
|
|
|
382
658
|
/** Persona config received from the hub */
|
|
@@ -419,6 +695,8 @@ interface WebWeaverGPTConfig {
|
|
|
419
695
|
};
|
|
420
696
|
/** Knowledge base sources */
|
|
421
697
|
knowledge?: KnowledgeBaseSource[];
|
|
698
|
+
/** MCP servers */
|
|
699
|
+
mcpServers?: MCPKnowledgeClient['config'][];
|
|
422
700
|
}
|
|
423
701
|
/**
|
|
424
702
|
* IntelliWeave interface, loads a Persona from the hub and allows you to interact with it. This is the main entry point into the IntelliWeave
|
|
@@ -530,6 +808,14 @@ declare class WebWeaverSpeechOutput extends EventTarget {
|
|
|
530
808
|
/** Current player vars */
|
|
531
809
|
private currentPlayerVolume?;
|
|
532
810
|
private currentPlayer?;
|
|
811
|
+
/** The audio analyser node */
|
|
812
|
+
private analyserNode?;
|
|
813
|
+
/** The audio analyser buffer */
|
|
814
|
+
private analyserBuffer?;
|
|
815
|
+
/** @private Maximum volume heard this session */
|
|
816
|
+
private maxVolumeHeard;
|
|
817
|
+
/** Get current (realtime) audio output volume level, from 0 to 1 */
|
|
818
|
+
get volumeLevel(): number;
|
|
533
819
|
/** Speak the text */
|
|
534
820
|
speak(text: string): Promise<void>;
|
|
535
821
|
private _speakWithLock;
|
|
@@ -707,9 +993,9 @@ declare class WebWeaverSpeechRecognition extends EventTarget {
|
|
|
707
993
|
/** True if recognition is running */
|
|
708
994
|
isRunning: boolean;
|
|
709
995
|
/** The audio analyser node */
|
|
710
|
-
analyserNode
|
|
996
|
+
private analyserNode?;
|
|
711
997
|
/** The audio analyser buffer */
|
|
712
|
-
analyserBuffer
|
|
998
|
+
private analyserBuffer?;
|
|
713
999
|
/** The microphone stream */
|
|
714
1000
|
micStream?: MediaStream;
|
|
715
1001
|
/** Returns true if speech recognition is supported by this persona and browser */
|
|
@@ -1319,6 +1605,8 @@ declare function intelliweaveConfig(): IntelliWeaveGlobalConfig;
|
|
|
1319
1605
|
declare function sseEvents(stream: ReadableStream<Uint8Array>): AsyncGenerator<any, void, unknown>;
|
|
1320
1606
|
/** Get or create a user ID for this device. */
|
|
1321
1607
|
declare function getDefaultUserID(): string;
|
|
1608
|
+
/** Convert an IntelliWeave parameter list to JSON schema. Does not modify if it's already a JSON schema. */
|
|
1609
|
+
declare function convertParamsToJSONSchema(params: KnowledgeBaseActionParameterSchema): JSONSchema7;
|
|
1322
1610
|
|
|
1323
1611
|
/** Class to help with logging */
|
|
1324
1612
|
declare class Logging {
|
|
@@ -1461,4 +1749,4 @@ declare function useIntelliWeave(): IntelliWeave | undefined;
|
|
|
1461
1749
|
/** React hook to add an external KB search hook. This can provide static KB entries, or perform an async search and return dynamic entries. */
|
|
1462
1750
|
declare function useIntelliWeaveKnowledge(query: KnowledgeBaseSource['query'], dependencies?: any[]): void;
|
|
1463
1751
|
|
|
1464
|
-
export { AILogic, AudioSystem, type BufferType, BufferedWebSocket, ChatGPT, type ChatGPTConfig, type ChatGPTMessage, type ChatGPTToolConfig, FixedBufferStream, IntelliWeave, type IntelliWeaveGlobalConfig, IntelliWeaveProvider, IntelliWeaveStream, type IntelliWeaveStreamErrorEvent, type IntelliWeaveStreamEvent, type IntelliWeaveStreamTextOutputEvent, IntelliWeaveTranscriptionNode, KnowledgeBase, type KnowledgeBaseItem, type KnowledgeBaseSource, type KnowledgeBaseWebhookActionResponse, type KnowledgeBaseWebhookRequest, type KnowledgeBaseWebhookSearchResponse, Logging, ONNXModel, type ONNXTensors, OpenAITranscriptionNode, PCMPlayerNode, PCMReceiverNode, Resampler, type SupportedArrayBuffers, TokenWindow, TokenWindowGroup, type TokenWindowGroupItem, VoiceChunkOutputNode, VoiceDetectionNode, WebWeaverEmbed, type WebWeaverGPTConfig, WebWeaverSpeechOutput, WebWeaverSpeechRecognition, WebWeaverUI, audioToWav, floatTo16BitPCM, floatTo64BitPCM, getDefaultUserID, int16ToFloat32BitPCM, intelliweaveConfig, intelliweaveGlobalThis, sseEvents, trimWhitespaceInText, useIntelliWeave, useIntelliWeaveKnowledge };
|
|
1752
|
+
export { AILogic, AudioSystem, type BufferType, BufferedWebSocket, ChatGPT, type ChatGPTConfig, type ChatGPTMessage, type ChatGPTToolConfig, FixedBufferStream, IntelliWeave, type IntelliWeaveGlobalConfig, type IntelliWeaveInstructConfig, type IntelliWeaveParameterDefinition, IntelliWeaveProvider, IntelliWeaveStream, type IntelliWeaveStreamErrorEvent, type IntelliWeaveStreamEvent, type IntelliWeaveStreamTextOutputEvent, IntelliWeaveTranscriptionNode, KnowledgeBase, type KnowledgeBaseActionParameterSchema, type KnowledgeBaseItem, type KnowledgeBaseSource, type KnowledgeBaseWebhookActionResponse, type KnowledgeBaseWebhookRequest, type KnowledgeBaseWebhookSearchResponse, type KnowledgeFetcher, Logging, MCPKnowledgeClient, ONNXModel, type ONNXTensors, OpenAITranscriptionNode, PCMPlayerNode, PCMReceiverNode, Resampler, type SupportedArrayBuffers, TokenWindow, TokenWindowGroup, type TokenWindowGroupItem, VoiceChunkOutputNode, VoiceDetectionNode, WebWeaverEmbed, type WebWeaverGPTConfig, WebWeaverSpeechOutput, WebWeaverSpeechRecognition, WebWeaverUI, audioToWav, convertParamsToJSONSchema, floatTo16BitPCM, floatTo64BitPCM, getDefaultUserID, int16ToFloat32BitPCM, intelliweaveConfig, intelliweaveGlobalThis, sseEvents, trimWhitespaceInText, useIntelliWeave, useIntelliWeaveKnowledge };
|