@contentgrowth/llm-service 0.6.96 → 0.6.98

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/llm-service",
3
- "version": "0.6.96",
3
+ "version": "0.6.98",
4
4
  "description": "Unified LLM Service for Content Growth",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -139,7 +139,7 @@ export class GeminiProvider extends BaseLLMProvider {
139
139
  }
140
140
 
141
141
  if (tools && tools.length > 0) {
142
- requestOptions.tools = [{ functionDeclarations: tools.map(t => t.function) }];
142
+ requestOptions.config.tools = [{ functionDeclarations: tools.map(t => t.function) }];
143
143
  }
144
144
 
145
145
  console.log('[GeminiProvider] generateContent request:', JSON.stringify(requestOptions, null, 2));
@@ -180,9 +180,12 @@ export class GeminiProvider extends BaseLLMProvider {
180
180
  // Validate that we have EITHER content OR tool calls
181
181
  if (!textContent && (!toolCalls || toolCalls.length === 0)) {
182
182
  console.error('[GeminiProvider] Model returned empty response (no text, no tool calls)');
183
- console.error('[GeminiProvider] Contents:', JSON.stringify(contents, null, 2));
183
+ console.error('[GeminiProvider] Finish Reason:', candidate.finishReason);
184
+ console.error('[GeminiProvider] Safety Ratings:', JSON.stringify(candidate.safetyRatings, null, 2));
185
+ console.error('[GeminiProvider] Full Candidate:', JSON.stringify(candidate, null, 2));
186
+
184
187
  throw new LLMServiceException(
185
- 'Model returned empty response. This usually means the prompt or schema is confusing the model.',
188
+ `Model returned empty response. Finish Reason: ${candidate.finishReason}.`,
186
189
  500
187
190
  );
188
191
  }
@@ -381,10 +384,19 @@ export class GeminiProvider extends BaseLLMProvider {
381
384
  if (!imagePart || !imagePart.inlineData) {
382
385
  // Fallback: Check if it returned a URI or other format, or just text
383
386
  const textPart = response.candidates?.[0]?.content?.parts?.find(p => p.text);
387
+ const candidate = response.candidates?.[0];
388
+
389
+ console.error('[GeminiProvider] Image generation failed (no image data)');
390
+ if (candidate) {
391
+ console.error('[GeminiProvider] Finish Reason:', candidate.finishReason);
392
+ console.error('[GeminiProvider] Safety Ratings:', JSON.stringify(candidate.safetyRatings, null, 2));
393
+ console.error('[GeminiProvider] Full Candidate:', JSON.stringify(candidate, null, 2));
394
+ }
395
+
384
396
  if (textPart) {
385
397
  console.warn('[GeminiProvider] Model returned text instead of image:', textPart.text);
386
398
  }
387
- throw new Error('No image data in response');
399
+ throw new Error(`No image data in response. Finish Reason: ${candidate?.finishReason}`);
388
400
  }
389
401
 
390
402
  return {
@@ -443,6 +455,7 @@ export class GeminiProvider extends BaseLLMProvider {
443
455
  this._pendingOperations.delete(operationName);
444
456
 
445
457
  if (operation.error) {
458
+ console.error('[GeminiProvider] Video generation failed:', JSON.stringify(operation.error, null, 2));
446
459
  result.error = operation.error;
447
460
  } else {
448
461
  const videoResult = operation.response;