@browser-ai/core 2.1.8 → 2.1.9

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.mjs CHANGED
@@ -1048,7 +1048,9 @@ var SessionManager = class {
1048
1048
  if (this.session) {
1049
1049
  return this.session;
1050
1050
  }
1051
- const availability = await LanguageModel.availability();
1051
+ const availability = await LanguageModel.availability(
1052
+ this.prepareAvailabilityOptions(options)
1053
+ );
1052
1054
  if (availability === "unavailable") {
1053
1055
  throw new LoadSettingError({
1054
1056
  message: "Built-in model not available in this browser"
@@ -1108,11 +1110,11 @@ var SessionManager = class {
1108
1110
  * }
1109
1111
  * ```
1110
1112
  */
1111
- async checkAvailability() {
1113
+ async checkAvailability(options) {
1112
1114
  if (typeof LanguageModel === "undefined") {
1113
1115
  return "unavailable";
1114
1116
  }
1115
- return LanguageModel.availability();
1117
+ return LanguageModel.availability(this.prepareAvailabilityOptions(options));
1116
1118
  }
1117
1119
  /**
1118
1120
  * Gets the current session if it exists
@@ -1164,6 +1166,33 @@ var SessionManager = class {
1164
1166
  getInputUsage() {
1165
1167
  return this.getContextUsage();
1166
1168
  }
1169
+ /**
1170
+ * Prepares merged availability options from base config and request options
1171
+ *
1172
+ * @param options - Optional request-specific options
1173
+ * @returns Merged and sanitized core options ready for LanguageModel.availability()
1174
+ * @private
1175
+ */
1176
+ prepareAvailabilityOptions(options) {
1177
+ const mergedOptions = { ...this.baseOptions, ...options };
1178
+ const availabilityOptions = {};
1179
+ if (mergedOptions.topK !== void 0) {
1180
+ availabilityOptions.topK = mergedOptions.topK;
1181
+ }
1182
+ if (mergedOptions.temperature !== void 0) {
1183
+ availabilityOptions.temperature = mergedOptions.temperature;
1184
+ }
1185
+ if (mergedOptions.expectedInputs !== void 0) {
1186
+ availabilityOptions.expectedInputs = mergedOptions.expectedInputs;
1187
+ }
1188
+ if (mergedOptions.expectedOutputs !== void 0) {
1189
+ availabilityOptions.expectedOutputs = mergedOptions.expectedOutputs;
1190
+ }
1191
+ if (mergedOptions.tools !== void 0) {
1192
+ availabilityOptions.tools = mergedOptions.tools;
1193
+ }
1194
+ return availabilityOptions;
1195
+ }
1167
1196
  /**
1168
1197
  * Prepares merged session options from base config and request options
1169
1198
  *