@umituz/web-ai 1.2.0 → 1.4.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.
@@ -1497,6 +1497,10 @@ var RequestDeduplicator = class {
1497
1497
  var DEFAULT_API_KEY_RULE = {
1498
1498
  minLength: 10
1499
1499
  };
1500
+ function isValidApiKey(apiKey, rule = DEFAULT_API_KEY_RULE) {
1501
+ if (!apiKey) return false;
1502
+ return apiKey.trim().length >= rule.minLength;
1503
+ }
1500
1504
  function validateApiKey(apiKey, rule = DEFAULT_API_KEY_RULE) {
1501
1505
  if (!apiKey) {
1502
1506
  return { valid: false, reason: "API key is required" };
@@ -4619,6 +4623,14 @@ function resetProvider() {
4619
4623
  container?.groqHttpClient.reset();
4620
4624
  container = null;
4621
4625
  }
4626
+ function bootProvider(apiKey, options = {}) {
4627
+ if (!isValidApiKey(apiKey)) return null;
4628
+ return getProvider() ?? configureProvider({
4629
+ apiKey: apiKey.trim(),
4630
+ timeoutMs: options.timeoutMs ?? 3e4,
4631
+ textModel: options.textModel ?? GROQ_MODELS.GPT_OSS_120B
4632
+ });
4633
+ }
4622
4634
 
4623
4635
  // src/providers/workers-ai/workers-ai.speech.ts
4624
4636
  var WORKERS_AI_SPEECH_TIMEOUT_MS = 45e3;
@@ -5407,6 +5419,7 @@ exports.WorkersAIError = WorkersAIError;
5407
5419
  exports.WorkersAIProvider = WorkersAIProvider;
5408
5420
  exports.apiKeyAvailable = apiKeyAvailable;
5409
5421
  exports.audioTranscriptionAdapterFor = audioTranscriptionAdapterFor;
5422
+ exports.bootProvider = bootProvider;
5410
5423
  exports.buildFalAudioInput = buildFalAudioInput;
5411
5424
  exports.buildFalAudioLyrics = buildFalAudioLyrics;
5412
5425
  exports.buildFalImageInput = buildFalImageInput;