@contentgrowth/llm-service 1.3.4 → 1.3.6

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.
package/dist/index.d.cts CHANGED
@@ -2,6 +2,7 @@ import OpenAI from 'openai';
2
2
  import Anthropic from '@anthropic-ai/sdk';
3
3
  import * as _google_genai from '@google/genai';
4
4
  import { GoogleGenAI } from '@google/genai';
5
+ export { Modality } from '@google/genai';
5
6
 
6
7
  declare namespace FINISH_REASONS {
7
8
  let COMPLETED: string;
@@ -101,6 +102,11 @@ declare class BaseLLMProvider {
101
102
  * @param {Object} options - Options
102
103
  */
103
104
  extractWithLLM(fileData: Buffer | string, mimeType: string, prompt: string, schema: any, options: any): Promise<void>;
105
+ /**
106
+ * Connect to a bidirectional real-time Live session
107
+ * @param {Object} options - { model, config, callbacks }
108
+ */
109
+ connectLive(options: any): Promise<void>;
104
110
  /**
105
111
  * Helper to get the last 6 digits of the API key for logging.
106
112
  * @returns {string} "..." + last 6 chars, or "not_set"
@@ -401,6 +407,14 @@ declare class LLMService {
401
407
  * @returns {Promise<any>} Extracted data
402
408
  */
403
409
  extractWithLLM(fileData: Buffer | string, mimeType: string, prompt: string, tenantId: string | null, schema?: any | null, options?: any): Promise<any>;
410
+ /**
411
+ * Connect to a bidirectional real-time Live session
412
+ *
413
+ * @param {Object} params - { model, config, callbacks }
414
+ * @param {string|null} [tenantId] - Tenant ID
415
+ * @returns {Promise<any>} The active Live session
416
+ */
417
+ connectLive(params: any, tenantId?: string | null): Promise<any>;
404
418
  }
405
419
  declare class LLMServiceException extends Error {
406
420
  constructor(message: any, statusCode?: number, details?: any);
@@ -511,6 +525,8 @@ declare namespace MODEL_CONFIGS {
511
525
  export { cost_1 as cost };
512
526
  let free_1: string;
513
527
  export { free_1 as free };
528
+ export let live: string;
529
+ export let liveThinking: string;
514
530
  export let video: string;
515
531
  export let image: string;
516
532
  }
@@ -525,6 +541,10 @@ declare namespace MODEL_CONFIGS {
525
541
  export { cost_2 as cost };
526
542
  let free_2: string;
527
543
  export { free_2 as free };
544
+ let live_1: string;
545
+ export { live_1 as live };
546
+ let liveThinking_1: string;
547
+ export { liveThinking_1 as liveThinking };
528
548
  let video_1: string;
529
549
  export { video_1 as video };
530
550
  let image_1: string;
@@ -698,6 +718,20 @@ declare class GoogleProvider extends BaseLLMProvider {
698
718
  voice: string;
699
719
  model: string;
700
720
  }): Promise<Buffer>;
721
+ /**
722
+ * Connect to Gemini Live bidirectional real-time audio/text session
723
+ *
724
+ * @param {Object} options
725
+ * @param {string} [options.model] - Model name (e.g. models/gemini-2.5-flash-native-audio-preview-09-2025)
726
+ * @param {Object} options.config - Live session configuration
727
+ * @param {Object} options.callbacks - Event callbacks (onopen, onmessage, onerror, onclose)
728
+ * @returns {Promise<any>} The active Live session
729
+ */
730
+ connectLive({ model, config, callbacks }: {
731
+ model?: string;
732
+ config: any;
733
+ callbacks: any;
734
+ }): Promise<any>;
701
735
  }
702
736
 
703
737
  /**
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import OpenAI from 'openai';
2
2
  import Anthropic from '@anthropic-ai/sdk';
3
3
  import * as _google_genai from '@google/genai';
4
4
  import { GoogleGenAI } from '@google/genai';
5
+ export { Modality } from '@google/genai';
5
6
 
6
7
  declare namespace FINISH_REASONS {
7
8
  let COMPLETED: string;
@@ -101,6 +102,11 @@ declare class BaseLLMProvider {
101
102
  * @param {Object} options - Options
102
103
  */
103
104
  extractWithLLM(fileData: Buffer | string, mimeType: string, prompt: string, schema: any, options: any): Promise<void>;
105
+ /**
106
+ * Connect to a bidirectional real-time Live session
107
+ * @param {Object} options - { model, config, callbacks }
108
+ */
109
+ connectLive(options: any): Promise<void>;
104
110
  /**
105
111
  * Helper to get the last 6 digits of the API key for logging.
106
112
  * @returns {string} "..." + last 6 chars, or "not_set"
@@ -401,6 +407,14 @@ declare class LLMService {
401
407
  * @returns {Promise<any>} Extracted data
402
408
  */
403
409
  extractWithLLM(fileData: Buffer | string, mimeType: string, prompt: string, tenantId: string | null, schema?: any | null, options?: any): Promise<any>;
410
+ /**
411
+ * Connect to a bidirectional real-time Live session
412
+ *
413
+ * @param {Object} params - { model, config, callbacks }
414
+ * @param {string|null} [tenantId] - Tenant ID
415
+ * @returns {Promise<any>} The active Live session
416
+ */
417
+ connectLive(params: any, tenantId?: string | null): Promise<any>;
404
418
  }
