@contentgrowth/llm-service 0.8.2 → 0.8.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/package.json
CHANGED
|
@@ -115,7 +115,8 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
115
115
|
role = 'model';
|
|
116
116
|
|
|
117
117
|
// Find if this is the LAST assistant message in the conversation
|
|
118
|
-
//
|
|
118
|
+
// Text messages: only the last one should carry thought_signature (cumulative state)
|
|
119
|
+
// Tool calls: ALL must carry their signatures (model requirement for function calls)
|
|
119
120
|
const isLastAssistantMessage = index === geminiMessages.map((m, i) => m.role === 'assistant' ? i : -1).filter(i => i >= 0).pop();
|
|
120
121
|
|
|
121
122
|
if (msg.tool_calls) {
|
|
@@ -123,8 +124,9 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
123
124
|
const part = {
|
|
124
125
|
functionCall: { name: tc.function.name, args: tc.function.arguments || tc.function.args }
|
|
125
126
|
};
|
|
126
|
-
//
|
|
127
|
-
|
|
127
|
+
// IMPORTANT: Always attach signatures for ALL tool calls in history
|
|
128
|
+
// The model requires thought_signature on every functionCall part
|
|
129
|
+
if (tc.thought_signature) {
|
|
128
130
|
console.log(`[GeminiProvider] Sending thought_signature in tool_call (${tc.thought_signature.length} chars)`);
|
|
129
131
|
part.thoughtSignature = tc.thought_signature; // camelCase for SDK
|
|
130
132
|
}
|
|
@@ -133,7 +135,7 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
133
135
|
} else {
|
|
134
136
|
// Handle text content with optional thought signature
|
|
135
137
|
const part = { text: msg.content || '' };
|
|
136
|
-
// Only attach signature for the last assistant message
|
|
138
|
+
// Only attach signature for the last assistant message (text messages only)
|
|
137
139
|
if (isLastAssistantMessage && msg.thought_signature) {
|
|
138
140
|
console.log(`[GeminiProvider] Sending thought_signature in text message (${msg.thought_signature.length} chars)`);
|
|
139
141
|
part.thoughtSignature = msg.thought_signature;
|