@umituz/web-ai 1.0.0 → 1.0.2

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.
Files changed (55) hide show
  1. package/dist/{ABTesting-DDqNhHtP.d.ts → AIErrors-B2ogd1PB.d.ts} +14 -1
  2. package/dist/{ABTesting-DWBtKTMQ.d.cts → AIErrors-C5EasV_c.d.cts} +14 -1
  3. package/dist/{ProviderConfig-a55tLhWT.d.cts → ProviderConfig-DIFa9nmG.d.cts} +10 -1
  4. package/dist/{ProviderConfig-a55tLhWT.d.ts → ProviderConfig-DIFa9nmG.d.ts} +10 -1
  5. package/dist/chat/index.cjs +114 -23
  6. package/dist/chat/index.cjs.map +1 -1
  7. package/dist/chat/index.d.cts +4 -4
  8. package/dist/chat/index.d.ts +4 -4
  9. package/dist/chat/index.js +114 -23
  10. package/dist/chat/index.js.map +1 -1
  11. package/dist/{chat.service-DBKq9I2c.d.cts → chat.service-CL1qtYxe.d.cts} +7 -7
  12. package/dist/{chat.service-RQn8UTXD.d.ts → chat.service-q05GnhEm.d.ts} +7 -7
  13. package/dist/content/index.cjs +506 -193
  14. package/dist/content/index.cjs.map +1 -1
  15. package/dist/content/index.d.cts +7 -8
  16. package/dist/content/index.d.ts +7 -8
  17. package/dist/content/index.js +506 -193
  18. package/dist/content/index.js.map +1 -1
  19. package/dist/core/index.cjs +122 -15
  20. package/dist/core/index.cjs.map +1 -1
  21. package/dist/core/index.d.cts +13 -31
  22. package/dist/core/index.d.ts +13 -31
  23. package/dist/core/index.js +119 -16
  24. package/dist/core/index.js.map +1 -1
  25. package/dist/{create-ai-BhNaz86i.d.ts → create-ai-9PW752z8.d.ts} +14 -21
  26. package/dist/{create-ai-DGZFBOA1.d.cts → create-ai-CXYKPK6G.d.cts} +14 -21
  27. package/dist/hooks/index.cjs +631 -179
  28. package/dist/hooks/index.cjs.map +1 -1
  29. package/dist/hooks/index.d.cts +33 -7
  30. package/dist/hooks/index.d.ts +33 -7
  31. package/dist/hooks/index.js +631 -180
  32. package/dist/hooks/index.js.map +1 -1
  33. package/dist/index-DIHz8_OJ.d.ts +48 -0
  34. package/dist/index-DKHNcMbl.d.cts +48 -0
  35. package/dist/index.cjs +666 -104
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +8 -7
  38. package/dist/index.d.ts +8 -7
  39. package/dist/index.js +645 -105
  40. package/dist/index.js.map +1 -1
  41. package/dist/{provider.factory-COsnprLH.d.cts → provider.factory-BxsfK4WW.d.cts} +1 -1
  42. package/dist/{provider.factory-CpWFyjbw.d.ts → provider.factory-DfDfk0dK.d.ts} +1 -1
  43. package/dist/providers/index.cjs +973 -130
  44. package/dist/providers/index.cjs.map +1 -1
  45. package/dist/providers/index.d.cts +84 -18
  46. package/dist/providers/index.d.ts +84 -18
  47. package/dist/providers/index.js +956 -131
  48. package/dist/providers/index.js.map +1 -1
  49. package/dist/text-generation.service-BQO3Tvz2.d.cts +66 -0
  50. package/dist/text-generation.service-CcYQM6Ch.d.ts +66 -0
  51. package/dist/wizard/index.d.cts +1 -1
  52. package/dist/wizard/index.d.ts +1 -1
  53. package/package.json +9 -1
  54. package/dist/index-DjX9ZKuM.d.cts +0 -14
  55. package/dist/index-DxLvE588.d.ts +0 -14
