@browser-ai/core 2.0.3 → 2.1.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 CHANGED
@@ -2,6 +2,12 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
2
2
  import { TextEmbedder } from '@mediapipe/tasks-text';
3
3
  import { UIMessage } from 'ai';
4
4
 
5
+ /**
6
+ * Callback type for receiving model download/initialization progress updates.
7
+ * @param progress - A value between 0 and 1 indicating completion.
8
+ */
9
+ type DownloadProgressCallback = (progress: number) => void;
10
+
5
11
  type BrowserAIChatModelId = "text";
6
12
  interface BrowserAIChatSettings extends LanguageModelCreateOptions {
7
13
  /**
@@ -63,11 +69,11 @@ declare class BrowserAIChatLanguageModel implements LanguageModelV3 {
63
69
  * );
64
70
  * ```
65
71
  *
66
- * @param onDownloadProgress Optional callback receiving progress values 0-1 during model download
67
- * @returns Promise resolving to a configured LanguageModel session
72
+ * @param onDownloadProgress Optional callback receiving progress values from 0 to 1
73
+ * @returns Promise resolving to the model instance
68
74
  * @throws {LoadSettingError} When the Prompt API is not available or model is unavailable
69
75
  */
70
- createSessionWithProgress(onDownloadProgress?: (progress: number) => void): Promise<LanguageModel>;
76
+ createSessionWithProgress(onDownloadProgress?: DownloadProgressCallback): Promise<BrowserAIChatLanguageModel>;
71
77
  /**
72
78
  * Generates a streaming text response using the browser's built-in Prompt API
73
79
  * @param options
package/dist/index.d.ts CHANGED
@@ -2,6 +2,12 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
2
2
  import { TextEmbedder } from '@mediapipe/tasks-text';
3
3
  import { UIMessage } from 'ai';
4
4
 
5
+ /**
6
+ * Callback type for receiving model download/initialization progress updates.
7
+ * @param progress - A value between 0 and 1 indicating completion.
8
+ */
9
+ type DownloadProgressCallback = (progress: number) => void;
10
+
5
11
  type BrowserAIChatModelId = "text";
6
12
  interface BrowserAIChatSettings extends LanguageModelCreateOptions {
7
13
  /**
@@ -63,11 +69,11 @@ declare class BrowserAIChatLanguageModel implements LanguageModelV3 {
63
69
  * );
64
70
  * ```
65
71
  *
66
- * @param onDownloadProgress Optional callback receiving progress values 0-1 during model download
67
- * @returns Promise resolving to a configured LanguageModel session
72
+ * @param onDownloadProgress Optional callback receiving progress values from 0 to 1
73
+ * @returns Promise resolving to the model instance
68
74
  * @throws {LoadSettingError} When the Prompt API is not available or model is unavailable
69
75
  */
70
- createSessionWithProgress(onDownloadProgress?: (progress: number) => void): Promise<LanguageModel>;
76
+ createSessionWithProgress(onDownloadProgress?: DownloadProgressCallback): Promise<BrowserAIChatLanguageModel>;
71
77
  /**
72
78
  * Generates a streaming text response using the browser's built-in Prompt API
73
79
  * @param options