@jaypie/llm 1.2.16 → 1.2.17
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/cjs/index.cjs
CHANGED
|
@@ -1681,6 +1681,11 @@ class GeminiAdapter extends BaseProviderAdapter {
|
|
|
1681
1681
|
name: functionCall.name || "",
|
|
1682
1682
|
arguments: functionCall.args || {},
|
|
1683
1683
|
};
|
|
1684
|
+
// Preserve thoughtSignature for Gemini 3 models
|
|
1685
|
+
// Required to maintain tool call context between turns
|
|
1686
|
+
const metadata = part.thoughtSignature
|
|
1687
|
+
? { thoughtSignature: part.thoughtSignature }
|
|
1688
|
+
: undefined;
|
|
1684
1689
|
// Emit the function call immediately
|
|
1685
1690
|
yield {
|
|
1686
1691
|
type: exports.LlmStreamChunkType.ToolCall,
|
|
@@ -1688,6 +1693,7 @@ class GeminiAdapter extends BaseProviderAdapter {
|
|
|
1688
1693
|
id: currentFunctionCall.id,
|
|
1689
1694
|
name: currentFunctionCall.name,
|
|
1690
1695
|
arguments: JSON.stringify(currentFunctionCall.arguments),
|
|
1696
|
+
metadata,
|
|
1691
1697
|
},
|
|
1692
1698
|
};
|
|
1693
1699
|
currentFunctionCall = null;
|
|
@@ -2374,6 +2380,9 @@ class OpenAiAdapter extends BaseProviderAdapter {
|
|
|
2374
2380
|
id: currentFunctionCall.callId,
|
|
2375
2381
|
name: currentFunctionCall.name,
|
|
2376
2382
|
arguments: currentFunctionCall.arguments,
|
|
2383
|
+
// Preserve the item ID (fc_...) separately from call_id (call_...)
|
|
2384
|
+
// OpenAI Responses API requires both with correct prefixes
|
|
2385
|
+
metadata: { itemId: currentFunctionCall.id },
|
|
2377
2386
|
},
|
|
2378
2387
|
};
|
|
2379
2388
|
currentFunctionCall = null;
|
|
@@ -4793,13 +4802,22 @@ class StreamLoop {
|
|
|
4793
4802
|
if (collectedToolCalls.length > 0 && state.toolkit && state.maxTurns > 1) {
|
|
4794
4803
|
// Add tool calls to history
|
|
4795
4804
|
for (const toolCall of collectedToolCalls) {
|
|
4796
|
-
|
|
4805
|
+
// Extract provider-specific metadata from the stream chunk
|
|
4806
|
+
const metadata = toolCall.raw?.metadata;
|
|
4807
|
+
const historyItem = {
|
|
4797
4808
|
type: exports.LlmMessageType.FunctionCall,
|
|
4798
4809
|
name: toolCall.name,
|
|
4799
4810
|
arguments: toolCall.arguments,
|
|
4800
4811
|
call_id: toolCall.callId,
|
|
4801
|
-
|
|
4802
|
-
|
|
4812
|
+
// Use provider item ID if available (e.g., OpenAI fc_... prefix),
|
|
4813
|
+
// otherwise fall back to callId
|
|
4814
|
+
id: metadata?.itemId || toolCall.callId,
|
|
4815
|
+
};
|
|
4816
|
+
// Preserve provider-specific fields (e.g., Gemini thoughtSignature)
|
|
4817
|
+
if (metadata?.thoughtSignature) {
|
|
4818
|
+
historyItem.thoughtSignature = metadata.thoughtSignature;
|
|
4819
|
+
}
|
|
4820
|
+
state.currentInput.push(historyItem);
|
|
4803
4821
|
}
|
|
4804
4822
|
return { shouldContinue: true, toolCalls: collectedToolCalls };
|
|
4805
4823
|
}
|