@contentgrowth/llm-service 0.7.8 → 0.7.9
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
|
@@ -114,12 +114,12 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
114
114
|
case 'assistant':
|
|
115
115
|
role = 'model';
|
|
116
116
|
parts = [];
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
// Always include text if present (Thought)
|
|
119
119
|
if (msg.content) {
|
|
120
120
|
parts.push({ text: msg.content });
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
// Append tool calls if present (Call)
|
|
124
124
|
if (msg.tool_calls) {
|
|
125
125
|
const callParts = msg.tool_calls.map(tc => ({
|
|
@@ -127,10 +127,15 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
127
127
|
}));
|
|
128
128
|
parts.push(...callParts);
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
// Safety fallback: if nothing was added, ensure valid structure
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
// CRITICAL: Newer Gemini models (and SDK 1.34+) REQUIRE a non-empty thought_signature (text)
|
|
133
|
+
// before a function call. If we have tool calls but no content, we must fabricate one.
|
|
134
|
+
const hasText = parts.some(p => p.text);
|
|
135
|
+
if (!hasText && msg.tool_calls) {
|
|
136
|
+
parts.unshift({ text: "Processing tool execution..." });
|
|
137
|
+
} else if (parts.length === 0) {
|
|
138
|
+
parts.push({ text: "" }); // Fallback for truly empty message (shouldn't happen)
|
|
134
139
|
}
|
|
135
140
|
break;
|
|
136
141
|
case 'tool':
|