@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.
@@ -205,6 +205,14 @@ declare class WebWeaverSpeechOutput extends EventTarget {
205
205
  /** Current player vars */
206
206
  private currentPlayerVolume?;
207
207
  private currentPlayer?;
208
+ /** The audio analyser node */
209
+ private analyserNode?;
210
+ /** The audio analyser buffer */
211
+ private analyserBuffer?;
212
+ /** @private Maximum volume heard this session */
213
+ private maxVolumeHeard;
214
+ /** Get current (realtime) audio output volume level, from 0 to 1 */
215
+ get volumeLevel(): number;
208
216
  /** Speak the text */
209
217
  speak(text: string): Promise<void>;
210
218
  private _speakWithLock;
@@ -382,9 +390,9 @@ declare class WebWeaverSpeechRecognition extends EventTarget {
382
390
  /** True if recognition is running */
383
391
  isRunning: boolean;
384
392
  /** The audio analyser node */
385
- analyserNode?: AnalyserNode;
393
+ private analyserNode?;
386
394
  /** The audio analyser buffer */
387
- analyserBuffer?: Float32Array;
395
+ private analyserBuffer?;
388
396
  /** The microphone stream */
389
397
  micStream?: MediaStream;
390
398
  /** Returns true if speech recognition is supported by this persona and browser */
@@ -443,49 +451,53 @@ declare class AILogic {
443
451
  /** Constructor */
444
452
  constructor(ai: IntelliWeave);
445
453
  /** 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. */
446
- boolean(question: string, data: any): Promise<boolean>;
454
+ boolean(config: IntelliWeaveInstructConfig): Promise<boolean>;
455
+ /** Ask the AI to select a choice from a list of options. */
456
+ choose(config: IntelliWeaveInstructConfig & {
457
+ /** List of choices the AI can pick from. */
458
+ options: string[];
459
+ }): Promise<string | undefined>;
447
460
  /**
448
- Ask the AI to select a choice from a list of options. The AI will return the selected choice.
449
- @param question The question to ask the AI.
450
- @param data The data to provide to the AI. This can be a string or a JSON-serializable object.
451
- @param options The list of options to choose from.
461
+ * Ask the AI to extract data from input data. The AI will return the extracted data. Possibly an array of multiple extractions.
452
462
  */
453
- choose(question: string, data: any, options: string[]): Promise<string | undefined>;
463
+ extract<T = any>(config: IntelliWeaveInstructConfig & {
464
+ /** Allow multiple items to be returned. If true, returns an array instead of an object. */
465
+ allowMultiple?: boolean;
466
+ /** Fields to extract in each object. */
467
+ extractions: {
468
+ /** Field name */
469
+ name: string;
470
+ /** Field data type */
471
+ type: 'string' | 'number' | 'boolean' | 'date' | 'email' | 'phone' | 'address';
472
+ /** Describe to the AI what data to put in this field. */
473
+ description?: string;
474
+ }[];
475
+ }): Promise<T[]>;
454
476
  /**
455
- * Ask the AI to extract data from a text. The AI will return the extracted data. Possibly an array of multiple extractions.
456
- * Example: extract(myData, true, [
457
- * { name: "id", type: "string", description: "The user's ID number." },
458
- * { name: "firstName", type: "string", description: "The user's first name" },
459
- * ])
460
- * @param question The question to ask the AI.
461
- * @param data The data to provide to the AI. This can be a string or a JSON-serializable object.
462
- * @param allowMultiple Whether to allow multiple extractions or not.
463
- * @param extractions The list of extractions to perform. Each extraction is an object with the following properties:
464
- * - name: The name of the extraction. This will be the key in the returned object.
465
- * - 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".
466
- * - description: A description of the extraction. This is optional.
467
- */
468
- extract(question: string, data: any, allowMultiple: boolean, extractions: {
469
- name: string;
470
- type: string;
471
- description?: string;
472
- }[]): Promise<any>;
473
- /**
474
- * Generate a Markdown document based on the input query from the user.
477
+ * Generate a Markdown document based on the data from the user.
475
478
  *
476
479
  * @param query The query to generate the document from.
477
- * @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.
480
+ * @param config Instruct config.
478
481
  */
479
- generateMarkdown(query: string, callback: (txt: string) => void): Promise<string | null>;
482
+ generateMarkdown(config: Omit<IntelliWeaveInstructConfig, 'instruction'>): Promise<string>;
480
483
  /**
481
484
  * Perform an instruction.
482
485
  *
483
- * @param instruction Describe the action to perform.
484
- * @param query The user query to pass to the AI.
485
- * @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.
486
+ * @param config Instruct config.
486
487
  * @returns The final response from the AI.
487
488
  */
488
- instruct(instruction: string, query: string, callback: (txt: string) => void): Promise<string | null>;
489
+ instruct(config: IntelliWeaveInstructConfig): Promise<string>;
490
+ }
491
+ /** Config for any instruct call */
492
+ interface IntelliWeaveInstructConfig {
493
+ /** Instruction */
494
+ instruction: string;
495
+ /** Input data or query to process */
496
+ data: any;
497
+ /** Whether to allow the AI to use the knowledge base or not. If false, the AI will not use the knowledge base. */
498
+ allowKB?: boolean;
499
+ /** Callback that will be called when streaming the response. Each call will contain the full text that has been generated so far. */
500
+ callback?: (txt: string) => void;
489
501
  }
490
502
 
491
503
  /** Persona config received from the hub */
@@ -593,7 +605,7 @@ declare class IntelliWeave extends EventTarget {
593
605
  setModel(id: string): void;
594
606
  private _lastSystemMsg;
595
607
  /** Get the system message prefix, before the KB entries are added */
596
- getContextPrefix(): Promise<any>;
608
+ getContextPrefix(): Promise<string>;
597
609
  /** Get system message to send to the AI */
598
610
  onBeforeMessageProcessing(): Promise<void>;
599
611
  private _lastOutput?;