@intelliweave/embedded 1.7.58 → 1.8.60
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/custom.d.ts +0 -24
- package/dist/component/component.d.ts +52 -37
- package/dist/component/component.js +32 -22
- package/dist/intelliweave-wordpress.zip +0 -0
- package/dist/node/node.d.ts +193 -48
- package/dist/node/node.js +19 -13
- package/dist/react/react.d.ts +47 -35
- package/dist/react/react.js +34 -24
- package/dist/script-tag/script-tag.js +36 -26
- package/dist/webpack/index.d.ts +165 -124
- package/dist/webpack/index.js +33 -23
- package/package.json +1 -1
package/custom.d.ts
CHANGED
|
@@ -18,27 +18,3 @@ declare module 'bestzip' {
|
|
|
18
18
|
const content: any;
|
|
19
19
|
export default content;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Global type declarations for the IntelliWeave library
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
declare interface IntelliWeaveConfig {
|
|
27
|
-
apiKey?: string;
|
|
28
|
-
analytics?: boolean;
|
|
29
|
-
debug?: boolean;
|
|
30
|
-
context?: string;
|
|
31
|
-
introductionMessage?: string;
|
|
32
|
-
introductionSuggestions?: string[];
|
|
33
|
-
knowledgeBase?: any[];
|
|
34
|
-
sources?: any[];
|
|
35
|
-
offsetX?: number;
|
|
36
|
-
offsetY?: number;
|
|
37
|
-
userID?: string;
|
|
38
|
-
hubAPI?: string;
|
|
39
|
-
backgroundColor?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
declare interface Window {
|
|
43
|
-
intelliweave: IntelliWeaveConfig;
|
|
44
|
-
}
|
|
@@ -297,6 +297,14 @@ declare class WebWeaverSpeechOutput extends EventTarget {
|
|
|
297
297
|
/** Current player vars */
|
|
298
298
|
private currentPlayerVolume?;
|
|
299
299
|
private currentPlayer?;
|
|
300
|
+
/** The audio analyser node */
|
|
301
|
+
private analyserNode?;
|
|
302
|
+
/** The audio analyser buffer */
|
|
303
|
+
private analyserBuffer?;
|
|
304
|
+
/** @private Maximum volume heard this session */
|
|
305
|
+
private maxVolumeHeard;
|
|
306
|
+
/** Get current (realtime) audio output volume level, from 0 to 1 */
|
|
307
|
+
get volumeLevel(): number;
|
|
300
308
|
/** Speak the text */
|
|
301
309
|
speak(text: string): Promise<void>;
|
|
302
310
|
private _speakWithLock;
|
|
@@ -474,9 +482,9 @@ declare class WebWeaverSpeechRecognition extends EventTarget {
|
|
|
474
482
|
/** True if recognition is running */
|
|
475
483
|
isRunning: boolean;
|
|
476
484
|
/** The audio analyser node */
|
|
477
|
-
analyserNode
|
|
485
|
+
private analyserNode?;
|
|
478
486
|
/** The audio analyser buffer */
|
|
479
|
-
analyserBuffer
|
|
487
|
+
private analyserBuffer?;
|
|
480
488
|
/** The microphone stream */
|
|
481
489
|
micStream?: MediaStream;
|
|
482
490
|
/** Returns true if speech recognition is supported by this persona and browser */
|
|
@@ -535,49 +543,53 @@ declare class AILogic {
|
|
|
535
543
|
/** Constructor */
|
|
536
544
|
constructor(ai: IntelliWeave);
|
|
537
545
|
/** 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. */
|
|
538
|
-
boolean(
|
|
546
|
+
boolean(config: IntelliWeaveInstructConfig): Promise<boolean>;
|
|
547
|
+
/** Ask the AI to select a choice from a list of options. */
|
|
548
|
+
choose(config: IntelliWeaveInstructConfig & {
|
|
549
|
+
/** List of choices the AI can pick from. */
|
|
550
|
+
options: string[];
|
|
551
|
+
}): Promise<string | undefined>;
|
|
539
552
|
/**
|
|
540
|
-
|
|
541
|
-
@param question The question to ask the AI.
|
|
542
|
-
@param data The data to provide to the AI. This can be a string or a JSON-serializable object.
|
|
543
|
-
@param options The list of options to choose from.
|
|
553
|
+
* Ask the AI to extract data from input data. The AI will return the extracted data. Possibly an array of multiple extractions.
|
|
544
554
|
*/
|
|
545
|
-
|
|
555
|
+
extract<T = any>(config: IntelliWeaveInstructConfig & {
|
|
556
|
+
/** Allow multiple items to be returned. If true, returns an array instead of an object. */
|
|
557
|
+
allowMultiple?: boolean;
|
|
558
|
+
/** Fields to extract in each object. */
|
|
559
|
+
extractions: {
|
|
560
|
+
/** Field name */
|
|
561
|
+
name: string;
|
|
562
|
+
/** Field data type */
|
|
563
|
+
type: 'string' | 'number' | 'boolean' | 'date' | 'email' | 'phone' | 'address';
|
|
564
|
+
/** Describe to the AI what data to put in this field. */
|
|
565
|
+
description?: string;
|
|
566
|
+
}[];
|
|
567
|
+
}): Promise<T[]>;
|
|
546
568
|
/**
|
|
547
|
-
*
|
|
548
|
-
* Example: extract(myData, true, [
|
|
549
|
-
* { name: "id", type: "string", description: "The user's ID number." },
|
|
550
|
-
* { name: "firstName", type: "string", description: "The user's first name" },
|
|
551
|
-
* ])
|
|
552
|
-
* @param question The question to ask the AI.
|
|
553
|
-
* @param data The data to provide to the AI. This can be a string or a JSON-serializable object.
|
|
554
|
-
* @param allowMultiple Whether to allow multiple extractions or not.
|
|
555
|
-
* @param extractions The list of extractions to perform. Each extraction is an object with the following properties:
|
|
556
|
-
* - name: The name of the extraction. This will be the key in the returned object.
|
|
557
|
-
* - 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".
|
|
558
|
-
* - description: A description of the extraction. This is optional.
|
|
559
|
-
*/
|
|
560
|
-
extract(question: string, data: any, allowMultiple: boolean, extractions: {
|
|
561
|
-
name: string;
|
|
562
|
-
type: string;
|
|
563
|
-
description?: string;
|
|
564
|
-
}[]): Promise<any>;
|
|
565
|
-
/**
|
|
566
|
-
* Generate a Markdown document based on the input query from the user.
|
|
569
|
+
* Generate a Markdown document based on the data from the user.
|
|
567
570
|
*
|
|
568
571
|
* @param query The query to generate the document from.
|
|
569
|
-
* @param
|
|
572
|
+
* @param config Instruct config.
|
|
570
573
|
*/
|
|
571
|
-
generateMarkdown(
|
|
574
|
+
generateMarkdown(config: Omit<IntelliWeaveInstructConfig, 'instruction'>): Promise<string>;
|
|
572
575
|
/**
|
|
573
576
|
* Perform an instruction.
|
|
574
577
|
*
|
|
575
|
-
* @param
|
|
576
|
-
* @param query The user query to pass to the AI.
|
|
577
|
-
* @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.
|
|
578
|
+
* @param config Instruct config.
|
|
578
579
|
* @returns The final response from the AI.
|
|
579
580
|
*/
|
|
580
|
-
instruct(
|
|
581
|
+
instruct(config: IntelliWeaveInstructConfig): Promise<string>;
|
|
582
|
+
}
|
|
583
|
+
/** Config for any instruct call */
|
|
584
|
+
interface IntelliWeaveInstructConfig {
|
|
585
|
+
/** Instruction */
|
|
586
|
+
instruction: string;
|
|
587
|
+
/** Input data or query to process */
|
|
588
|
+
data: any;
|
|
589
|
+
/** Whether to allow the AI to use the knowledge base or not. If false, the AI will not use the knowledge base. */
|
|
590
|
+
allowKB?: boolean;
|
|
591
|
+
/** Callback that will be called when streaming the response. Each call will contain the full text that has been generated so far. */
|
|
592
|
+
callback?: (txt: string) => void;
|
|
581
593
|
}
|
|
582
594
|
|
|
583
595
|
/** Persona config received from the hub */
|
|
@@ -685,7 +697,7 @@ declare class IntelliWeave extends EventTarget {
|
|
|
685
697
|
setModel(id: string): void;
|
|
686
698
|
private _lastSystemMsg;
|
|
687
699
|
/** Get the system message prefix, before the KB entries are added */
|
|
688
|
-
getContextPrefix(): Promise<
|
|
700
|
+
getContextPrefix(): Promise<string>;
|
|
689
701
|
/** Get system message to send to the AI */
|
|
690
702
|
onBeforeMessageProcessing(): Promise<void>;
|
|
691
703
|
private _lastOutput?;
|
|
@@ -789,8 +801,11 @@ declare class WebWeaverEmbed extends BaseComponent {
|
|
|
789
801
|
html: () => string;
|
|
790
802
|
/** On create */
|
|
791
803
|
onCreate(): void;
|
|
792
|
-
|
|
793
|
-
private
|
|
804
|
+
private _lastLogo?;
|
|
805
|
+
private _lastBackground?;
|
|
806
|
+
private _lastTextColor?;
|
|
807
|
+
/** Apply UI styles from config and attributes, prioritizing attributes */
|
|
808
|
+
private applyConfigStylesAndAttributes;
|
|
794
809
|
/** Called on update */
|
|
795
810
|
onUpdate(): void;
|
|
796
811
|
/** Called when the component is created */
|