@contentgrowth/llm-service 1.3.4 → 1.3.5
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.cjs +48 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
LLMService: () => LLMService,
|
|
43
43
|
LLMServiceException: () => LLMServiceException,
|
|
44
44
|
MODEL_CONFIGS: () => MODEL_CONFIGS,
|
|
45
|
+
Modality: () => import_genai2.Modality,
|
|
45
46
|
OpenAIProvider: () => OpenAIProvider,
|
|
46
47
|
TranscriptionService: () => TranscriptionService,
|
|
47
48
|
TranscriptionServiceException: () => TranscriptionServiceException,
|
|
@@ -432,6 +433,13 @@ var BaseLLMProvider = class {
|
|
|
432
433
|
async extractWithLLM(fileData, mimeType, prompt, schema, options) {
|
|
433
434
|
throw new Error("This provider does not support extractWithLLM (Multimodal extraction)");
|
|
434
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Connect to a bidirectional real-time Live session
|
|
438
|
+
* @param {Object} options - { model, config, callbacks }
|
|
439
|
+
*/
|
|
440
|
+
async connectLive(options) {
|
|
441
|
+
throw new Error(`This provider (${this.constructor.name}) does not support live real-time sessions`);
|
|
442
|
+
}
|
|
435
443
|
/**
|
|
436
444
|
* Helper to get the last 6 digits of the API key for logging.
|
|
437
445
|
* @returns {string} "..." + last 6 chars, or "not_set"
|
|
@@ -1355,6 +1363,27 @@ ${prompt}` : prompt;
|
|
|
1355
1363
|
throw error;
|
|
1356
1364
|
}
|
|
1357
1365
|
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Connect to Gemini Live bidirectional real-time audio/text session
|
|
1368
|
+
*
|
|
1369
|
+
* @param {Object} options
|
|
1370
|
+
* @param {string} [options.model] - Model name (e.g. models/gemini-2.5-flash-native-audio-preview-09-2025)
|
|
1371
|
+
* @param {Object} options.config - Live session configuration
|
|
1372
|
+
* @param {Object} options.callbacks - Event callbacks (onopen, onmessage, onerror, onclose)
|
|
1373
|
+
* @returns {Promise<any>} The active Live session
|
|
1374
|
+
*/
|
|
1375
|
+
async connectLive({ model, config, callbacks }) {
|
|
1376
|
+
var _a, _b, _c;
|
|
1377
|
+
if (!((_b = (_a = this.client) == null ? void 0 : _a.live) == null ? void 0 : _b.connect)) {
|
|
1378
|
+
throw new LLMServiceException("The configured Google provider SDK does not support live sessions.", 500);
|
|
1379
|
+
}
|
|
1380
|
+
const resolvedModel = model || ((_c = this.models) == null ? void 0 : _c.live) || this.defaultModel || "models/gemini-2.5-flash-native-audio-preview-09-2025";
|
|
1381
|
+
return this.client.live.connect({
|
|
1382
|
+
model: resolvedModel,
|
|
1383
|
+
config,
|
|
1384
|
+
callbacks
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1358
1387
|
};
|
|
1359
1388
|
|
|
1360
1389
|
// src/llm/providers/anthropic-provider.js
|
|
@@ -1887,6 +1916,21 @@ var LLMService = class {
|
|
|
1887
1916
|
}
|
|
1888
1917
|
return provider.extractWithLLM(fileData, mimeType, prompt, schema, options);
|
|
1889
1918
|
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Connect to a bidirectional real-time Live session
|
|
1921
|
+
*
|
|
1922
|
+
* @param {Object} params - { model, config, callbacks }
|
|
1923
|
+
* @param {string|null} [tenantId] - Tenant ID
|
|
1924
|
+
* @returns {Promise<any>} The active Live session
|
|
1925
|
+
*/
|
|
1926
|
+
async connectLive(params, tenantId = null) {
|
|
1927
|
+
var _a;
|
|
1928
|
+
const provider = await this._getProvider(tenantId);
|
|
1929
|
+
if (typeof provider.connectLive !== "function") {
|
|
1930
|
+
throw new LLMServiceException(`Provider ${((_a = provider.config) == null ? void 0 : _a.provider) || provider.constructor.name} does not support live real-time sessions`, 400);
|
|
1931
|
+
}
|
|
1932
|
+
return provider.connectLive(params);
|
|
1933
|
+
}
|
|
1890
1934
|
};
|
|
1891
1935
|
var LLMServiceException = class extends Error {
|
|
1892
1936
|
constructor(message, statusCode = 500, details = null) {
|
|
@@ -2221,6 +2265,9 @@ function createSpeechHandler(app, getConfig) {
|
|
|
2221
2265
|
});
|
|
2222
2266
|
return app;
|
|
2223
2267
|
}
|
|
2268
|
+
|
|
2269
|
+
// src/index.js
|
|
2270
|
+
var import_genai2 = require("@google/genai");
|
|
2224
2271
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2225
2272
|
0 && (module.exports = {
|
|
2226
2273
|
AnthropicProvider,
|
|
@@ -2234,6 +2281,7 @@ function createSpeechHandler(app, getConfig) {
|
|
|
2234
2281
|
LLMService,
|
|
2235
2282
|
LLMServiceException,
|
|
2236
2283
|
MODEL_CONFIGS,
|
|
2284
|
+
Modality,
|
|
2237
2285
|
OpenAIProvider,
|
|
2238
2286
|
TranscriptionService,
|
|
2239
2287
|
TranscriptionServiceException,
|