tekimax-ts 0.2.0 → 0.2.3

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.
@@ -27,11 +27,13 @@ module.exports = __toCommonJS(react_exports);
27
27
  // src/react/useChat.ts
28
28
  var import_react = require("react");
29
29
  function useChat({
30
+ api,
30
31
  adapter,
31
32
  client,
32
33
  model,
33
34
  initialMessages = [],
34
35
  tools,
36
+ body,
35
37
  onFinish,
36
38
  onError,
37
39
  think
@@ -72,12 +74,45 @@ function useChat({
72
74
  signal: abortController.signal,
73
75
  think
74
76
  };
75
- if (client) {
77
+ if (api) {
78
+ stream = (async function* () {
79
+ const res = await fetch(api, {
80
+ method: "POST",
81
+ headers: { "Content-Type": "application/json" },
82
+ body: JSON.stringify({ messages: currentMessages, model, ...body }),
83
+ signal: abortController.signal
84
+ });
85
+ if (!res.ok) throw new Error(await res.text());
86
+ const reader = res.body?.getReader();
87
+ if (!reader) throw new Error("No readable stream");
88
+ const decoder = new TextDecoder();
89
+ let buffer = "";
90
+ while (true) {
91
+ const { done, value } = await reader.read();
92
+ if (done) break;
93
+ buffer += decoder.decode(value, { stream: true });
94
+ const lines = buffer.split("\n");
95
+ buffer = lines.pop() || "";
96
+ for (const line of lines) {
97
+ const trimmed = line.trim();
98
+ if (!trimmed || !trimmed.startsWith("data: ")) continue;
99
+ const payload = trimmed.slice(6);
100
+ if (payload === "[DONE]") return;
101
+ try {
102
+ const parsed = JSON.parse(payload);
103
+ if (parsed.error) throw new Error(parsed.error);
104
+ yield { delta: parsed.delta || "", thinking: parsed.thinking || "" };
105
+ } catch (e) {
106
+ }
107
+ }
108
+ }
109
+ })();
110
+ } else if (client) {
76
111
  stream = client.text.generateStream(options);
77
112
  } else if (adapter) {
78
113
  stream = adapter.chatStream(options);
79
114
  } else {
80
- throw new Error("useChat: No client or adapter provided");
115
+ throw new Error("useChat: No api router, client, or adapter provided");
81
116
  }
82
117
  let fullContent = "";
83
118
  let toolCallAccumulator = {};
@@ -1,14 +1,16 @@
1
- import { M as Message, A as AIProvider, r as Tekimax, T as Tool } from '../tekimax-Dav_a903.cjs';
1
+ import { M as Message, A as AIProvider, D as Tekimax, T as Tool } from '../tekimax-DIIjg64-.cjs';
2
2
 
3
- interface UseChatOptions {
4
- adapter?: AIProvider;
5
- client?: Tekimax;
3
+ interface UseChatOptions<TProvider extends AIProvider = AIProvider> {
4
+ api?: string;
5
+ adapter?: TProvider;
6
+ client?: Tekimax<TProvider>;
6
7
  model: string;
7
8
  initialMessages?: Array<Message>;
8
9
  tools?: Record<string, Tool>;
9
10
  onFinish?: (message: Message) => void;
10
11
  onError?: (error: Error) => void;
11
12
  think?: boolean;
13
+ body?: any;
12
14
  }
13
15
  interface UseChatHelpers {
14
16
  messages: Array<Message>;
@@ -20,6 +22,6 @@ interface UseChatHelpers {
20
22
  stop: () => void;
21
23
  isLoading: boolean;
22
24
  }
23
- declare function useChat({ adapter, client, model, initialMessages, tools, onFinish, onError, think, }: UseChatOptions): UseChatHelpers;
25
+ declare function useChat<TProvider extends AIProvider = AIProvider>({ api, adapter, client, model, initialMessages, tools, body, onFinish, onError, think, }: UseChatOptions<TProvider>): UseChatHelpers;
24
26
 
25
27
  export { type UseChatHelpers, type UseChatOptions, useChat };
@@ -1,14 +1,16 @@
1
- import { M as Message, A as AIProvider, r as Tekimax, T as Tool } from '../tekimax-Dav_a903.js';
1
+ import { M as Message, A as AIProvider, D as Tekimax, T as Tool } from '../tekimax-DIIjg64-.js';
2
2
 
3
- interface UseChatOptions {
4
- adapter?: AIProvider;
5
- client?: Tekimax;
3
+ interface UseChatOptions<TProvider extends AIProvider = AIProvider> {
4
+ api?: string;
5
+ adapter?: TProvider;
6
+ client?: Tekimax<TProvider>;
6
7
  model: string;
7
8
  initialMessages?: Array<Message>;
8
9
  tools?: Record<string, Tool>;
9
10
  onFinish?: (message: Message) => void;
10
11
  onError?: (error: Error) => void;
11
12
  think?: boolean;
13
+ body?: any;
12
14
  }
13
15
  interface UseChatHelpers {
14
16
  messages: Array<Message>;
@@ -20,6 +22,6 @@ interface UseChatHelpers {
20
22
  stop: () => void;
21
23
  isLoading: boolean;
22
24
  }
23
- declare function useChat({ adapter, client, model, initialMessages, tools, onFinish, onError, think, }: UseChatOptions): UseChatHelpers;
25
+ declare function useChat<TProvider extends AIProvider = AIProvider>({ api, adapter, client, model, initialMessages, tools, body, onFinish, onError, think, }: UseChatOptions<TProvider>): UseChatHelpers;
24
26
 
25
27
  export { type UseChatHelpers, type UseChatOptions, useChat };
@@ -3,11 +3,13 @@ import "../chunk-MLKGABMK.js";
3
3
  // src/react/useChat.ts
4
4
  import { useCallback, useRef, useState } from "react";
5
5
  function useChat({
6
+ api,
6
7
  adapter,
7
8
  client,
8
9
  model,
9
10
  initialMessages = [],
10
11
  tools,
12
+ body,
11
13
  onFinish,
12
14
  onError,
13
15
  think
@@ -48,12 +50,45 @@ function useChat({
48
50
  signal: abortController.signal,
49
51
  think
50
52
  };
51
- if (client) {
53
+ if (api) {
54
+ stream = (async function* () {
55
+ const res = await fetch(api, {
56
+ method: "POST",
57
+ headers: { "Content-Type": "application/json" },
58
+ body: JSON.stringify({ messages: currentMessages, model, ...body }),
59
+ signal: abortController.signal
60
+ });
61
+ if (!res.ok) throw new Error(await res.text());
62
+ const reader = res.body?.getReader();
63
+ if (!reader) throw new Error("No readable stream");
64
+ const decoder = new TextDecoder();
65
+ let buffer = "";
66
+ while (true) {
67
+ const { done, value } = await reader.read();
68
+ if (done) break;
69
+ buffer += decoder.decode(value, { stream: true });
70
+ const lines = buffer.split("\n");
71
+ buffer = lines.pop() || "";
72
+ for (const line of lines) {
73
+ const trimmed = line.trim();
74
+ if (!trimmed || !trimmed.startsWith("data: ")) continue;
75
+ const payload = trimmed.slice(6);
76
+ if (payload === "[DONE]") return;
77
+ try {
78
+ const parsed = JSON.parse(payload);
79
+ if (parsed.error) throw new Error(parsed.error);
80
+ yield { delta: parsed.delta || "", thinking: parsed.thinking || "" };
81
+ } catch (e) {
82
+ }
83
+ }
84
+ }
85
+ })();
86
+ } else if (client) {
52
87
  stream = client.text.generateStream(options);
53
88
  } else if (adapter) {
54
89
  stream = adapter.chatStream(options);
55
90
  } else {
56
- throw new Error("useChat: No client or adapter provided");
91
+ throw new Error("useChat: No api router, client, or adapter provided");
57
92
  }
58
93
  let fullContent = "";
59
94
  let toolCallAccumulator = {};
@@ -215,43 +215,59 @@ interface AIProvider {
215
215
  * Stream a chat completion.
216
216
  */
217
217
  chatStream: (options: ChatOptions) => AsyncIterable<StreamChunk>;
218
+ }
219
+ interface ImageGenerationCapability {
218
220
  /**
219
221
  * Generate an image.
220
222
  */
221
- generateImage?: (options: ImageGenerationOptions) => Promise<ImageResult>;
223
+ generateImage: (options: ImageGenerationOptions) => Promise<ImageResult>;
224
+ }
225
+ interface ImageEditCapability {
222
226
  /**
223
227
  * Edit an image.
224
228
  */
225
- editImage?: (options: ImageEditOptions) => Promise<ImageResult>;
229
+ editImage: (options: ImageEditOptions) => Promise<ImageResult>;
230
+ }
231
+ interface VisionCapability {
226
232
  /**
227
233
  * Analyze an image (Vision).
228
234
  */
229
- analyzeImage?: (options: ImageAnalysisOptions) => Promise<ImageAnalysisResult>;
235
+ analyzeImage: (options: ImageAnalysisOptions) => Promise<ImageAnalysisResult>;
236
+ }
237
+ interface SpeechGenerationCapability {
230
238
  /**
231
239
  * Generate speech from text (TTS).
232
240
  */
233
- generateSpeech?: (options: SpeechGenerationOptions) => Promise<SpeechResult>;
241
+ generateSpeech: (options: SpeechGenerationOptions) => Promise<SpeechResult>;
242
+ }
243
+ interface TranscriptionCapability {
234
244
  /**
235
245
  * Transcribe audio to text (STT).
236
246
  */
237
- transcribeAudio?: (options: TranscriptionOptions) => Promise<TranscriptionResult>;
247
+ transcribeAudio: (options: TranscriptionOptions) => Promise<TranscriptionResult>;
248
+ }
249
+ interface VideoGenerationCapability {
238
250
  /**
239
251
  * Generate a video.
240
252
  */
241
- generateVideo?: (options: VideoGenerationOptions) => Promise<VideoResult>;
253
+ generateVideo: (options: VideoGenerationOptions) => Promise<VideoResult>;
254
+ }
255
+ interface VideoAnalysisCapability {
242
256
  /**
243
257
  * Analyze a video (Video-to-Text).
244
258
  */
245
- analyzeVideo?: (options: VideoAnalysisOptions) => Promise<VideoAnalysisResult>;
259
+ analyzeVideo: (options: VideoAnalysisOptions) => Promise<VideoAnalysisResult>;
260
+ }
261
+ interface EmbeddingCapability {
246
262
  /**
247
263
  * Generate embeddings for text input(s).
248
264
  */
249
- embed?: (options: EmbeddingOptions) => Promise<EmbeddingResult>;
265
+ embed: (options: EmbeddingOptions) => Promise<EmbeddingResult>;
250
266
  }
251
267
 
252
- declare class TextNamespace {
268
+ declare class TextNamespace<TProvider extends AIProvider> {
253
269
  private provider;
254
- constructor(provider: AIProvider);
270
+ constructor(provider: TProvider);
255
271
  /**
256
272
  * Generate text from a prompt (Chat Completion).
257
273
  */
@@ -261,9 +277,9 @@ declare class TextNamespace {
261
277
  */
262
278
  generateStream(options: ChatOptions): AsyncGenerator<StreamChunk>;
263
279
  /**
264
- * Generate embeddings for text input(s).
280
+ * Generate embeddings for text input(s). Only available if the provider supports embeddings.
265
281
  */
266
- embed(options: EmbeddingOptions): Promise<EmbeddingResult>;
282
+ embed(options: TProvider extends EmbeddingCapability ? EmbeddingOptions : never): Promise<TProvider extends EmbeddingCapability ? EmbeddingResult : never>;
267
283
  get chat(): {
268
284
  completions: {
269
285
  create: (options: ChatOptions) => Promise<ChatResult>;
@@ -272,59 +288,59 @@ declare class TextNamespace {
272
288
  };
273
289
  }
274
290
 
275
- declare class ImagesNamespace {
291
+ declare class ImagesNamespace<TProvider extends AIProvider> {
276
292
  private provider;
277
- constructor(provider: AIProvider);
293
+ constructor(provider: TProvider);
278
294
  /**
279
- * Generate images from a prompt.
295
+ * Generate images from a prompt. Only available if the provider supports image generation.
280
296
  */
281
- generate(options: ImageGenerationOptions): Promise<ImageResult>;
297
+ generate(options: TProvider extends ImageGenerationCapability ? ImageGenerationOptions : never): Promise<TProvider extends ImageGenerationCapability ? ImageResult : never>;
282
298
  /**
283
- * Edit an image with a prompt.
299
+ * Edit an image with a prompt. Only available if the provider supports image editing.
284
300
  */
285
- edit(options: ImageEditOptions): Promise<ImageResult>;
301
+ edit(options: TProvider extends ImageEditCapability ? ImageEditOptions : never): Promise<TProvider extends ImageEditCapability ? ImageResult : never>;
286
302
  /**
287
- * Analyze an image (Vision).
303
+ * Analyze an image (Vision). Only available if the provider supports vision analytics.
288
304
  */
289
- analyze(options: ImageAnalysisOptions): Promise<ImageAnalysisResult>;
305
+ analyze(options: TProvider extends VisionCapability ? ImageAnalysisOptions : never): Promise<TProvider extends VisionCapability ? ImageAnalysisResult : never>;
290
306
  }
291
307
 
292
- declare class AudioNamespace {
308
+ declare class AudioNamespace<TProvider extends AIProvider> {
293
309
  private provider;
294
- constructor(provider: AIProvider);
310
+ constructor(provider: TProvider);
295
311
  /**
296
- * Convert text to speech.
312
+ * Convert text to speech. Only available if the provider supports TTS.
297
313
  */
298
- speak(options: SpeechGenerationOptions): Promise<SpeechResult>;
314
+ speak(options: TProvider extends SpeechGenerationCapability ? SpeechGenerationOptions : never): Promise<TProvider extends SpeechGenerationCapability ? SpeechResult : never>;
299
315
  /**
300
- * Transcribe audio to text.
316
+ * Transcribe audio to text. Only available if the provider supports STT.
301
317
  */
302
- transcribe(options: TranscriptionOptions): Promise<TranscriptionResult>;
318
+ transcribe(options: TProvider extends TranscriptionCapability ? TranscriptionOptions : never): Promise<TProvider extends TranscriptionCapability ? TranscriptionResult : never>;
303
319
  }
304
320
 
305
- declare class VideosNamespace {
321
+ declare class VideosNamespace<TProvider extends AIProvider> {
306
322
  private provider;
307
- constructor(provider: AIProvider);
323
+ constructor(provider: TProvider);
308
324
  /**
309
- * Generate a video from a prompt.
325
+ * Generate a video from a prompt. Only available if the provider supports video generation.
310
326
  */
311
- generate(options: VideoGenerationOptions): Promise<VideoResult>;
327
+ generate(options: TProvider extends VideoGenerationCapability ? VideoGenerationOptions : never): Promise<TProvider extends VideoGenerationCapability ? VideoResult : never>;
312
328
  /**
313
- * Analyze a video (Video-to-Text).
329
+ * Analyze a video (Video-to-Text). Only available if the provider supports video analysis.
314
330
  */
315
- analyze(options: VideoAnalysisOptions): Promise<VideoAnalysisResult>;
331
+ analyze(options: TProvider extends VideoAnalysisCapability ? VideoAnalysisOptions : never): Promise<TProvider extends VideoAnalysisCapability ? VideoAnalysisResult : never>;
316
332
  }
317
333
 
318
- interface TekimaxOptions {
319
- provider: AIProvider;
334
+ interface TekimaxOptions<TProvider extends AIProvider> {
335
+ provider: TProvider;
320
336
  }
321
- declare class Tekimax {
337
+ declare class Tekimax<TProvider extends AIProvider> {
322
338
  private provider;
323
- text: TextNamespace;
324
- images: ImagesNamespace;
325
- audio: AudioNamespace;
326
- videos: VideosNamespace;
327
- constructor(options: TekimaxOptions);
339
+ text: TextNamespace<TProvider>;
340
+ images: ImagesNamespace<TProvider>;
341
+ audio: AudioNamespace<TProvider>;
342
+ videos: VideosNamespace<TProvider>;
343
+ constructor(options: TekimaxOptions<TProvider>);
328
344
  /**
329
345
  * @deprecated Use client.text.chat instead. Kept for backward compatibility.
330
346
  */
@@ -336,4 +352,4 @@ declare class Tekimax {
336
352
  };
337
353
  }
338
354
 
339
- export { type AIProvider as A, type ChatOptions as C, type EmbeddingOptions as E, type GenerateTextResult as G, type ImageAnalysisOptions as I, type Message as M, type StreamChunk as S, type Tool as T, type VideoAnalysisOptions as V, type ChatResult as a, type ImageAnalysisResult as b, type VideoAnalysisResult as c, type EmbeddingResult as d, type SpeechGenerationOptions as e, type SpeechResult as f, type ImageGenerationOptions as g, type ImageResult as h, type TranscriptionOptions as i, type TranscriptionResult as j, type ImageEditOptions as k, type VideoGenerationOptions as l, type VideoResult as m, type ContentPart as n, type ImageContent as o, type ImageContentPart as p, type MessageRole as q, Tekimax as r, type TekimaxOptions as s, type TextContentPart as t, type ToolCall as u, type ToolDefinition as v, type VideoContent as w };
355
+ export { type AIProvider as A, type ToolDefinition as B, type ChatOptions as C, type VideoContent as D, type EmbeddingCapability as E, type VideoGenerationCapability as F, type GenerateTextResult as G, type VideoGenerationOptions as H, type ImageAnalysisOptions as I, type VideoResult as J, type Message as M, type StreamChunk as S, type Tool as T, type VisionCapability as V, type ChatResult as a, type ImageAnalysisResult as b, type VideoAnalysisCapability as c, type VideoAnalysisOptions as d, type VideoAnalysisResult as e, type EmbeddingOptions as f, type EmbeddingResult as g, type SpeechGenerationCapability as h, type ImageGenerationCapability as i, type ImageEditCapability as j, type TranscriptionCapability as k, type SpeechGenerationOptions as l, type SpeechResult as m, type ImageGenerationOptions as n, type ImageResult as o, type TranscriptionOptions as p, type TranscriptionResult as q, type ImageEditOptions as r, type ContentPart as s, type ImageContent as t, type ImageContentPart as u, type MessageRole as v, Tekimax as w, type TekimaxOptions as x, type TextContentPart as y, type ToolCall as z };
@@ -215,43 +215,59 @@ interface AIProvider {
215
215
  * Stream a chat completion.
216
216
  */
217
217
  chatStream: (options: ChatOptions) => AsyncIterable<StreamChunk>;
218
+ }
219
+ interface ImageGenerationCapability {
218
220
  /**
219
221
  * Generate an image.
220
222
  */
221
- generateImage?: (options: ImageGenerationOptions) => Promise<ImageResult>;
223
+ generateImage: (options: ImageGenerationOptions) => Promise<ImageResult>;
224
+ }
225
+ interface ImageEditCapability {
222
226
  /**
223
227
  * Edit an image.
224
228
  */
225
- editImage?: (options: ImageEditOptions) => Promise<ImageResult>;
229
+ editImage: (options: ImageEditOptions) => Promise<ImageResult>;
230
+ }
231
+ interface VisionCapability {
226
232
  /**
227
233
  * Analyze an image (Vision).
228
234
  */
229
- analyzeImage?: (options: ImageAnalysisOptions) => Promise<ImageAnalysisResult>;
235
+ analyzeImage: (options: ImageAnalysisOptions) => Promise<ImageAnalysisResult>;
236
+ }
237
+ interface SpeechGenerationCapability {
230
238
  /**
231
239
  * Generate speech from text (TTS).
232
240
  */
233
- generateSpeech?: (options: SpeechGenerationOptions) => Promise<SpeechResult>;
241
+ generateSpeech: (options: SpeechGenerationOptions) => Promise<SpeechResult>;
242
+ }
243
+ interface TranscriptionCapability {
234
244
  /**
235
245
  * Transcribe audio to text (STT).
236
246
  */
237
- transcribeAudio?: (options: TranscriptionOptions) => Promise<TranscriptionResult>;
247
+ transcribeAudio: (options: TranscriptionOptions) => Promise<TranscriptionResult>;
248
+ }
249
+ interface VideoGenerationCapability {
238
250
  /**
239
251
  * Generate a video.
240
252
  */
241
- generateVideo?: (options: VideoGenerationOptions) => Promise<VideoResult>;
253
+ generateVideo: (options: VideoGenerationOptions) => Promise<VideoResult>;
254
+ }
255
+ interface VideoAnalysisCapability {
242
256
  /**
243
257
  * Analyze a video (Video-to-Text).
244
258
  */
245
- analyzeVideo?: (options: VideoAnalysisOptions) => Promise<VideoAnalysisResult>;
259
+ analyzeVideo: (options: VideoAnalysisOptions) => Promise<VideoAnalysisResult>;
260
+ }
261
+ interface EmbeddingCapability {
246
262
  /**
247
263
  * Generate embeddings for text input(s).
248
264
  */
249
- embed?: (options: EmbeddingOptions) => Promise<EmbeddingResult>;
265
+ embed: (options: EmbeddingOptions) => Promise<EmbeddingResult>;
250
266
  }
251
267
 
252
- declare class TextNamespace {
268
+ declare class TextNamespace<TProvider extends AIProvider> {
253
269
  private provider;
254
- constructor(provider: AIProvider);
270
+ constructor(provider: TProvider);
255
271
  /**
256
272
  * Generate text from a prompt (Chat Completion).
257
273
  */
@@ -261,9 +277,9 @@ declare class TextNamespace {
261
277
  */
262
278
  generateStream(options: ChatOptions): AsyncGenerator<StreamChunk>;
263
279
  /**
264
- * Generate embeddings for text input(s).
280
+ * Generate embeddings for text input(s). Only available if the provider supports embeddings.
265
281
  */
266
- embed(options: EmbeddingOptions): Promise<EmbeddingResult>;
282
+ embed(options: TProvider extends EmbeddingCapability ? EmbeddingOptions : never): Promise<TProvider extends EmbeddingCapability ? EmbeddingResult : never>;
267
283
  get chat(): {
268
284
  completions: {
269
285
  create: (options: ChatOptions) => Promise<ChatResult>;
@@ -272,59 +288,59 @@ declare class TextNamespace {
272
288
  };
273
289
  }
274
290
 
275
- declare class ImagesNamespace {
291
+ declare class ImagesNamespace<TProvider extends AIProvider> {
276
292
  private provider;
277
- constructor(provider: AIProvider);
293
+ constructor(provider: TProvider);
278
294
  /**
279
- * Generate images from a prompt.
295
+ * Generate images from a prompt. Only available if the provider supports image generation.
280
296
  */
281
- generate(options: ImageGenerationOptions): Promise<ImageResult>;
297
+ generate(options: TProvider extends ImageGenerationCapability ? ImageGenerationOptions : never): Promise<TProvider extends ImageGenerationCapability ? ImageResult : never>;
282
298
  /**
283
- * Edit an image with a prompt.
299
+ * Edit an image with a prompt. Only available if the provider supports image editing.
284
300
  */
285
- edit(options: ImageEditOptions): Promise<ImageResult>;
301
+ edit(options: TProvider extends ImageEditCapability ? ImageEditOptions : never): Promise<TProvider extends ImageEditCapability ? ImageResult : never>;
286
302
  /**
287
- * Analyze an image (Vision).
303
+ * Analyze an image (Vision). Only available if the provider supports vision analytics.
288
304
  */
289
- analyze(options: ImageAnalysisOptions): Promise<ImageAnalysisResult>;
305
+ analyze(options: TProvider extends VisionCapability ? ImageAnalysisOptions : never): Promise<TProvider extends VisionCapability ? ImageAnalysisResult : never>;
290
306
  }
291
307
 
292
- declare class AudioNamespace {
308
+ declare class AudioNamespace<TProvider extends AIProvider> {
293
309
  private provider;
294
- constructor(provider: AIProvider);
310
+ constructor(provider: TProvider);
295
311
  /**
296
- * Convert text to speech.
312
+ * Convert text to speech. Only available if the provider supports TTS.
297
313
  */
298
- speak(options: SpeechGenerationOptions): Promise<SpeechResult>;
314
+ speak(options: TProvider extends SpeechGenerationCapability ? SpeechGenerationOptions : never): Promise<TProvider extends SpeechGenerationCapability ? SpeechResult : never>;
299
315
  /**
300
- * Transcribe audio to text.
316
+ * Transcribe audio to text. Only available if the provider supports STT.
301
317
  */
302
- transcribe(options: TranscriptionOptions): Promise<TranscriptionResult>;
318
+ transcribe(options: TProvider extends TranscriptionCapability ? TranscriptionOptions : never): Promise<TProvider extends TranscriptionCapability ? TranscriptionResult : never>;
303
319
  }
304
320
 
305
- declare class VideosNamespace {
321
+ declare class VideosNamespace<TProvider extends AIProvider> {
306
322
  private provider;
307
- constructor(provider: AIProvider);
323
+ constructor(provider: TProvider);
308
324
  /**
309
- * Generate a video from a prompt.
325
+ * Generate a video from a prompt. Only available if the provider supports video generation.
310
326
  */
311
- generate(options: VideoGenerationOptions): Promise<VideoResult>;
327
+ generate(options: TProvider extends VideoGenerationCapability ? VideoGenerationOptions : never): Promise<TProvider extends VideoGenerationCapability ? VideoResult : never>;
312
328
  /**
313
- * Analyze a video (Video-to-Text).
329
+ * Analyze a video (Video-to-Text). Only available if the provider supports video analysis.
314
330
  */
315
- analyze(options: VideoAnalysisOptions): Promise<VideoAnalysisResult>;
331
+ analyze(options: TProvider extends VideoAnalysisCapability ? VideoAnalysisOptions : never): Promise<TProvider extends VideoAnalysisCapability ? VideoAnalysisResult : never>;
316
332
  }
317
333
 
318
- interface TekimaxOptions {
319
- provider: AIProvider;
334
+ interface TekimaxOptions<TProvider extends AIProvider> {
335
+ provider: TProvider;
320
336
  }
321
- declare class Tekimax {
337
+ declare class Tekimax<TProvider extends AIProvider> {
322
338
  private provider;
323
- text: TextNamespace;
324
- images: ImagesNamespace;
325
- audio: AudioNamespace;
326
- videos: VideosNamespace;
327
- constructor(options: TekimaxOptions);
339
+ text: TextNamespace<TProvider>;
340
+ images: ImagesNamespace<TProvider>;
341
+ audio: AudioNamespace<TProvider>;
342
+ videos: VideosNamespace<TProvider>;
343
+ constructor(options: TekimaxOptions<TProvider>);
328
344
  /**
329
345
  * @deprecated Use client.text.chat instead. Kept for backward compatibility.
330
346
  */
@@ -336,4 +352,4 @@ declare class Tekimax {
336
352
  };
337
353
  }
338
354
 
339
- export { type AIProvider as A, type ChatOptions as C, type EmbeddingOptions as E, type GenerateTextResult as G, type ImageAnalysisOptions as I, type Message as M, type StreamChunk as S, type Tool as T, type VideoAnalysisOptions as V, type ChatResult as a, type ImageAnalysisResult as b, type VideoAnalysisResult as c, type EmbeddingResult as d, type SpeechGenerationOptions as e, type SpeechResult as f, type ImageGenerationOptions as g, type ImageResult as h, type TranscriptionOptions as i, type TranscriptionResult as j, type ImageEditOptions as k, type VideoGenerationOptions as l, type VideoResult as m, type ContentPart as n, type ImageContent as o, type ImageContentPart as p, type MessageRole as q, Tekimax as r, type TekimaxOptions as s, type TextContentPart as t, type ToolCall as u, type ToolDefinition as v, type VideoContent as w };
355
+ export { type AIProvider as A, type ToolDefinition as B, type ChatOptions as C, type VideoContent as D, type EmbeddingCapability as E, type VideoGenerationCapability as F, type GenerateTextResult as G, type VideoGenerationOptions as H, type ImageAnalysisOptions as I, type VideoResult as J, type Message as M, type StreamChunk as S, type Tool as T, type VisionCapability as V, type ChatResult as a, type ImageAnalysisResult as b, type VideoAnalysisCapability as c, type VideoAnalysisOptions as d, type VideoAnalysisResult as e, type EmbeddingOptions as f, type EmbeddingResult as g, type SpeechGenerationCapability as h, type ImageGenerationCapability as i, type ImageEditCapability as j, type TranscriptionCapability as k, type SpeechGenerationOptions as l, type SpeechResult as m, type ImageGenerationOptions as n, type ImageResult as o, type TranscriptionOptions as p, type TranscriptionResult as q, type ImageEditOptions as r, type ContentPart as s, type ImageContent as t, type ImageContentPart as u, type MessageRole as v, Tekimax as w, type TekimaxOptions as x, type TextContentPart as y, type ToolCall as z };