@@ -1,12 +1,15 @@
1
- import { C as CostEstimateRequest, b as ITextProvider, I as IMediaProvider } from '../provider.factory-COsnprLH.cjs';
2
- export { A as AnyProvider, a as IProviderBase, P as ProviderCapability, c as ProviderFactory, d as ProviderFactoryConfig, i as isMediaProvider, e as isTextProvider } from '../provider.factory-COsnprLH.cjs';
1
+ import { C as CostEstimateRequest, b as ITextProvider, I as IMediaProvider } from '../provider.factory-BxsfK4WW.cjs';
2
+ export { A as AnyProvider, a as IProviderBase, P as ProviderCapability, c as ProviderFactory, d as ProviderFactoryConfig, i as isMediaProvider, e as isTextProvider } from '../provider.factory-BxsfK4WW.cjs';
3
3
  import { P as ProviderHealth, c as TextTier, T as TextRequest, G as GenerationResult, b as StructuredTextRequest, a as StructuredGeneration, S as StreamCallbacks, F as FinishReason, C as ChatMessage, d as TokenUsage } from '../index-fXjxTR5W.cjs';
4
- import { q as AIError, h as AnthropicProviderConfig, e as AnthropicEffort, s as AnthropicMessage, f as AnthropicMessagesRequest, i as AnthropicStopReason, g as AnthropicMessagesResponse, n as GroqProviderConfig, m as GroqMessage, t as GroqGenerationConfig, k as GroqChatRequest, l as GroqChatResponse, S as StreamRequestOptions$1 } from '../create-ai-DGZFBOA1.cjs';
5
- export { A as AIProviderConfig, a as ANTHROPIC_API_VERSION, b as ANTHROPIC_DEFAULT_MAX_TOKENS, c as ANTHROPIC_MODELS, d as ANTHROPIC_TIERS, j as AnthropicStreamEvent, G as GroqChatChunk, o as createAI } from '../create-ai-DGZFBOA1.cjs';
4
+ import { A as AIError, c as TierModelMap } from '../index-DKHNcMbl.cjs';
5
+ import { h as AnthropicProviderConfig, e as AnthropicEffort, x as AnthropicMessage, f as AnthropicMessagesRequest, i as AnthropicStopReason, g as AnthropicMessagesResponse, t as GroqProviderConfig, r as GroqMessage, q as GroqGenerationConfig, k as GroqChatRequest, l as GroqChatResponse, S as StreamRequestOptions$1, s as GroqMessageRole, u as GroqReasoningEffort } from '../create-ai-CXYKPK6G.cjs';
6
+ export { A as AIProviderConfig, a as ANTHROPIC_API_VERSION, b as ANTHROPIC_DEFAULT_MAX_TOKENS, c as ANTHROPIC_MODELS, d as ANTHROPIC_TIERS, j as AnthropicStreamEvent, G as GroqChatChunk, m as GroqChoice, n as GroqChunkChoice, o as GroqConfig, p as GroqErrorResponse, v as GroqUsage, w as createAI } from '../create-ai-CXYKPK6G.cjs';
6
7
  import { b as CacheStats } from '../cache-manager-Df9LLYGA.cjs';
7
- import { a as TierModelMap } from '../index-DjX9ZKuM.cjs';
8
8
  import { b as RetryManager, a as RequestQueue, R as RequestDeduplicator } from '../request-deduplicator.util-NDo0_n1y.cjs';
9
- import { c as GeminiConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest, F as FalConfig, P as PrunaConfig } from '../ProviderConfig-a55tLhWT.cjs';
9
+ import { a as IGroqHttpClient, c as TextGenerationService } from '../text-generation.service-BQO3Tvz2.cjs';
10
+ export { I as IGroqChatService, S as StreamingCallbacks, b as StructuredGenerationOptions, T as TextGenerationOptions } from '../text-generation.service-BQO3Tvz2.cjs';
11
+ import { d as ChatService } from '../chat.service-CL1qtYxe.cjs';
12
+ import { c as GeminiConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest, F as FalConfig, P as PrunaConfig } from '../ProviderConfig-DIFa9nmG.cjs';
10
13
 