405
419
  declare class LLMServiceException extends Error {
406
420
  constructor(message: any, statusCode?: number, details?: any);
@@ -511,6 +525,8 @@ declare namespace MODEL_CONFIGS {
511
525
  export { cost_1 as cost };
512
526
  let free_1: string;
513
527
  export { free_1 as free };
528
+ export let live: string;
529
+ export let liveThinking: string;
514
530
  export let video: string;
515
531
  export let image: string;
516
532
  }
@@ -525,6 +541,10 @@ declare namespace MODEL_CONFIGS {
525
541
  export { cost_2 as cost };
526
542
  let free_2: string;
527
543
  export { free_2 as free };
544
+ let live_1: string;
545
+ export { live_1 as live };
546
+ let liveThinking_1: string;
547
+ export { liveThinking_1 as liveThinking };
528
548
  let video_1: string;
529
549
  export { video_1 as video };
530
550
  let image_1: string;
@@ -698,6 +718,20 @@ declare class GoogleProvider extends BaseLLMProvider {
698
718
  voice: string;
699
719
  model: string;
700
720
  }): Promise<Buffer>;
721
+ /**
722
+ * Connect to Gemini Live bidirectional real-time audio/text session
723
+ *
724
+ * @param {Object} options
725
+ * @param {string} [options.model] - Model name (e.g. models/gemini-2.5-flash-native-audio-preview-09-2025)
726
+ * @param {Object} options.config - Live session configuration
727
+ * @param {Object} options.callbacks - Event callbacks (onopen, onmessage, onerror, onclose)
728
+ * @returns {Promise<any>} The active Live session
729
+ */
730
+ connectLive({ model, config, callbacks }: {
731
+ model?: string;
732
+ config: any;
733
+ callbacks: any;
734
+ }): Promise<any>;
701
735
  }
702
736
 
