@contentgrowth/llm-service 0.7.7 → 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
|
@@ -16,11 +16,11 @@ export const MODEL_CONFIGS = {
|
|
|
16
16
|
free: 'gpt-4o-mini',
|
|
17
17
|
},
|
|
18
18
|
gemini: {
|
|
19
|
-
default: 'gemini-2.5-flash',
|
|
20
|
-
edge: 'gemini-2.5-pro',
|
|
21
|
-
fast: 'gemini-2.5-flash-lite',
|
|
22
|
-
cost: 'gemini-2.5-flash-lite',
|
|
23
|
-
free: 'gemini-2.0-flash-lite',
|
|
19
|
+
default: 'gemini-3-flash-preview', // 'gemini-2.5-flash',
|
|
20
|
+
edge: 'gemini-3-pro-preview', // 'gemini-2.5-pro',
|
|
21
|
+
fast: 'gemini-3-flash-preview', // 'gemini-2.5-flash-lite',
|
|
22
|
+
cost: 'gemini-3-flash-preview', // 'gemini-2.5-flash-lite',
|
|
23
|
+
free: 'gemini-3-flash-preview', // 'gemini-2.0-flash-lite',
|
|
24
24
|
video: 'veo',
|
|
25
25
|
},
|
|
26
26
|
};
|
|
@@ -113,12 +113,29 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
113
113
|
break;
|
|
114
114
|
case 'assistant':
|
|
115
115
|
role = 'model';
|
|
116
|
+
parts = [];
|
|
117
|
+
|
|
118
|
+
// Always include text if present (Thought)
|
|
119
|
+
if (msg.content) {
|
|
120
|
+
parts.push({ text: msg.content });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Append tool calls if present (Call)
|
|
116
124
|
if (msg.tool_calls) {
|
|
117
|
-
|
|
125
|
+
const callParts = msg.tool_calls.map(tc => ({
|
|
118
126
|
functionCall: { name: tc.function.name, args: tc.function.arguments }
|
|
119
127
|
}));
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
parts.push(...callParts);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Safety fallback: if nothing was added, ensure valid structure
|
|
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)
|
|
122
139
|
}
|
|
123
140
|
break;
|
|
124
141
|
case 'tool':
|