@alaikis/translation-sdk 1.2.1 → 1.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.
@@ -1,357 +1,364 @@
1
- declare module "translation-client" {
1
+ /**
2
+ * Translation Service gRPC-Web TypeScript/JavaScript Client
3
+ *
4
+ * Auto-generated for api.laker.dev Translation Service
5
+ * Service: TranslationService
6
+ * Source: proto/translation.proto
7
+ */
8
+ export interface TranslateRecord {
9
+ id: string;
10
+ text: string;
11
+ translate: string;
12
+ isCustom: boolean;
13
+ }
14
+ export interface GetSenseTranslateRequest {
15
+ senseId: string;
16
+ fingerprint?: string;
17
+ page?: number;
18
+ pageSize?: number;
19
+ src_lang?: string;
20
+ dst_lang?: string;
21
+ }
22
+ export interface GetSenseTranslateResponse {
23
+ senseId: string;
24
+ total: number;
25
+ page: number;
26
+ pageSize: number;
27
+ result: TranslateRecord[];
28
+ }
29
+ export interface TranslateStreamRequest {
30
+ senseId: string;
31
+ fingerprint?: string;
32
+ batchSize?: number;
33
+ text?: string;
34
+ from_lang?: string;
35
+ to_lang?: string;
36
+ }
37
+ export interface TranslateStreamResponse {
38
+ original_text: string;
39
+ translation: Record<string, string>;
40
+ timestamp: number;
41
+ finished: boolean;
42
+ batch_index: number;
43
+ }
44
+ /**
45
+ * Result of template extraction
46
+ */
47
+ export interface TemplateExtractResult {
48
+ isTemplated: boolean;
49
+ srcTemplate: string;
50
+ dstTemplate: string;
51
+ variables: string[];
52
+ }
53
+ export interface LLMTranslateRequest {
54
+ text: string;
55
+ fromLang?: string;
56
+ toLang: string;
57
+ provider?: string;
58
+ senseId?: string;
59
+ fingerprint?: string;
60
+ }
61
+ export interface LLMTranslateResponse {
62
+ originalText: string;
63
+ translatedText: string;
64
+ provider: string;
65
+ timestamp: number;
66
+ finished: boolean;
67
+ cached: boolean;
68
+ fromLang?: string;
69
+ toLang?: string;
70
+ }
71
+ /**
72
+ * Result of translation lookup in TranslationPool
73
+ */
74
+ export interface TranslationLookupResult {
75
+ found: boolean;
76
+ translation: string;
77
+ source: 'special' | 'common' | null;
78
+ }
79
+ /**
80
+ * Cross-tab cache synchronization options
81
+ */
82
+ export interface CrossTabOptions {
83
+ enabled: boolean;
84
+ channelName?: string;
85
+ storageKeyPrefix?: string;
86
+ }
87
+ /**
88
+ * Automatic template extraction from text containing numeric variables
89
+ * @param text Original text that may contain numeric variables
90
+ * @returns Template extraction result
91
+ */
92
+ export declare function extractTemplate(text: string): TemplateExtractResult;
93
+ /**
94
+ * Translation options
95
+ */
96
+ export interface TranslationServiceOptions {
97
+ senseId: string;
98
+ fingerprint?: string;
99
+ fromLang?: string;
100
+ toLang?: string;
101
+ crossTab?: boolean;
102
+ crossTabChannelName?: string;
103
+ crossTabStorageKeyPrefix?: string;
104
+ }
105
+ /**
106
+ * Cross-tab cache synchronization options for TranslationClient
107
+ */
108
+ export interface ClientCrossTabOptions {
109
+ enabled: boolean;
110
+ channelName?: string;
111
+ storageKey?: string;
112
+ }
113
+ export interface TranslationClientConfig {
114
+ /** JWT authentication token */
115
+ token: string;
116
+ /** Translation sense ID */
117
+ senseId: string;
118
+ /** API base URL (optional, defaults to https://api.hottol.com/laker/) */
119
+ baseUrl?: string;
120
+ /** Request timeout in milliseconds (optional, defaults to 30000) */
121
+ timeout?: number;
122
+ /** LRU cache size (optional, defaults to 1000, set to 0 to disable cache) */
123
+ cacheSize?: number;
124
+ /** Initial fingerprint for personalized translations (optional) */
125
+ fingerprint?: string;
126
+ /** Enable cross-tab cache synchronization (optional, default: false) */
127
+ crossTab?: boolean;
128
+ /** Custom cross-tab channel name (optional) */
129
+ crossTabChannelName?: string;
130
+ /** Custom cross-tab storage key prefix (optional) */
131
+ crossTabStorageKeyPrefix?: string;
132
+ /** Enable cache (optional, default: true, set false to disable all caching) */
133
+ useCache?: boolean;
134
+ }
135
+ /**
136
+ * TranslationClient - Main entry point for Laker Translation SDK
137
+ *
138
+ * Features:
139
+ * - Automatic cache lookup: preloaded translations → LRU cache → backend request
140
+ * - Fingerprint-based personalized translations support
141
+ * - Optional cross-browser-tab cache synchronization
142
+ * - Lazy initialization: automatically preloads on first use
143
+ * - Simple single-level API, no complex layering
144
+ */
145
+ export declare class TranslationClient {
146
+ private baseUrl;
147
+ private token;
148
+ private timeout;
149
+ private config;
150
+ private llmCacheEnabled;
151
+ private llmCache;
152
+ private pool;
153
+ private currentFingerprint;
154
+ private initialized;
155
+ private initPromise;
156
+ private broadcastChannel;
157
+ private crossTabOptions;
158
+ private storageKey;
159
+ /**
160
+ * Create a new TranslationClient - the only entry point you need
161
+ * @param config Client configuration
162
+ */
163
+ constructor(config: TranslationClientConfig);
164
+ /**
165
+ * Initialize cross-tab synchronization via Broadcast Channel
166
+ */
167
+ private initCrossTabSync;
168
+ /**
169
+ * Load cache from localStorage
170
+ */
171
+ private loadFromStorage;
172
+ /**
173
+ * Save cache to localStorage
174
+ */
175
+ private saveToStorage;
176
+ /**
177
+ * Get all cache entries for storage/broadcast
178
+ */
179
+ private getAllCacheEntries;
180
+ /**
181
+ * Broadcast full cache to other tabs
182
+ */
183
+ private broadcastFullCache;
184
+ /**
185
+ * Broadcast a single cache update to other tabs
186
+ */
187
+ private broadcastCacheUpdate;
188
+ /**
189
+ * Set or update the JWT authentication token
190
+ * @param token JWT token
191
+ */
192
+ setToken(token: string): void;
193
+ /**
194
+ * Enable or disable LLM cache
195
+ * @param enabled Whether to enable cache
196
+ */
197
+ setCacheEnabled(enabled: boolean): void;
198
+ /**
199
+ * Clear the LLM translation cache (also clears localStorage and broadcasts to other tabs)
200
+ */
201
+ clearCache(): void;
202
+ /**
203
+ * Get current LLM cache size
204
+ */
205
+ getCacheSize(): number;
206
+ /**
207
+ * Check if cross-tab synchronization is enabled
208
+ */
209
+ isCrossTabEnabled(): boolean;
210
+ /**
211
+ 凤 * GetSenseTranslate - One-shot unary request with pagination
212
+ * @param request Request parameters
213
+ */
214
+ getSenseTranslate(request: GetSenseTranslateRequest): Promise<GetSenseTranslateResponse>;
215
+ /**
216
+ * TranslateStream - Server streaming, receives multiple batches progressively
217
+ * @param request Request parameters
218
+ * @param onBatch Callback for each batch received. Return false to stop streaming early.
219
+ */
220
+ translateStream(request: TranslateStreamRequest, onBatch: (response: TranslateStreamResponse) => boolean | void): Promise<void>;
221
+ /**
222
+ * Collect all streaming responses into an array
223
+ * @param request Request parameters
224
+ */
225
+ translateStreamCollect(request: TranslateStreamRequest): Promise<TranslateStreamResponse[]>;
226
+ /**
227
+ * LLMTranslate - One-shot large language model translation
228
+ * Uses LRU cache to avoid repeated requests for the same text
229
+ * With cross-tab enabled, automatically syncs cache across browser tabs
230
+ * @param request Translation request
231
+ * @param skipCache If true, bypass cache and always request from backend
232
+ */
233
+ llmTranslate(request: LLMTranslateRequest, skipCache?: boolean): Promise<LLMTranslateResponse>;
2
234
  /**
3
- * Translation Service gRPC-Web TypeScript/JavaScript Client
235
+ * Translate text - this is the main method you need
4
236
  *
5
- * Auto-generated for api.laker.dev Translation Service
6
- * Service: TranslationService
7
- * Source: proto/translation.proto
8
- */
9
- export interface TranslateRecord {
10
- id: string;
11
- text: string;
12
- translate: string;
13
- isCustom: boolean;
14
- }
15
- export interface GetSenseTranslateRequest {
16
- senseId: string;
17
- fingerprint?: string;
18
- page?: number;
19
- pageSize?: number;
20
- src_lang?: string;
21
- dst_lang?: string;
22
- }
23
- export interface GetSenseTranslateResponse {
24
- senseId: string;
25
- total: number;
26
- page: number;
27
- pageSize: number;
28
- result: TranslateRecord[];
29
- }
30
- export interface TranslateStreamRequest {
31
- senseId: string;
32
- fingerprint?: string;
33
- batchSize?: number;
34
- }
35
- export interface TranslateStreamResponse {
36
- batch: number;
37
- hasMore: boolean;
38
- total: number;
39
- translations: TranslateRecord[];
40
- }
41
- /**
42
- * Result of template extraction
43
- */
44
- export interface TemplateExtractResult {
45
- isTemplated: boolean;
46
- srcTemplate: string;
47
- dstTemplate: string;
48
- variables: string[];
49
- }
50
- export interface LLMTranslateRequest {
51
- text: string;
52
- fromLang?: string;
53
- toLang: string;
54
- provider?: string;
55
- senseId?: string;
56
- fingerprint?: string;
57
- }
58
- export interface LLMTranslateResponse {
59
- originalText: string;
60
- translatedText: string;
61
- provider: string;
62
- timestamp: number;
63
- finished: boolean;
64
- cached: boolean;
65
- fromLang?: string;
66
- toLang?: string;
67
- }
68
- /**
69
- * Result of translation lookup in TranslationPool
70
- */
71
- export interface TranslationLookupResult {
72
- found: boolean;
73
- translation: string;
74
- source: 'special' | 'common' | null;
75
- }
76
- /**
77
- * Cross-tab cache synchronization options
78
- */
79
- export interface CrossTabOptions {
80
- enabled: boolean;
81
- channelName?: string;
82
- storageKeyPrefix?: string;
83
- }
84
- /**
85
- * Automatic template extraction from text containing numeric variables
86
- * @param text Original text that may contain numeric variables
87
- * @returns Template extraction result
88
- */
89
- export function extractTemplate(text: string): TemplateExtractResult;
90
- /**
91
- * Translation options
92
- */
93
- export interface TranslationServiceOptions {
94
- senseId: string;
95
- fingerprint?: string;
96
- fromLang?: string;
97
- toLang?: string;
98
- crossTab?: boolean;
99
- crossTabChannelName?: string;
100
- crossTabStorageKeyPrefix?: string;
101
- }
102
- /**
103
- * Cross-tab cache synchronization options for TranslationClient
104
- */
105
- export interface ClientCrossTabOptions {
106
- enabled: boolean;
107
- channelName?: string;
108
- storageKey?: string;
109
- }
110
- export interface TranslationClientConfig {
111
- /** JWT authentication token */
112
- token: string;
113
- /** Translation sense ID */
114
- senseId: string;
115
- /** API base URL (optional, defaults to https://api.hottol.com/laker/) */
116
- baseUrl?: string;
117
- /** Request timeout in milliseconds (optional, defaults to 30000) */
118
- timeout?: number;
119
- /** LRU cache size (optional, defaults to 1000, set to 0 to disable cache) */
120
- cacheSize?: number;
121
- /** Initial fingerprint for personalized translations (optional) */
122
- fingerprint?: string;
123
- /** Enable cross-tab cache synchronization (optional, default: false) */
124
- crossTab?: boolean;
125
- /** Custom cross-tab channel name (optional) */
126
- crossTabChannelName?: string;
127
- /** Custom cross-tab storage key prefix (optional) */
128
- crossTabStorageKeyPrefix?: string;
129
- /** Enable cache (optional, default: true, set false to disable all caching) */
130
- useCache?: boolean;
131
- }
132
- /**
133
- * TranslationClient - Main entry point for Laker Translation SDK
237
+ * Workflow:
238
+ * 1. Check pre-loaded translation pool (provided fingerprint → current fingerprint → common)
239
+ * 2. If found, return immediately from cache
240
+ * 3. If not found, request LLM translation from backend
241
+ * 4. Auto-initialize on first call
134
242
  *
135
- * Features:
136
- * - Automatic cache lookup: preloaded translations → LRU cache → backend request
137
- * - Fingerprint-based personalized translations support
138
- * - Optional cross-browser-tab cache synchronization
139
- * - Lazy initialization: automatically preloads on first use
140
- * - Simple single-level API, no complex layering
141
- */
142
- export class TranslationClient {
143
- private baseUrl;
144
- private token;
145
- private timeout;
146
- private config;
147
- private llmCacheEnabled;
148
- private llmCache;
149
- private pool;
150
- private currentFingerprint;
151
- private initialized;
152
- private initPromise;
153
- private broadcastChannel;
154
- private crossTabOptions;
155
- private storageKey;
156
- /**
157
- * Create a new TranslationClient - the only entry point you need
158
- * @param config Client configuration
159
- */
160
- constructor(config: TranslationClientConfig);
161
- /**
162
- * Initialize cross-tab synchronization via Broadcast Channel
163
- */
164
- private initCrossTabSync;
165
- /**
166
- * Load cache from localStorage
167
- */
168
- private loadFromStorage;
169
- /**
170
- * Save cache to localStorage
171
- */
172
- private saveToStorage;
173
- /**
174
- * Get all cache entries for storage/broadcast
175
- */
176
- private getAllCacheEntries;
177
- /**
178
- * Broadcast full cache to other tabs
179
- */
180
- private broadcastFullCache;
181
- /**
182
- * Broadcast a single cache update to other tabs
183
- */
184
- private broadcastCacheUpdate;
185
- /**
186
- * Set or update the JWT authentication token
187
- * @param token JWT token
188
- */
189
- setToken(token: string): void;
190
- /**
191
- * Enable or disable LLM cache
192
- * @param enabled Whether to enable cache
193
- */
194
- setCacheEnabled(enabled: boolean): void;
195
- /**
196
- * Clear the LLM translation cache (also clears localStorage and broadcasts to other tabs)
197
- */
198
- clearCache(): void;
199
- /**
200
- * Get current LLM cache size
201
- */
202
- getCacheSize(): number;
203
- /**
204
- * Check if cross-tab synchronization is enabled
205
- */
206
- isCrossTabEnabled(): boolean;
207
- /**
208
- 凤 * GetSenseTranslate - One-shot unary request with pagination
209
- * @param request Request parameters
210
- */
211
- getSenseTranslate(request: GetSenseTranslateRequest): Promise<GetSenseTranslateResponse>;
212
- /**
213
- * TranslateStream - Server streaming, receives multiple batches progressively
214
- * @param request Request parameters
215
- * @param onBatch Callback for each batch received. Return false to stop streaming early.
216
- */
217
- translateStream(request: TranslateStreamRequest, onBatch: (response: TranslateStreamResponse) => boolean | void): Promise<void>;
218
- /**
219
- * Collect all streaming responses into an array
220
- * @param request Request parameters
221
- */
222
- translateStreamCollect(request: TranslateStreamRequest): Promise<TranslateStreamResponse[]>;
223
- /**
224
- * LLMTranslate - One-shot large language model translation
225
- * Uses LRU cache to avoid repeated requests for the same text
226
- * With cross-tab enabled, automatically syncs cache across browser tabs
227
- * @param request Translation request
228
- * @param skipCache If true, bypass cache and always request from backend
229
- */
230
- llmTranslate(request: LLMTranslateRequest, skipCache?: boolean): Promise<LLMTranslateResponse>;
231
- /**
232
- * Translate text - this is the main method you need
233
- *
234
- * Workflow:
235
- * 1. Check pre-loaded translation pool (provided fingerprint → current fingerprint → common)
236
- * 2. If found, return immediately from cache
237
- * 3. If not found, request LLM translation from backend
238
- * 4. Auto-initialize on first call
239
- *
240
- * @param text Text to translate
241
- * @param toLang Target language
242
- * @param fromLang Source language (optional, auto-detected if not provided)
243
- * @param fingerprint Optional specific fingerprint for this translation (overrides client-level fingerprint)
244
- * @returns Translated text
245
- */
246
- translate(text: string, toLang: string, fromLang?: string, fingerprint?: string): Promise<string>;
247
- /**
248
- * Translate text with full response details
249
- * @param text Text to translate
250
- * @param toLang Target language
251
- * @param fromLang Source language (optional)
252
- * @param fingerprint Optional specific fingerprint for this translation (overrides client-level fingerprint)
253
- * @returns Full translation response
254
- */
255
- translateWithDetails(text: string, toLang: string, fromLang?: string, fingerprint?: string): Promise<LLMTranslateResponse>;
256
- /**
257
- * Translate without using cache (always request from backend)
258
- * @param text Text to translate
259
- * @param toLang Target language
260
- * @param fromLang Source language (optional)
261
- * @param fingerprint Optional specific fingerprint for this translation
262
- * @returns Translated text
263
- */
264
- translateNoCache(text: string, toLang: string, fromLang?: string, fingerprint?: string): Promise<string>;
265
- /**
266
- * Batch translate multiple texts
267
- * @param texts Array of texts to translate
268
- * @param toLang Target language
269
- * @param fromLang Source language (optional)
270
- * @param fingerprint Optional specific fingerprint for all translations in this batch
271
- * @returns Array of translated texts in same order
272
- */
273
- translateBatch(texts: string[], toLang: string, fromLang?: string, fingerprint?: string): Promise<string[]>;
274
- /**
275
- * Initialize and preload all translations
276
- * Call this to warm up cache before translating
277
- */
278
- preload(): Promise<void>;
279
- /**
280
- * Internal initialization - preloads translations via streaming
281
- */
282
- private initialize;
283
- /**
284
- * Check if service is initialized
285
- */
286
- isInitialized(): boolean;
287
- /**
288
- * Set or change the current fingerprint
289
- * Automatically loads special translations for this fingerprint
290
- * @param fingerprint The fingerprint to use
291
- */
292
- setFingerprint(fingerprint: string): Promise<void>;
293
- /**
294
- * Clear the current fingerprint
295
- * Falls back to common translations
296
- */
297
- clearFingerprint(): void;
298
- /**
299
- * Get the current fingerprint
300
- */
301
- getFingerprint(): string | null;
302
- /**
303
- * Check if cache is enabled
304
- * @returns true if cache is enabled
305
- */
306
- isCacheEnabled(): boolean;
307
- /**
308
- * Check if a translation exists in pre-loaded pool
309
- * @param text Text to check
310
- * @param fingerprint Optional specific fingerprint to check
311
- * @returns true if translation exists in cache
312
- */
313
- hasTranslation(text: string, fingerprint?: string): boolean;
314
- /**
315
- * Get translation from pre-loaded cache without requesting from backend
316
- * @param text Text to look up
317
- * @param fingerprint Optional specific fingerprint to look up
318
- * @returns Translation if found, null otherwise
319
- */
320
- getCached(text: string, fingerprint?: string): string | null;
321
- /**
322
- * Add a custom translation to the pre-loaded pool
323
- * @param text Original text
324
- * @param translation Translated text
325
- * @param fingerprint Optional specific fingerprint to add to
326
- */
327
- addTranslation(text: string, translation: string, fingerprint?: string): void;
328
- /**
329
- * Clear all cached translations
330
- */
331
- clearAllCache(): void;
332
- /**
333
- * Destroy the instance and free resources
334
- * Call this when the instance is no longer needed
335
- */
336
- destroy(): void;
337
- /**
338
- * LLMTranslateStream - Streaming large language model translation
339
- * Note: Streaming requests are not cached
340
- * @param request Translation request
341
- * @param onResponse Callback for each response chunk
342
- */
343
- llmTranslateStream(request: LLMTranslateRequest, onResponse: (response: LLMTranslateResponse) => boolean | void): Promise<void>;
344
- private getHeaders;
345
- private fetchJson;
346
- private fetchWithTimeout;
347
- }
348
- /**
349
- * Create a TranslationClient instance with simplified configuration
350
- * @param token JWT authentication token
351
- * @param senseId Translation sense ID
352
- * @param options Additional options
353
- * @returns TranslationClient instance
354
- */
355
- export function createTranslation(token: string, senseId: string, options?: Partial<TranslationClientConfig>): TranslationClient;
356
- export default createTranslation;
243
+ * @param text Text to translate
244
+ * @param toLang Target language
245
+ * @param fromLang Source language (optional, auto-detected if not provided)
246
+ * @param fingerprint Optional specific fingerprint for this translation (overrides client-level fingerprint)
247
+ * @returns Translated text
248
+ */
249
+ translate(text: string, toLang: string, fromLang?: string, fingerprint?: string): Promise<string>;
250
+ /**
251
+ * Translate text with full response details
252
+ * @param text Text to translate
253
+ * @param toLang Target language
254
+ * @param fromLang Source language (optional)
255
+ * @param fingerprint Optional specific fingerprint for this translation (overrides client-level fingerprint)
256
+ * @returns Full translation response
257
+ */
258
+ translateWithDetails(text: string, toLang: string, fromLang?: string, fingerprint?: string): Promise<LLMTranslateResponse>;
259
+ /**
260
+ * Translate without using cache (always request from backend)
261
+ * @param text Text to translate
262
+ * @param toLang Target language
263
+ * @param fromLang Source language (optional)
264
+ * @param fingerprint Optional specific fingerprint for this translation
265
+ * @returns Translated text
266
+ */
267
+ translateNoCache(text: string, toLang: string, fromLang?: string, fingerprint?: string): Promise<string>;
268
+ /**
269
+ * Batch translate multiple texts
270
+ * @param texts Array of texts to translate
271
+ * @param toLang Target language
272
+ * @param fromLang Source language (optional)
273
+ * @param fingerprint Optional specific fingerprint for all translations in this batch
274
+ * @returns Array of translated texts in same order
275
+ */
276
+ translateBatch(texts: string[], toLang: string, fromLang?: string, fingerprint?: string): Promise<string[]>;
277
+ /**
278
+ * Initialize and preload all translations
279
+ * Call this to warm up cache before translating
280
+ */
281
+ preload(): Promise<void>;
282
+ /**
283
+ * Internal initialization - preloads translations via streaming
284
+ */
285
+ private initialize;
286
+ /**
287
+ * Check if service is initialized
288
+ */
289
+ isInitialized(): boolean;
290
+ /**
291
+ * Set or change the current fingerprint
292
+ * Automatically loads special translations for this fingerprint
293
+ * @param fingerprint The fingerprint to use
294
+ */
295
+ setFingerprint(fingerprint: string): Promise<void>;
296
+ /**
297
+ * Clear the current fingerprint
298
+ * Falls back to common translations
299
+ */
300
+ clearFingerprint(): void;
301
+ /**
302
+ * Get the current fingerprint
303
+ */
304
+ getFingerprint(): string | null;
305
+ /**
306
+ * Check if cache is enabled
307
+ * @returns true if cache is enabled
308
+ */
309
+ isCacheEnabled(): boolean;
310
+ /**
311
+ * Check if a translation exists in pre-loaded pool
312
+ * @param text Text to check
313
+ * @param fingerprint Optional specific fingerprint to check
314
+ * @returns true if translation exists in cache
315
+ */
316
+ hasTranslation(text: string, fingerprint?: string): boolean;
317
+ /**
318
+ * Get translation from pre-loaded cache without requesting from backend
319
+ * @param text Text to look up
320
+ * @param fingerprint Optional specific fingerprint to look up
321
+ * @returns Translation if found, null otherwise
322
+ */
323
+ getCached(text: string, fingerprint?: string): string | null;
324
+ /**
325
+ * Add a custom translation to the pre-loaded pool
326
+ * @param text Original text
327
+ * @param translation Translated text
328
+ * @param fingerprint Optional specific fingerprint to add to
329
+ */
330
+ addTranslation(text: string, translation: string, fingerprint?: string): void;
331
+ /**
332
+ * Clear all cached translations
333
+ */
334
+ clearAllCache(): void;
335
+ /**
336
+ * Destroy the instance and free resources
337
+ * Call this when the instance is no longer needed
338
+ */
339
+ destroy(): void;
340
+ /**
341
+ * LLMTranslateStream - Streaming large language model translation
342
+ * Note: Streaming requests are not cached
343
+ * @param request Translation request
344
+ * @param onResponse Callback for each response chunk
345
+ */
346
+ llmTranslateStream(request: LLMTranslateRequest, onResponse: (response: LLMTranslateResponse) => boolean | void): Promise<void>;
347
+ private getHeaders;
348
+ private fetchJson;
349
+ private fetchWithTimeout;
350
+ /**
351
+ * Get cache statistics for both pre-loaded translations and LLM translations
352
+ * @returns Human-readable cache statistics string
353
+ */
354
+ getStats(): string;
357
355
  }
356
+ /**
357
+ * Create a TranslationClient instance with simplified configuration
358
+ * @param token JWT authentication token
359
+ * @param senseId Translation sense ID
360
+ * @param options Additional options
361
+ * @returns TranslationClient instance
362
+ */
363
+ export declare function createTranslation(token: string, senseId: string, options?: Partial<TranslationClientConfig>): TranslationClient;
364
+ export default createTranslation;