703
737
  /**
package/dist/index.js CHANGED
@@ -193,6 +193,8 @@ var MODEL_CONFIGS = {
193
193
  fast: "gemini-3.8-flash",
194
194
  cost: "gemini-3.5-flash-lite",
195
195
  free: "gemini-3.5-flash-lite",
196
+ live: "gemini-3.8-live",
197
+ liveThinking: "gemini-3.8-live-extended-thinking",
196
198
  video: "veo",
197
199
  image: "gemini-3-pro-image"
198
200
  },
@@ -203,6 +205,8 @@ var MODEL_CONFIGS = {
203
205
  fast: "gemini-3.7-flash",
204
206
  cost: "gemini-3.5-flash-lite",
205
207
  free: "gemini-3.5-flash-lite",
208
+ live: "gemini-3.8-live",
209
+ liveThinking: "gemini-3.8-live-extended-thinking",
206
210
  video: "veo",
207
211
  image: "gemini-3.1-flash-image"
208
212
  },
@@ -379,6 +383,13 @@ var BaseLLMProvider = class {
379
383
  async extractWithLLM(fileData, mimeType, prompt, schema, options) {
380
384
  throw new Error("This provider does not support extractWithLLM (Multimodal extraction)");
381
385
  }
386
+ /**
387
+ * Connect to a bidirectional real-time Live session
388
+ * @param {Object} options - { model, config, callbacks }
389
+ */
390
+ async connectLive(options) {
391
+ throw new Error(`This provider (${this.constructor.name}) does not support live real-time sessions`);
392
+ }
382
393
  /**
383
394
  * Helper to get the last 6 digits of the API key for logging.
384
395
  * @returns {string} "..." + last 6 chars, or "not_set"
@@ -1302,6 +1313,27 @@ ${prompt}` : prompt;
1302
1313
  throw error;
1303
1314
  }
1304
1315
  }
1316
+ /**
1317
+ * Connect to Gemini Live bidirectional real-time audio/text session
1318
+ *
1319
+ * @param {Object} options
1320
+ * @param {string} [options.model] - Model name (e.g. models/gemini-2.5-flash-native-audio-preview-09-2025)
1321
+ * @param {Object} options.config - Live session configuration
1322
+ * @param {Object} options.callbacks - Event callbacks (onopen, onmessage, onerror, onclose)
1323
+ * @returns {Promise<any>} The active Live session
1324
+ */
1325
+ async connectLive({ model, config, callbacks }) {
1326
+ var _a, _b, _c;
1327
+ if (!((_b = (_a = this.client) == null ? void 0 : _a.live) == null ? void 0 : _b.connect)) {
1328
+ throw new LLMServiceException("The configured Google provider SDK does not support live sessions.", 500);
1329
+ }
1330
+ const resolvedModel = model || ((_c = this.models) == null ? void 0 : _c.live) || "gemini-3.8-live";
1331
+ return this.client.live.connect({
1332
+ model: resolvedModel,
1333
+ config,
1334
+ callbacks
1335
+ });
1336
+ }
1305
1337
  };
1306
1338
 
1307
1339
  // src/llm/providers/anthropic-provider.js
@@ -1834,6 +1866,21 @@ var LLMService = class {
1834
1866
  }
1835
1867
  return provider.extractWithLLM(fileData, mimeType, prompt, schema, options);
1836
1868
  }
1869
+ /**
1870
+ * Connect to a bidirectional real-time Live session
1871
+ *
1872
+ * @param {Object} params - { model, config, callbacks }
1873
+ * @param {string|null} [tenantId] - Tenant ID
1874
+ * @returns {Promise<any>} The active Live session
1875
+ */
1876
+ async connectLive(params, tenantId = null) {
1877
+ var _a;
1878
+ const provider = await this._getProvider(tenantId);
1879
+ if (typeof provider.connectLive !== "function") {
1880
+ throw new LLMServiceException(`Provider ${((_a = provider.config) == null ? void 0 : _a.provider) || provider.constructor.name} does not support live real-time sessions`, 400);
1881
+ }
1882
+ return provider.connectLive(params);
1883
+ }
1837
1884
  };
1838
1885
  var LLMServiceException = class extends Error {
1839
1886
  constructor(message, statusCode = 500, details = null) {
@@ -2168,6 +2215,9 @@ function createSpeechHandler(app, getConfig) {
2168
2215
  });
2169
2216
  return app;
2170
2217
  }
2218
+
2219
+ // src/index.js
2220
+ import { Modality } from "@google/genai";
2171
2221
  export {
2172
2222
  AnthropicProvider,
2173
2223
  BaseConfigProvider,
@@ -2180,6 +2230,7 @@ export {
2180
2230
  LLMService,
2181
2231
  LLMServiceException,
2182
2232
  MODEL_CONFIGS,
2233
+ Modality,
2183
2234
  OpenAIProvider,
2184
2235
  TranscriptionService,
2185
2236
  TranscriptionServiceException,