11
14
  interface BaseProviderConfig {
12
15
  apiKey: string;
@@ -175,6 +178,24 @@ declare const GROQ_MODELS: {
175
178
  * the heavy lifting. Override per instance via `models` in provider config.
176
179
  */
177
180
  declare const GROQ_TIERS: TierModelMap;
181
+ declare const DEFAULT_GENERATION_CONFIG: {
182
+ readonly temperature: 0.7;
183
+ readonly maxTokens: 1024;
184
+ readonly topP: 1;
185
+ };
186
+ declare const DEFAULT_MODELS: {
187
+ readonly TEXT: "llama-3.1-8b-instant";
188
+ readonly FAST: "llama-3.1-8b-instant";
189
+ readonly EXPERIMENTAL: "openai/gpt-oss-20b";
190
+ };
191
+ declare const DEFAULT_BASE_URL: "https://api.groq.com/openai/v1";
192
+ declare const API_ENDPOINTS: {
193
+ readonly CHAT: "/chat/completions";
194
+ };
195
+ declare const TIMEOUTS: {
196
+ readonly DEFAULT: 30000;
197
+ readonly STREAMING: 60000;
198
+ };
178
199
 
179
200
  declare class GroqChatRequestBuilder {
180
201
  private readonly model;
@@ -191,15 +212,26 @@ declare class GroqChatRequestBuilder {
191
212
  build(): GroqChatRequest;
192
213
  }
193
214
 
215
+ declare class GroqConfigStore {
216
+ private config;
217
+ initialize(config: GroqProviderConfig): GroqProviderConfig;
218
+ get(): GroqProviderConfig;
219
+ getOrNull(): GroqProviderConfig | null;
220
+ isInitialized(): boolean;
221
+ setApiKey(apiKey: string): void;
222
+ reset(): void;
223
+ }
224
+
194
225
  /**
195
226
  * Raw HTTP transport for Groq's OpenAI-compatible chat/completions endpoint.
196
227
  * All failures leave here as core AIError with the right AIErrorType —
197
228
  * callers up the stack only ever see the neutral taxonomy.
198
229
  */
199
230
  declare class GroqHttpTransport {
200
- private readonly config;
231
+ private readonly configSource;
201
232
  private readonly pendingAbortControllers;
202
- constructor(config: GroqProviderConfig);
233
+ constructor(configSource: GroqProviderConfig | GroqConfigStore);
234
+ private getConfig;
203
235
  cancelPendingRequests(): void;
204
236
  postChatCompletion(request: GroqChatRequest): Promise<GroqChatResponse>;
205
237
  streamChatCompletion(request: GroqChatRequest, options?: StreamRequestOptions$1): Promise<ReadableStream<Uint8Array>>;
@@ -211,6 +243,7 @@ declare class GroqHttpTransport {
211
243
  }
212
244
 
213
245
  interface GroqHttpClientDeps {
246
+ readonly configStore?: GroqConfigStore;
214
247
  readonly transport?: GroqHttpTransport;
215
248
  readonly retryManager?: RetryManager;
216
249
  readonly queue?: RequestQueue;
@@ -219,16 +252,24 @@ interface GroqHttpClientDeps {
219
252
  /**
220
253
  * Groq HTTP client with the ported strategy stack: identical concurrent
221
254
  * requests are deduplicated, transient failures retried with backoff, and
222
- * everything is funneled through a priority queue. Composition root for
223
- * GroqProvider — no global state.
255
+ * everything is funneled through a priority queue.
256
+ *
257
+ * Supports both standalone initialization `new GroqHttpClient(config)`
258
+ * and deferred initialization `const c = new GroqHttpClient(); c.initialize(config)`.
224
259
  */
225
260
  declare class GroqHttpClient {
261
+ private readonly configStore;
226
262
  private readonly transport;
227
263
  private readonly executor;
228
- constructor(config: GroqProviderConfig, deps?: GroqHttpClientDeps);
264
+ constructor(configOrDeps?: GroqProviderConfig | GroqHttpClientDeps, maybeDeps?: GroqHttpClientDeps);
265
+ initialize(config: GroqProviderConfig): void;
266
+ isInitialized(): boolean;
267
+ getApiKey(): string;
268
+ setApiKey(apiKey: string): void;
229
269
  cancelPendingRequests(): void;
230
270
  postChatCompletion(request: GroqChatRequest): Promise<GroqChatResponse>;
231
271
  streamChatCompletion(request: GroqChatRequest, options?: StreamRequestOptions$1): Promise<ReadableStream<Uint8Array>>;
272
+ reset(): void;
232
273
  }
233
274
 
234
275
  /**
@@ -250,6 +291,32 @@ interface GroqStreamOutcome {
250
291
  */
251
292
  declare function consumeGroqStream(stream: ReadableStream<Uint8Array>, callbacks: Pick<StreamCallbacks, "onChunk">): Promise<GroqStreamOutcome>;
252
293
 
294
+ declare const createUserMessage: (content: string) => GroqMessage;
295
+ declare const createAssistantMessage: (content: string) => GroqMessage;
296
+ declare const createSystemMessage: (content: string) => GroqMessage;
297
+ declare const createMessage: (role: GroqMessageRole, content: string) => GroqMessage;
298
+ declare const promptToMessages: (prompt: string) => GroqMessage[];
299
+ declare const extractTextFromMessages: (messages: ReadonlyArray<GroqMessage>) => string;
300
+ declare const formatMessagesForDisplay: (messages: ReadonlyArray<GroqMessage>) => string;
301
+
302
+ interface StructuredJsonRequest {
303
+ readonly model: string;
304
+ readonly instructions: string;
305
+ readonly maxTokens: number;
306
+ readonly temperature: number;
307
+ readonly reasoningEffort?: GroqReasoningEffort;
308
+ }
309
+ declare function requestStructuredJson(client: Pick<IGroqHttpClient, "postChatCompletion">, request: StructuredJsonRequest): Promise<unknown>;
310
+
311
+ interface AppContainer {
312
+ readonly groqHttpClient: GroqHttpClient;
313
+ readonly textGeneration: TextGenerationService;
314
+ readonly chat: ChatService;
315
+ }
316
+ declare function configureProvider(config: GroqProviderConfig): AppContainer;
317
+ declare function getProvider(): AppContainer | null;
318
+ declare function resetProvider(): void;
319
+
253
320
  declare const GEMINI_TIERS: TierModelMap;
254
321
  /**
255
322
  * Gemini provider — text via generateContent (multi-turn aware, system
@@ -311,9 +378,8 @@ interface PrunaProgressStage {
311
378
  declare function generateWithPruna(request: PrunaRequest, apiKey: string, signal?: AbortSignal, onProgress?: (stage: PrunaProgressStage['stage'], attempt?: number) => void): AsyncGenerator<PrunaProgressStage>;
312
379
 
313
380
  /**
314
- * Placeholder seat for the Pruna fleet: registering it makes the provider
315
- * visible to health/fallback machinery, while actual generation goes through
316
- * the lazy-loaded `generateWithPruna` helper (peer optional dependency).
381
+ * Pruna media provider: supports text-to-image, text-to-video, and
382
+ * image-to-video generation through the @umituz/pruna-provider client.
317
383
  */
318
384
  declare class PrunaProvider implements IMediaProvider {
319
385
  readonly config: PrunaConfig;
@@ -323,11 +389,11 @@ declare class PrunaProvider implements IMediaProvider {
323
389
  constructor(config: PrunaConfig);
324
390
  healthCheck(): Promise<ProviderHealth>;
325
391
  estimateCost(_request: CostEstimateRequest): Promise<number>;
326
- generateImage(_request: ImageGenerationRequest): Promise<GeneratedContent>;
327
- generateVideo(_request: VideoGenerationRequest): Promise<GeneratedContent>;
328
- imageToVideo(_request: ImageToVideoRequest): Promise<GeneratedContent>;
392
+ generateImage(request: ImageGenerationRequest): Promise<GeneratedContent>;
393
+ generateVideo(request: VideoGenerationRequest): Promise<GeneratedContent>;
394
+ imageToVideo(request: ImageToVideoRequest): Promise<GeneratedContent>;
329
395
  videoToVideo(_request: VideoToVideoRequest): Promise<GeneratedContent>;
330
396
  }
331
397
  declare function createPrunaProvider(config: PrunaConfig): PrunaProvider;
332
398
 
333
- export { AnthropicEffort, AnthropicHttpTransport, AnthropicMessagesRequest, AnthropicMessagesResponse, AnthropicProvider, AnthropicProviderConfig, AnthropicRequestBuilder, AnthropicStopReason, BaseProvider, type BaseProviderConfig, CostEstimateRequest, FalProvider, GEMINI_TIERS, GROQ_MODELS, GROQ_TIERS, GeminiProvider, GroqChatRequest, GroqChatRequestBuilder, GroqChatResponse, GroqHttpClient, GroqHttpTransport, GroqMessage, GroqProvider, GroqProviderConfig, IMediaProvider, ITextProvider, ProviderError, type PrunaProgressStage, PrunaProvider, type PrunaRequest, consumeAnthropicStream, consumeGroqStream, createFalProvider, createGeminiProvider, createPrunaProvider, defaultEffortForModel, extractContentFromSsePayload, generateWithPruna, mapAnthropicStopReason, toGroqMessages };
399
+ export { API_ENDPOINTS, AnthropicEffort, AnthropicHttpTransport, AnthropicMessagesRequest, AnthropicMessagesResponse, AnthropicProvider, AnthropicProviderConfig, AnthropicRequestBuilder, AnthropicStopReason, type AppContainer, BaseProvider, type BaseProviderConfig, CostEstimateRequest, DEFAULT_BASE_URL, DEFAULT_GENERATION_CONFIG, DEFAULT_MODELS, FalProvider, GEMINI_TIERS, GROQ_MODELS, GROQ_TIERS, GeminiProvider, GroqChatRequest, GroqChatRequestBuilder, GroqChatResponse, GroqConfigStore, GroqGenerationConfig, GroqHttpClient, type GroqHttpClientDeps, GroqHttpTransport, GroqMessage, GroqMessageRole, GroqProvider, GroqProviderConfig, GroqReasoningEffort, IGroqHttpClient, IMediaProvider, ITextProvider, ProviderError, type PrunaProgressStage, PrunaProvider, type PrunaRequest, StreamRequestOptions$1 as StreamRequestOptions, type StructuredJsonRequest, TIMEOUTS, TextGenerationService, configureProvider, consumeAnthropicStream, consumeGroqStream, createAssistantMessage, createFalProvider, createGeminiProvider, createMessage, createPrunaProvider, createSystemMessage, createUserMessage, defaultEffortForModel, extractContentFromSsePayload, extractTextFromMessages, formatMessagesForDisplay, generateWithPruna, getProvider, mapAnthropicStopReason, promptToMessages, requestStructuredJson, resetProvider, toGroqMessages };
@@ -1,12 +1,15 @@
1
- import { C as CostEstimateRequest, b as ITextProvider, I as IMediaProvider } from '../provider.factory-CpWFyjbw.js';
2
- export { A as AnyProvider, a as IProviderBase, P as ProviderCapability, c as ProviderFactory, d as ProviderFactoryConfig, i as isMediaProvider, e as isTextProvider } from '../provider.factory-CpWFyjbw.js';
1
+ import { C as CostEstimateRequest, b as ITextProvider, I as IMediaProvider } from '../provider.factory-DfDfk0dK.js';
2
+ export { A as AnyProvider, a as IProviderBase, P as ProviderCapability, c as ProviderFactory, d as ProviderFactoryConfig, i as isMediaProvider, e as isTextProvider } from '../provider.factory-DfDfk0dK.js';
3
3
  import { P as ProviderHealth, c as TextTier, T as TextRequest, G as GenerationResult, b as StructuredTextRequest, a as StructuredGeneration, S as StreamCallbacks, F as FinishReason, C as ChatMessage, d as TokenUsage } from '../index-fXjxTR5W.js';
4
- import { q as AIError, h as AnthropicProviderConfig, e as AnthropicEffort, s as AnthropicMessage, f as AnthropicMessagesRequest, i as AnthropicStopReason, g as AnthropicMessagesResponse, n as GroqProviderConfig, m as GroqMessage, t as GroqGenerationConfig, k as GroqChatRequest, l as GroqChatResponse, S as StreamRequestOptions$1 } from '../create-ai-BhNaz86i.js';
5
- export { A as AIProviderConfig, a as ANTHROPIC_API_VERSION, b as ANTHROPIC_DEFAULT_MAX_TOKENS, c as ANTHROPIC_MODELS, d as ANTHROPIC_TIERS, j as AnthropicStreamEvent, G as GroqChatChunk, o as createAI } from '../create-ai-BhNaz86i.js';
4
+ import { A as AIError, c as TierModelMap } from '../index-DIHz8_OJ.js';
5
+ import { h as AnthropicProviderConfig, e as AnthropicEffort, x as AnthropicMessage, f as AnthropicMessagesRequest, i as AnthropicStopReason, g as AnthropicMessagesResponse, t as GroqProviderConfig, r as GroqMessage, q as GroqGenerationConfig, k as GroqChatRequest, l as GroqChatResponse, S as StreamRequestOptions$1, s as GroqMessageRole, u as GroqReasoningEffort } from '../create-ai-9PW752z8.js';
6
+ export { A as AIProviderConfig, a as ANTHROPIC_API_VERSION, b as ANTHROPIC_DEFAULT_MAX_TOKENS, c as ANTHROPIC_MODELS, d as ANTHROPIC_TIERS, j as AnthropicStreamEvent, G as GroqChatChunk, m as GroqChoice, n as GroqChunkChoice, o as GroqConfig, p as GroqErrorResponse, v as GroqUsage, w as createAI } from '../create-ai-9PW752z8.js';
6
7
  import { b as CacheStats } from '../cache-manager-Df9LLYGA.js';
7
- import { a as TierModelMap } from '../index-DxLvE588.js';
8
8
  import { b as RetryManager, a as RequestQueue, R as RequestDeduplicator } from '../request-deduplicator.util-NDo0_n1y.js';
9
- import { c as GeminiConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest, F as FalConfig, P as PrunaConfig } from '../ProviderConfig-a55tLhWT.js';
9
+ import { a as IGroqHttpClient, c as TextGenerationService } from '../text-generation.service-CcYQM6Ch.js';
10
+ export { I as IGroqChatService, S as StreamingCallbacks, b as StructuredGenerationOptions, T as TextGenerationOptions } from '../text-generation.service-CcYQM6Ch.js';
11
+ import { d as ChatService } from '../chat.service-q05GnhEm.js';
12
+ import { c as GeminiConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest, F as FalConfig, P as PrunaConfig } from '../ProviderConfig-DIFa9nmG.js';
10
13
 
11
14
  interface BaseProviderConfig {
12
15
  apiKey: string;
@@ -175,6 +178,24 @@ declare const GROQ_MODELS: {
175
178
  * the heavy lifting. Override per instance via `models` in provider config.
176
179
  */
177
180
  declare const GROQ_TIERS: TierModelMap;
181
+ declare const DEFAULT_GENERATION_CONFIG: {
182
+ readonly temperature: 0.7;
183
+ readonly maxTokens: 1024;
184
+ readonly topP: 1;
185
+ };
186
+ declare const DEFAULT_MODELS: {
187
+ readonly TEXT: "llama-3.1-8b-instant";
188
+ readonly FAST: "llama-3.1-8b-instant";
189
+ readonly EXPERIMENTAL: "openai/gpt-oss-20b";
190
+ };
191
+ declare const DEFAULT_BASE_URL: "https://api.groq.com/openai/v1";
192
+ declare const API_ENDPOINTS: {
193
+ readonly CHAT: "/chat/completions";
194
+ };
195
+ declare const TIMEOUTS: {
196
+ readonly DEFAULT: 30000;
197
+ readonly STREAMING: 60000;
198
+ };
178
199
 
179
200
  declare class GroqChatRequestBuilder {
180
201
  private readonly model;
@@ -191,15 +212,26 @@ declare class GroqChatRequestBuilder {
191
212
  build(): GroqChatRequest;
192
213
  }
193
214
 
215
+ declare class GroqConfigStore {
216
+ private config;
217
+ initialize(config: GroqProviderConfig): GroqProviderConfig;
218
+ get(): GroqProviderConfig;
219
+ getOrNull(): GroqProviderConfig | null;
220
+ isInitialized(): boolean;
221
+ setApiKey(apiKey: string): void;
222
+ reset(): void;
223
+ }
224
+
194
225
  /**
195
226
  * Raw HTTP transport for Groq's OpenAI-compatible chat/completions endpoint.
196
227
  * All failures leave here as core AIError with the right AIErrorType —
197
228
  * callers up the stack only ever see the neutral taxonomy.
198
229
  */
199
230
  declare class GroqHttpTransport {
200
- private readonly config;
231
+ private readonly configSource;
201
232
  private readonly pendingAbortControllers;
202
- constructor(config: GroqProviderConfig);
233
+ constructor(configSource: GroqProviderConfig | GroqConfigStore);
234
+ private getConfig;
203
235
  cancelPendingRequests(): void;
204
236
  postChatCompletion(request: GroqChatRequest): Promise<GroqChatResponse>;
205
237
  streamChatCompletion(request: GroqChatRequest, options?: StreamRequestOptions$1): Promise<ReadableStream<Uint8Array>>;
@@ -211,6 +243,7 @@ declare class GroqHttpTransport {
211
243
  }
212
244
 
213
245
  interface GroqHttpClientDeps {
246
+ readonly configStore?: GroqConfigStore;
214
247
  readonly transport?: GroqHttpTransport;
215
248
  readonly retryManager?: RetryManager;
216
249
  readonly queue?: RequestQueue;
@@ -219,16 +252,24 @@ interface GroqHttpClientDeps {
219
252
  /**
220
253
  * Groq HTTP client with the ported strategy stack: identical concurrent
221
254
  * requests are deduplicated, transient failures retried with backoff, and
222
- * everything is funneled through a priority queue. Composition root for
223
- * GroqProvider — no global state.
255
+ * everything is funneled through a priority queue.
256
+ *
257
+ * Supports both standalone initialization `new GroqHttpClient(config)`
258
+ * and deferred initialization `const c = new GroqHttpClient(); c.initialize(config)`.
224
259
  */
225
260
  declare class GroqHttpClient {
261
+ private readonly configStore;
226
262
  private readonly transport;
227
263
  private readonly executor;
228
- constructor(config: GroqProviderConfig, deps?: GroqHttpClientDeps);
264
+ constructor(configOrDeps?: GroqProviderConfig | GroqHttpClientDeps, maybeDeps?: GroqHttpClientDeps);
265
+ initialize(config: GroqProviderConfig): void;
266
+ isInitialized(): boolean;
267
+ getApiKey(): string;
268
+ setApiKey(apiKey: string): void;
229
269
  cancelPendingRequests(): void;
230
270
  postChatCompletion(request: GroqChatRequest): Promise<GroqChatResponse>;
231
271
  streamChatCompletion(request: GroqChatRequest, options?: StreamRequestOptions$1): Promise<ReadableStream<Uint8Array>>;
272
+ reset(): void;
232
273
  }
233
274
 
234
275
  /**
@@ -250,6 +291,32 @@ interface GroqStreamOutcome {
250
291
  */
251
292
  declare function consumeGroqStream(stream: ReadableStream<Uint8Array>, callbacks: Pick<StreamCallbacks, "onChunk">): Promise<GroqStreamOutcome>;
252
293
 
294
+ declare const createUserMessage: (content: string) => GroqMessage;
295
+ declare const createAssistantMessage: (content: string) => GroqMessage;
296
+ declare const createSystemMessage: (content: string) => GroqMessage;
297
+ declare const createMessage: (role: GroqMessageRole, content: string) => GroqMessage;
298
+ declare const promptToMessages: (prompt: string) => GroqMessage[];
299
+ declare const extractTextFromMessages: (messages: ReadonlyArray<GroqMessage>) => string;
300
+ declare const formatMessagesForDisplay: (messages: ReadonlyArray<GroqMessage>) => string;
301
+
302
+ interface StructuredJsonRequest {
303
+ readonly model: string;
304
+ readonly instructions: string;
305
+ readonly maxTokens: number;
306
+ readonly temperature: number;
307
+ readonly reasoningEffort?: GroqReasoningEffort;
308
+ }
309
+ declare function requestStructuredJson(client: Pick<IGroqHttpClient, "postChatCompletion">, request: StructuredJsonRequest): Promise<unknown>;
310
+
311
+ interface AppContainer {
312
+ readonly groqHttpClient: GroqHttpClient;
313
+ readonly textGeneration: TextGenerationService;
314
+ readonly chat: ChatService;
315
+ }
316
+ declare function configureProvider(config: GroqProviderConfig): AppContainer;
317
+ declare function getProvider(): AppContainer | null;
318
+ declare function resetProvider(): void;
319
+
253
320
  declare const GEMINI_TIERS: TierModelMap;
254
321
  /**
255
322
  * Gemini provider — text via generateContent (multi-turn aware, system
@@ -311,9 +378,8 @@ interface PrunaProgressStage {
311
378
  declare function generateWithPruna(request: PrunaRequest, apiKey: string, signal?: AbortSignal, onProgress?: (stage: PrunaProgressStage['stage'], attempt?: number) => void): AsyncGenerator<PrunaProgressStage>;
312
379
 
313
380
  /**
314
- * Placeholder seat for the Pruna fleet: registering it makes the provider
315
- * visible to health/fallback machinery, while actual generation goes through
316
- * the lazy-loaded `generateWithPruna` helper (peer optional dependency).
381
+ * Pruna media provider: supports text-to-image, text-to-video, and
382
+ * image-to-video generation through the @umituz/pruna-provider client.
317
383
  */
318
384
  declare class PrunaProvider implements IMediaProvider {
319
385
  readonly config: PrunaConfig;
@@ -323,11 +389,11 @@ declare class PrunaProvider implements IMediaProvider {
323
389
  constructor(config: PrunaConfig);
324
390
  healthCheck(): Promise<ProviderHealth>;
325
391
  estimateCost(_request: CostEstimateRequest): Promise<number>;
326
- generateImage(_request: ImageGenerationRequest): Promise<GeneratedContent>;
327
- generateVideo(_request: VideoGenerationRequest): Promise<GeneratedContent>;
328
- imageToVideo(_request: ImageToVideoRequest): Promise<GeneratedContent>;
392
+ generateImage(request: ImageGenerationRequest): Promise<GeneratedContent>;
393
+ generateVideo(request: VideoGenerationRequest): Promise<GeneratedContent>;
394
+ imageToVideo(request: ImageToVideoRequest): Promise<GeneratedContent>;
329
395
  videoToVideo(_request: VideoToVideoRequest): Promise<GeneratedContent>;
330
396
  }
331
397
  declare function createPrunaProvider(config: PrunaConfig): PrunaProvider;
332
398
 
333
- export { AnthropicEffort, AnthropicHttpTransport, AnthropicMessagesRequest, AnthropicMessagesResponse, AnthropicProvider, AnthropicProviderConfig, AnthropicRequestBuilder, AnthropicStopReason, BaseProvider, type BaseProviderConfig, CostEstimateRequest, FalProvider, GEMINI_TIERS, GROQ_MODELS, GROQ_TIERS, GeminiProvider, GroqChatRequest, GroqChatRequestBuilder, GroqChatResponse, GroqHttpClient, GroqHttpTransport, GroqMessage, GroqProvider, GroqProviderConfig, IMediaProvider, ITextProvider, ProviderError, type PrunaProgressStage, PrunaProvider, type PrunaRequest, consumeAnthropicStream, consumeGroqStream, createFalProvider, createGeminiProvider, createPrunaProvider, defaultEffortForModel, extractContentFromSsePayload, generateWithPruna, mapAnthropicStopReason, toGroqMessages };
399
+ export { API_ENDPOINTS, AnthropicEffort, AnthropicHttpTransport, AnthropicMessagesRequest, AnthropicMessagesResponse, AnthropicProvider, AnthropicProviderConfig, AnthropicRequestBuilder, AnthropicStopReason, type AppContainer, BaseProvider, type BaseProviderConfig, CostEstimateRequest, DEFAULT_BASE_URL, DEFAULT_GENERATION_CONFIG, DEFAULT_MODELS, FalProvider, GEMINI_TIERS, GROQ_MODELS, GROQ_TIERS, GeminiProvider, GroqChatRequest, GroqChatRequestBuilder, GroqChatResponse, GroqConfigStore, GroqGenerationConfig, GroqHttpClient, type GroqHttpClientDeps, GroqHttpTransport, GroqMessage, GroqMessageRole, GroqProvider, GroqProviderConfig, GroqReasoningEffort, IGroqHttpClient, IMediaProvider, ITextProvider, ProviderError, type PrunaProgressStage, PrunaProvider, type PrunaRequest, StreamRequestOptions$1 as StreamRequestOptions, type StructuredJsonRequest, TIMEOUTS, TextGenerationService, configureProvider, consumeAnthropicStream, consumeGroqStream, createAssistantMessage, createFalProvider, createGeminiProvider, createMessage, createPrunaProvider, createSystemMessage, createUserMessage, defaultEffortForModel, extractContentFromSsePayload, extractTextFromMessages, formatMessagesForDisplay, generateWithPruna, getProvider, mapAnthropicStopReason, promptToMessages, requestStructuredJson, resetProvider, toGroqMessages };