@ai-sdk/provider-utils 5.0.5 → 5.0.6
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/CHANGELOG.md +6 -0
- package/dist/index.js +1 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/streaming-tool-call-tracker.ts +4 -11
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
type SharedV4ProviderMetadata,
|
|
5
5
|
} from '@ai-sdk/provider';
|
|
6
6
|
import { generateId as defaultGenerateId } from './generate-id';
|
|
7
|
-
import { isParsableJson } from './parse-json';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Minimal interface for a streaming tool call delta from an OpenAI-compatible API.
|
|
@@ -188,11 +187,10 @@ export class StreamingToolCallTracker<
|
|
|
188
187
|
});
|
|
189
188
|
}
|
|
190
189
|
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
190
|
+
// Tool calls must not finalize before the stream ends: a parsable
|
|
191
|
+
// argument buffer can still be the prefix of a longer argument string,
|
|
192
|
+
// so acting on it early would use truncated inputs (see #13137).
|
|
193
|
+
// Finalization happens in flush().
|
|
196
194
|
}
|
|
197
195
|
|
|
198
196
|
private processExistingToolCall(index: number, toolCallDelta: DELTA): void {
|
|
@@ -211,11 +209,6 @@ export class StreamingToolCallTracker<
|
|
|
211
209
|
delta: toolCallDelta.function.arguments,
|
|
212
210
|
});
|
|
213
211
|
}
|
|
214
|
-
|
|
215
|
-
// Check if tool call is complete
|
|
216
|
-
if (isParsableJson(toolCall.function.arguments)) {
|
|
217
|
-
this.finishToolCall(toolCall);
|
|
218
|
-
}
|
|
219
212
|
}
|
|
220
213
|
|
|
221
214
|
private finishToolCall(toolCall: TrackedToolCall): void {
|