tekimax-ts 0.1.8 → 0.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.
@@ -0,0 +1,283 @@
1
+ type MessageRole = 'system' | 'user' | 'assistant' | 'tool';
2
+ interface ToolCall {
3
+ id: string;
4
+ type: 'function';
5
+ function: {
6
+ name: string;
7
+ arguments: string;
8
+ };
9
+ }
10
+ interface ToolDefinition {
11
+ type: 'function';
12
+ function: {
13
+ name: string;
14
+ description?: string;
15
+ parameters?: Record<string, unknown>;
16
+ };
17
+ }
18
+ interface Tool<T = any> extends ToolDefinition {
19
+ execute: (args: T) => Promise<unknown>;
20
+ }
21
+ interface GenerateTextResult {
22
+ text: string;
23
+ toolCalls: Array<ToolCall>;
24
+ toolResults: Array<{
25
+ id: string;
26
+ result: unknown;
27
+ }>;
28
+ finishReason: 'stop' | 'length' | 'tool_calls' | 'error' | 'unknown';
29
+ usage: {
30
+ promptTokens: number;
31
+ completionTokens: number;
32
+ totalTokens: number;
33
+ };
34
+ warnings?: Array<string>;
35
+ }
36
+ interface TextContentPart {
37
+ type: 'text';
38
+ text: string;
39
+ }
40
+ interface ImageContentPart {
41
+ type: 'image_url';
42
+ image_url: {
43
+ url: string;
44
+ detail?: 'auto' | 'low' | 'high';
45
+ };
46
+ }
47
+ type ContentPart = TextContentPart | ImageContentPart;
48
+ interface Message {
49
+ role: MessageRole;
50
+ content: string | Array<ContentPart> | null;
51
+ thinking?: string;
52
+ toolCalls?: Array<ToolCall>;
53
+ toolCallId?: string;
54
+ name?: string;
55
+ }
56
+ interface ImageGenerationOptions {
57
+ prompt: string;
58
+ model?: string;
59
+ n?: number;
60
+ size?: string;
61
+ quality?: string;
62
+ style?: string;
63
+ response_format?: 'url' | 'b64_json';
64
+ user?: string;
65
+ }
66
+ interface ImageEditOptions extends ImageGenerationOptions {
67
+ image: string | Blob | Buffer;
68
+ mask?: string | Blob | Buffer;
69
+ }
70
+ interface ImageContent {
71
+ url?: string;
72
+ b64_json?: string;
73
+ revised_prompt?: string;
74
+ }
75
+ interface ImageResult {
76
+ created: number;
77
+ data: ImageContent[];
78
+ }
79
+ interface ImageAnalysisOptions {
80
+ image: string | Blob | Buffer;
81
+ prompt?: string;
82
+ model: string;
83
+ messages?: Array<Message>;
84
+ }
85
+ interface ImageAnalysisResult {
86
+ content: string;
87
+ usage?: {
88
+ inputTokens?: number;
89
+ outputTokens?: number;
90
+ totalTokens?: number;
91
+ };
92
+ }
93
+ interface SpeechGenerationOptions {
94
+ input: string;
95
+ model?: string;
96
+ voice: string;
97
+ response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
98
+ speed?: number;
99
+ }
100
+ interface SpeechResult {
101
+ buffer: ArrayBuffer;
102
+ headers?: Record<string, string>;
103
+ }
104
+ interface VideoGenerationOptions {
105
+ prompt: string;
106
+ model?: string;
107
+ aspect_ratio?: string;
108
+ duration_seconds?: number;
109
+ }
110
+ interface VideoContent {
111
+ url?: string;
112
+ b64_json?: string;
113
+ }
114
+ interface VideoResult {
115
+ data: VideoContent[];
116
+ }
117
+ interface VideoAnalysisOptions {
118
+ video: string | Blob | Buffer;
119
+ prompt?: string;
120
+ model: string;
121
+ messages?: Array<Message>;
122
+ }
123
+ interface VideoAnalysisResult {
124
+ content: string;
125
+ usage?: {
126
+ inputTokens?: number;
127
+ outputTokens?: number;
128
+ totalTokens?: number;
129
+ };
130
+ }
131
+ interface ChatOptions {
132
+ model: string;
133
+ messages: Array<Message>;
134
+ tools?: Array<ToolDefinition>;
135
+ temperature?: number;
136
+ maxTokens?: number;
137
+ stream?: boolean;
138
+ think?: boolean;
139
+ signal?: AbortSignal;
140
+ }
141
+ interface ChatResult {
142
+ message: Message;
143
+ usage?: {
144
+ promptTokens: number;
145
+ completionTokens: number;
146
+ totalTokens: number;
147
+ };
148
+ }
149
+ interface StreamChunk {
150
+ delta: string;
151
+ thinking?: string;
152
+ toolCallDelta?: {
153
+ index: number;
154
+ id?: string;
155
+ type?: 'function';
156
+ function?: {
157
+ name?: string;
158
+ arguments?: string;
159
+ };
160
+ };
161
+ usage?: {
162
+ promptTokens: number;
163
+ completionTokens: number;
164
+ totalTokens: number;
165
+ };
166
+ }
167
+
168
+ interface AIProvider {
169
+ name: string;
170
+ /**
171
+ * Send a chat completion request.
172
+ */
173
+ chat: (options: ChatOptions) => Promise<ChatResult>;
174
+ /**
175
+ * Stream a chat completion.
176
+ */
177
+ chatStream: (options: ChatOptions) => AsyncIterable<StreamChunk>;
178
+ /**
179
+ * Generate an image.
180
+ */
181
+ generateImage?: (options: ImageGenerationOptions) => Promise<ImageResult>;
182
+ /**
183
+ * Edit an image.
184
+ */
185
+ editImage?: (options: ImageEditOptions) => Promise<ImageResult>;
186
+ /**
187
+ * Analyze an image (Vision).
188
+ */
189
+ analyzeImage?: (options: ImageAnalysisOptions) => Promise<ImageAnalysisResult>;
190
+ /**
191
+ * Generate speech from text (TTS).
192
+ */
193
+ generateSpeech?: (options: SpeechGenerationOptions) => Promise<SpeechResult>;
194
+ /**
195
+ * Generate a video.
196
+ */
197
+ generateVideo?: (options: VideoGenerationOptions) => Promise<VideoResult>;
198
+ /**
199
+ * Analyze a video (Video-to-Text).
200
+ */
201
+ analyzeVideo?: (options: VideoAnalysisOptions) => Promise<VideoAnalysisResult>;
202
+ }
203
+
204
+ declare class TextNamespace {
205
+ private provider;
206
+ constructor(provider: AIProvider);
207
+ /**
208
+ * Generate text from a prompt (Chat Completion).
209
+ */
210
+ generate(options: ChatOptions): Promise<ChatResult>;
211
+ /**
212
+ * Stream text generation.
213
+ */
214
+ generateStream(options: ChatOptions): AsyncGenerator<StreamChunk>;
215
+ get chat(): {
216
+ completions: {
217
+ create: (options: ChatOptions) => Promise<ChatResult>;
218
+ createStream: (options: ChatOptions) => AsyncGenerator<StreamChunk, any, any>;
219
+ };
220
+ };
221
+ }
222
+
223
+ declare class ImagesNamespace {
224
+ private provider;
225
+ constructor(provider: AIProvider);
226
+ /**
227
+ * Generate images from a prompt.
228
+ */
229
+ generate(options: ImageGenerationOptions): Promise<ImageResult>;
230
+ /**
231
+ * Edit an image with a prompt.
232
+ */
233
+ edit(options: ImageEditOptions): Promise<ImageResult>;
234
+ /**
235
+ * Analyze an image (Vision).
236
+ */
237
+ analyze(options: ImageAnalysisOptions): Promise<ImageAnalysisResult>;
238
+ }
239
+
240
+ declare class AudioNamespace {
241
+ private provider;
242
+ constructor(provider: AIProvider);
243
+ /**
244
+ * Convert text to speech.
245
+ */
246
+ speak(options: SpeechGenerationOptions): Promise<SpeechResult>;
247
+ }
248
+
249
+ declare class VideosNamespace {
250
+ private provider;
251
+ constructor(provider: AIProvider);
252
+ /**
253
+ * Generate a video from a prompt.
254
+ */
255
+ generate(options: VideoGenerationOptions): Promise<VideoResult>;
256
+ /**
257
+ * Analyze a video (Video-to-Text).
258
+ */
259
+ analyze(options: VideoAnalysisOptions): Promise<VideoAnalysisResult>;
260
+ }
261
+
262
+ interface TekimaxOptions {
263
+ provider: AIProvider;
264
+ }
265
+ declare class Tekimax {
266
+ private provider;
267
+ text: TextNamespace;
268
+ images: ImagesNamespace;
269
+ audio: AudioNamespace;
270
+ videos: VideosNamespace;
271
+ constructor(options: TekimaxOptions);
272
+ /**
273
+ * @deprecated Use client.text.chat instead. Kept for backward compatibility.
274
+ */
275
+ get chat(): {
276
+ completions: {
277
+ create: (options: ChatOptions) => Promise<ChatResult>;
278
+ createStream: (options: ChatOptions) => AsyncGenerator<StreamChunk, any, any>;
279
+ };
280
+ };
281
+ }
282
+
283
+ export { type AIProvider as A, type ChatOptions as C, type GenerateTextResult as G, type ImageGenerationOptions as I, type Message as M, type StreamChunk as S, type Tool as T, type VideoAnalysisOptions as V, type ChatResult as a, type VideoAnalysisResult as b, type SpeechGenerationOptions as c, type SpeechResult as d, type ImageResult as e, type ImageAnalysisOptions as f, type ImageAnalysisResult as g, type ContentPart as h, type ImageContent as i, type ImageContentPart as j, type ImageEditOptions as k, type MessageRole as l, Tekimax as m, type TekimaxOptions as n, type TextContentPart as o, type ToolCall as p, type ToolDefinition as q, type VideoContent as r, type VideoGenerationOptions as s, type VideoResult as t };
@@ -0,0 +1,283 @@
1
+ type MessageRole = 'system' | 'user' | 'assistant' | 'tool';
2
+ interface ToolCall {
3
+ id: string;
4
+ type: 'function';
5
+ function: {
6
+ name: string;
7
+ arguments: string;
8
+ };
9
+ }
10
+ interface ToolDefinition {
11
+ type: 'function';
12
+ function: {
13
+ name: string;
14
+ description?: string;
15
+ parameters?: Record<string, unknown>;
16
+ };
17
+ }
18
+ interface Tool<T = any> extends ToolDefinition {
19
+ execute: (args: T) => Promise<unknown>;
20
+ }
21
+ interface GenerateTextResult {
22
+ text: string;
23
+ toolCalls: Array<ToolCall>;
24
+ toolResults: Array<{
25
+ id: string;
26
+ result: unknown;
27
+ }>;
28
+ finishReason: 'stop' | 'length' | 'tool_calls' | 'error' | 'unknown';
29
+ usage: {
30
+ promptTokens: number;
31
+ completionTokens: number;
32
+ totalTokens: number;
33
+ };
34
+ warnings?: Array<string>;
35
+ }
36
+ interface TextContentPart {
37
+ type: 'text';
38
+ text: string;
39
+ }
40
+ interface ImageContentPart {
41
+ type: 'image_url';
42
+ image_url: {
43
+ url: string;
44
+ detail?: 'auto' | 'low' | 'high';
45
+ };
46
+ }
47
+ type ContentPart = TextContentPart | ImageContentPart;
48
+ interface Message {
49
+ role: MessageRole;
50
+ content: string | Array<ContentPart> | null;
51
+ thinking?: string;
52
+ toolCalls?: Array<ToolCall>;
53
+ toolCallId?: string;
54
+ name?: string;
55
+ }
56
+ interface ImageGenerationOptions {
57
+ prompt: string;
58
+ model?: string;
59
+ n?: number;
60
+ size?: string;
61
+ quality?: string;
62
+ style?: string;
63
+ response_format?: 'url' | 'b64_json';
64
+ user?: string;
65
+ }
66
+ interface ImageEditOptions extends ImageGenerationOptions {
67
+ image: string | Blob | Buffer;
68
+ mask?: string | Blob | Buffer;
69
+ }
70
+ interface ImageContent {
71
+ url?: string;
72
+ b64_json?: string;
73
+ revised_prompt?: string;
74
+ }
75
+ interface ImageResult {
76
+ created: number;
77
+ data: ImageContent[];
78
+ }
79
+ interface ImageAnalysisOptions {
80
+ image: string | Blob | Buffer;
81
+ prompt?: string;
82
+ model: string;
83
+ messages?: Array<Message>;
84
+ }
85
+ interface ImageAnalysisResult {
86
+ content: string;
87
+ usage?: {
88
+ inputTokens?: number;
89
+ outputTokens?: number;
90
+ totalTokens?: number;
91
+ };
92
+ }
93
+ interface SpeechGenerationOptions {
94
+ input: string;
95
+ model?: string;
96
+ voice: string;
97
+ response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';
98
+ speed?: number;
99
+ }
100
+ interface SpeechResult {
101
+ buffer: ArrayBuffer;
102
+ headers?: Record<string, string>;
103
+ }
104
+ interface VideoGenerationOptions {
105
+ prompt: string;
106
+ model?: string;
107
+ aspect_ratio?: string;
108
+ duration_seconds?: number;
109
+ }
110
+ interface VideoContent {
111
+ url?: string;
112
+ b64_json?: string;
113
+ }
114
+ interface VideoResult {
115
+ data: VideoContent[];
116
+ }
117
+ interface VideoAnalysisOptions {
118
+ video: string | Blob | Buffer;
119
+ prompt?: string;
120
+ model: string;
121
+ messages?: Array<Message>;
122
+ }
123
+ interface VideoAnalysisResult {
124
+ content: string;
125
+ usage?: {
126
+ inputTokens?: number;
127
+ outputTokens?: number;
128
+ totalTokens?: number;
129
+ };
130
+ }
131
+ interface ChatOptions {
132
+ model: string;
133
+ messages: Array<Message>;
134
+ tools?: Array<ToolDefinition>;
135
+ temperature?: number;
136
+ maxTokens?: number;
137
+ stream?: boolean;
138
+ think?: boolean;
139
+ signal?: AbortSignal;
140
+ }
141
+ interface ChatResult {
142
+ message: Message;
143
+ usage?: {
144
+ promptTokens: number;
145
+ completionTokens: number;
146
+ totalTokens: number;
147
+ };
148
+ }
149
+ interface StreamChunk {
150
+ delta: string;
151
+ thinking?: string;
152
+ toolCallDelta?: {
153
+ index: number;
154
+ id?: string;
155
+ type?: 'function';
156
+ function?: {
157
+ name?: string;
158
+ arguments?: string;
159
+ };
160
+ };
161
+ usage?: {
162
+ promptTokens: number;
163
+ completionTokens: number;
164
+ totalTokens: number;
165
+ };
166
+ }
167
+
168
+ interface AIProvider {
169
+ name: string;
170
+ /**
171
+ * Send a chat completion request.
172
+ */
173
+ chat: (options: ChatOptions) => Promise<ChatResult>;
174
+ /**
175
+ * Stream a chat completion.
176
+ */
177
+ chatStream: (options: ChatOptions) => AsyncIterable<StreamChunk>;
178
+ /**
179
+ * Generate an image.
180
+ */
181
+ generateImage?: (options: ImageGenerationOptions) => Promise<ImageResult>;
182
+ /**
183
+ * Edit an image.
184
+ */
185
+ editImage?: (options: ImageEditOptions) => Promise<ImageResult>;
186
+ /**
187
+ * Analyze an image (Vision).
188
+ */
189
+ analyzeImage?: (options: ImageAnalysisOptions) => Promise<ImageAnalysisResult>;
190
+ /**
191
+ * Generate speech from text (TTS).
192
+ */
193
+ generateSpeech?: (options: SpeechGenerationOptions) => Promise<SpeechResult>;
194
+ /**
195
+ * Generate a video.
196
+ */
197
+ generateVideo?: (options: VideoGenerationOptions) => Promise<VideoResult>;
198
+ /**
199
+ * Analyze a video (Video-to-Text).
200
+ */
201
+ analyzeVideo?: (options: VideoAnalysisOptions) => Promise<VideoAnalysisResult>;
202
+ }
203
+
204
+ declare class TextNamespace {
205
+ private provider;
206
+ constructor(provider: AIProvider);
207
+ /**
208
+ * Generate text from a prompt (Chat Completion).
209
+ */
210
+ generate(options: ChatOptions): Promise<ChatResult>;
211
+ /**
212
+ * Stream text generation.
213
+ */
214
+ generateStream(options: ChatOptions): AsyncGenerator<StreamChunk>;
215
+ get chat(): {
216
+ completions: {
217
+ create: (options: ChatOptions) => Promise<ChatResult>;
218
+ createStream: (options: ChatOptions) => AsyncGenerator<StreamChunk, any, any>;
219
+ };
220
+ };
221
+ }
222
+
223
+ declare class ImagesNamespace {
224
+ private provider;
225
+ constructor(provider: AIProvider);
226
+ /**
227
+ * Generate images from a prompt.
228
+ */
229
+ generate(options: ImageGenerationOptions): Promise<ImageResult>;
230
+ /**
231
+ * Edit an image with a prompt.
232
+ */
233
+ edit(options: ImageEditOptions): Promise<ImageResult>;
234
+ /**
235
+ * Analyze an image (Vision).
236
+ */
237
+ analyze(options: ImageAnalysisOptions): Promise<ImageAnalysisResult>;
238
+ }
239
+
240
+ declare class AudioNamespace {
241
+ private provider;
242
+ constructor(provider: AIProvider);
243
+ /**
244
+ * Convert text to speech.
245
+ */
246
+ speak(options: SpeechGenerationOptions): Promise<SpeechResult>;
247
+ }
248
+
249
+ declare class VideosNamespace {
250
+ private provider;
251
+ constructor(provider: AIProvider);
252
+ /**
253
+ * Generate a video from a prompt.
254
+ */
255
+ generate(options: VideoGenerationOptions): Promise<VideoResult>;
256
+ /**
257
+ * Analyze a video (Video-to-Text).
258
+ */
259
+ analyze(options: VideoAnalysisOptions): Promise<VideoAnalysisResult>;
260
+ }
261
+
262
+ interface TekimaxOptions {
263
+ provider: AIProvider;
264
+ }
265
+ declare class Tekimax {
266
+ private provider;
267
+ text: TextNamespace;
268
+ images: ImagesNamespace;
269
+ audio: AudioNamespace;
270
+ videos: VideosNamespace;
271
+ constructor(options: TekimaxOptions);
272
+ /**
273
+ * @deprecated Use client.text.chat instead. Kept for backward compatibility.
274
+ */
275
+ get chat(): {
276
+ completions: {
277
+ create: (options: ChatOptions) => Promise<ChatResult>;
278
+ createStream: (options: ChatOptions) => AsyncGenerator<StreamChunk, any, any>;
279
+ };
280
+ };
281
+ }
282
+
283
+ export { type AIProvider as A, type ChatOptions as C, type GenerateTextResult as G, type ImageGenerationOptions as I, type Message as M, type StreamChunk as S, type Tool as T, type VideoAnalysisOptions as V, type ChatResult as a, type VideoAnalysisResult as b, type SpeechGenerationOptions as c, type SpeechResult as d, type ImageResult as e, type ImageAnalysisOptions as f, type ImageAnalysisResult as g, type ContentPart as h, type ImageContent as i, type ImageContentPart as j, type ImageEditOptions as k, type MessageRole as l, Tekimax as m, type TekimaxOptions as n, type TextContentPart as o, type ToolCall as p, type ToolDefinition as q, type VideoContent as r, type VideoGenerationOptions as s, type VideoResult as t };