@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.cjs CHANGED
@@ -1744,14 +1744,18 @@ var LLMService = class {
1744
1744
  if (this.providerCache.has(cacheKey)) {
1745
1745
  return this.providerCache.get(cacheKey);
1746
1746
  }
1747
- const config = await ConfigManager.getConfig(tenantId, this.env);
1748
- if (!config.apiKey && config.provider !== "vertex") {
1747
+ const configOptions = {};
1748
+ if (this._ptalkTaskType) {
1749
+ configOptions.capability = this._ptalkTaskType;
1750
+ }
1751
+ const config = await ConfigManager.getConfig(tenantId, this.env, configOptions);
1752
+ if (!config.apiKey && config.provider !== "vertex" && config.provider !== "google") {
1749
1753
  throw new LLMServiceException(`LLM service is not configured for ${config.provider}. Missing API Key.`, 500);
1750
1754
  }
1751
1755
  let provider;
1752
1756
  if (config.provider === "openai") {
1753
1757
  provider = new OpenAIProvider(config);
1754
- } else if (config.provider === "gemini" || config.provider === "vertex") {
1758
+ } else if (config.provider === "gemini" || config.provider === "vertex" || config.provider === "google") {
1755
1759
  provider = new GoogleProvider(config);
1756
1760
  } else if (config.provider === "anthropic") {
1757
1761
  provider = new AnthropicProvider(config);
@@ -1931,21 +1935,16 @@ var LLMService = class {
1931
1935
  }
1932
1936
  /**
1933
1937
  * Generate an image
1934
- * Falls back to system keys if tenant doesn't have image capability enabled
1938
+ *
1939
+ * Note: The caller (backend) is responsible for capability checks and routing.
1940
+ * This method simply delegates to the configured provider.
1941
+ *
1935
1942
  * @param {string} prompt - Text description of the image
1936
1943
  * @param {string} tenantId - Tenant identifier
1937
1944
  * @param {string} systemPrompt - System instructions for generation
1938
- * @param {Object} options - Generation options (aspectRatio, images, etc.)
1945
+ * @param {Object} options - Generation options (aspectRatio, images, model, etc.)
1939
1946
  */
1940
1947
  async imageGeneration(prompt, tenantId, systemPrompt, options = {}) {
1941
- var _a;
1942
- if (tenantId) {
1943
- const config = await ConfigManager.getConfig(tenantId, this.env);
1944
- if (config.isTenantOwned && !((_a = config.capabilities) == null ? void 0 : _a.image)) {
1945
- console.log(`[LLMService] Tenant ${tenantId} BYOK doesn't have image capability. Using system keys.`);
1946
- tenantId = null;
1947
- }
1948
- }
1949
1948
  const provider = await this._getProvider(tenantId);
1950
1949
  return provider.imageGeneration(prompt, systemPrompt, options);
1951
1950
  }