@contentgrowth/llm-service 1.4.1 → 1.4.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
@@ -360,11 +360,14 @@ declare class LLMService {
360
360
  getVideoGenerationStatus(operationName: any, tenantId: any): Promise<any>;
361
361
  /**
362
362
  * Generate an image
363
- * Falls back to system keys if tenant doesn't have image capability enabled
363
+ *
364
+ * Note: The caller (backend) is responsible for capability checks and routing.
365
+ * This method simply delegates to the configured provider.
366
+ *
364
367
  * @param {string} prompt - Text description of the image
365
368
  * @param {string} tenantId - Tenant identifier
366
369
  * @param {string} systemPrompt - System instructions for generation
367
- * @param {Object} options - Generation options (aspectRatio, images, etc.)
370
+ * @param {Object} options - Generation options (aspectRatio, images, model, etc.)
368
371
  */
369
372
  imageGeneration(prompt: string, tenantId: string, systemPrompt: string, options?: any): Promise<any>;
370
373
  /**
package/dist/index.d.ts CHANGED
@@ -360,11 +360,14 @@ declare class LLMService {
360
360
  getVideoGenerationStatus(operationName: any, tenantId: any): Promise<any>;
361
361
  /**
362
362
  * Generate an image
363
- * Falls back to system keys if tenant doesn't have image capability enabled
363
+ *
364
+ * Note: The caller (backend) is responsible for capability checks and routing.
365
+ * This method simply delegates to the configured provider.
366
+ *
364
367
  * @param {string} prompt - Text description of the image
365
368
  * @param {string} tenantId - Tenant identifier
366
369
  * @param {string} systemPrompt - System instructions for generation
367
- * @param {Object} options - Generation options (aspectRatio, images, etc.)
370
+ * @param {Object} options - Generation options (aspectRatio, images, model, etc.)
368
371
  */
369
372
  imageGeneration(prompt: string, tenantId: string, systemPrompt: string, options?: any): Promise<any>;
370
373
  /**
package/dist/index.js CHANGED
@@ -1690,14 +1690,18 @@ var LLMService = class {
1690
1690
  if (this.providerCache.has(cacheKey)) {
1691
1691
  return this.providerCache.get(cacheKey);
1692
1692
  }
1693
- const config = await ConfigManager.getConfig(tenantId, this.env);
1694
- if (!config.apiKey && config.provider !== "vertex") {
1693
+ const configOptions = {};
1694
+ if (this._ptalkTaskType) {
1695
+ configOptions.capability = this._ptalkTaskType;
1696
+ }
1697
+ const config = await ConfigManager.getConfig(tenantId, this.env, configOptions);
1698
+ if (!config.apiKey && config.provider !== "vertex" && config.provider !== "google") {
1695
1699
  throw new LLMServiceException(`LLM service is not configured for ${config.provider}. Missing API Key.`, 500);
1696
1700
  }
1697
1701
  let provider;
1698
1702
  if (config.provider === "openai") {
1699
1703
  provider = new OpenAIProvider(config);
1700
- } else if (config.provider === "gemini" || config.provider === "vertex") {
1704
+ } else if (config.provider === "gemini" || config.provider === "vertex" || config.provider === "google") {
1701
1705
  provider = new GoogleProvider(config);
1702
1706
  } else if (config.provider === "anthropic") {
1703
1707
  provider = new AnthropicProvider(config);
@@ -1877,21 +1881,16 @@ var LLMService = class {
1877
1881
  }
1878
1882
  /**
1879
1883
  * Generate an image
1880
- * Falls back to system keys if tenant doesn't have image capability enabled
1884
+ *
1885
+ * Note: The caller (backend) is responsible for capability checks and routing.
1886
+ * This method simply delegates to the configured provider.
1887
+ *
1881
1888
  * @param {string} prompt - Text description of the image
1882
1889
  * @param {string} tenantId - Tenant identifier
1883
1890
  * @param {string} systemPrompt - System instructions for generation
1884
- * @param {Object} options - Generation options (aspectRatio, images, etc.)
1891
+ * @param {Object} options - Generation options (aspectRatio, images, model, etc.)
1885
1892
  */
1886
1893
  async imageGeneration(prompt, tenantId, systemPrompt, options = {}) {
1887
- var _a;
1888
- if (tenantId) {
1889
- const config = await ConfigManager.getConfig(tenantId, this.env);
1890
- if (config.isTenantOwned && !((_a = config.capabilities) == null ? void 0 : _a.image)) {
1891
- console.log(`[LLMService] Tenant ${tenantId} BYOK doesn't have image capability. Using system keys.`);
1892
- tenantId = null;
1893
- }
1894
- }
1895
1894
  const provider = await this._getProvider(tenantId);
1896
1895
  return provider.imageGeneration(prompt, systemPrompt, options);
1897
1896
  }