@contentgrowth/llm-service 1.3.1 → 1.3.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.
package/dist/index.d.cts CHANGED
@@ -61,6 +61,13 @@ declare class BaseLLMProvider {
61
61
  imageData: string;
62
62
  mimeType: string;
63
63
  }>;
64
+ /**
65
+ * Text-to-Speech synthesis
66
+ * @param {string} text - Text to synthesize
67
+ * @param {Object} options - TTS options (voice, model, etc.)
68
+ * @returns {Promise<Buffer>} Audio data as Buffer
69
+ */
70
+ textToSpeech(text: string, options?: any): Promise<Buffer>;
64
71
  /**
65
72
  * Start video generation (returns operation name for polling)
66
73
  * @param {string} prompt
@@ -344,6 +351,14 @@ declare class LLMService {
344
351
  * @param {Object} options - Generation options (aspectRatio, images, etc.)
345
352
  */
346
353
  imageGeneration(prompt: string, tenantId: string, systemPrompt: string, options?: any): Promise<any>;
354
+ /**
355
+ * Text-to-Speech synthesis
356
+ * @param {string} text - Text to synthesize
357
+ * @param {string} tenantId - Tenant identifier
358
+ * @param {Object} options - TTS options (voice, model, etc.)
359
+ * @returns {Promise<Buffer>} Audio data as Buffer
360
+ */
361
+ textToSpeech(text: string, tenantId: string, options?: any): Promise<Buffer>;
347
362
  /**
348
363
  * Start a Deep Research task
349
364
  * @param {string} prompt - Research prompt/query
package/dist/index.d.ts CHANGED
@@ -61,6 +61,13 @@ declare class BaseLLMProvider {
61
61
  imageData: string;
62
62
  mimeType: string;
63
63
  }>;
64
+ /**
65
+ * Text-to-Speech synthesis
66
+ * @param {string} text - Text to synthesize
67
+ * @param {Object} options - TTS options (voice, model, etc.)
68
+ * @returns {Promise<Buffer>} Audio data as Buffer
69
+ */
70
+ textToSpeech(text: string, options?: any): Promise<Buffer>;
64
71
  /**
65
72
  * Start video generation (returns operation name for polling)
66
73
  * @param {string} prompt
@@ -344,6 +351,14 @@ declare class LLMService {
344
351
  * @param {Object} options - Generation options (aspectRatio, images, etc.)
345
352
  */
346
353
  imageGeneration(prompt: string, tenantId: string, systemPrompt: string, options?: any): Promise<any>;
354
+ /**
355
+ * Text-to-Speech synthesis
356
+ * @param {string} text - Text to synthesize
357
+ * @param {string} tenantId - Tenant identifier
358
+ * @param {Object} options - TTS options (voice, model, etc.)
359
+ * @returns {Promise<Buffer>} Audio data as Buffer
360
+ */
361
+ textToSpeech(text: string, tenantId: string, options?: any): Promise<Buffer>;
347
362
  /**
348
363
  * Start a Deep Research task
349
364
  * @param {string} prompt - Research prompt/query
package/dist/index.js CHANGED
@@ -291,6 +291,15 @@ var BaseLLMProvider = class {
291
291
  async imageGeneration(prompt, systemPrompt, options = {}) {
292
292
  throw new Error("Image generation not supported by this provider");
293
293
  }
294
+ /**
295
+ * Text-to-Speech synthesis
296
+ * @param {string} text - Text to synthesize
297
+ * @param {Object} options - TTS options (voice, model, etc.)
298
+ * @returns {Promise<Buffer>} Audio data as Buffer
299
+ */
300
+ async textToSpeech(text, options = {}) {
301
+ throw new Error("Text-to-speech not supported by this provider");
302
+ }
294
303
  /**
295
304
  * Start video generation (returns operation name for polling)
296
305
  * @param {string} prompt
@@ -952,13 +961,21 @@ ${msg.content}`;
952
961
  const tool = toolImplementations[toolName];
953
962
  const tool_call_id = `gemini-tool-call-${index}`;
954
963
  toolCall.id = tool_call_id;
955
- console.log(`[Tool Call] > ${toolName}:`, JSON.stringify(toolCall.function.args));
964
+ let toolArgs = toolCall.function.args;
965
+ if (toolArgs === void 0 && toolCall.function.arguments) {
966
+ try {
967
+ toolArgs = typeof toolCall.function.arguments === "string" ? JSON.parse(toolCall.function.arguments) : toolCall.function.arguments;
968
+ } catch (e) {
969
+ toolArgs = {};
970
+ }
971
+ }
972
+ console.log(`[Tool Call] > ${toolName}:`, JSON.stringify(toolArgs));
956
973
  if (!tool) {
957
974
  console.error(`[Tool Error] Tool '${toolName}' not found`);
958
975
  return { tool_call_id, output: JSON.stringify({ error: `Tool '${toolName}' not found.` }) };
959
976
  }
960
977
  try {
961
- const output = await tool(toolCall.function.args, { env, tenantId });
978
+ const output = await tool(toolArgs, { env, tenantId });
962
979
  const preview = typeof output === "string" ? output.length > 200 ? output.substring(0, 200) + "..." : output : JSON.stringify(output).substring(0, 200) + "...";
963
980
  console.log(`[Tool Result] < ${toolName}: ${preview}`);
964
981
  return { tool_call_id, output };
@@ -1687,6 +1704,17 @@ var LLMService = class {
1687
1704
  const provider = await this._getProvider(tenantId);
1688
1705
  return provider.imageGeneration(prompt, systemPrompt, options);
1689
1706
  }
1707
+ /**
1708
+ * Text-to-Speech synthesis
1709
+ * @param {string} text - Text to synthesize
1710
+ * @param {string} tenantId - Tenant identifier
1711
+ * @param {Object} options - TTS options (voice, model, etc.)
1712
+ * @returns {Promise<Buffer>} Audio data as Buffer
1713
+ */
1714
+ async textToSpeech(text, tenantId, options = {}) {
1715
+ const provider = await this._getProvider(tenantId);
1716
+ return provider.textToSpeech(text, options);
1717
+ }
1690
1718
  /**
1691
1719
  * Start a Deep Research task
1692
1720
  * @param {string} prompt - Research prompt/query