ai-speedometer-headless 2.1.5 → 2.1.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.
|
@@ -592,7 +592,8 @@ async function benchmarkSingleModelRest(model) {
|
|
|
592
592
|
messages: [{ role: "user", content: TEST_PROMPT }],
|
|
593
593
|
max_tokens: 500,
|
|
594
594
|
temperature: 0.7,
|
|
595
|
-
stream: true
|
|
595
|
+
stream: true,
|
|
596
|
+
stream_options: { include_usage: true }
|
|
596
597
|
};
|
|
597
598
|
if (model.providerType === "google") {
|
|
598
599
|
body["contents"] = [{ parts: [{ text: TEST_PROMPT }] }];
|
|
@@ -600,6 +601,9 @@ async function benchmarkSingleModelRest(model) {
|
|
|
600
601
|
delete body["messages"];
|
|
601
602
|
delete body["max_tokens"];
|
|
602
603
|
delete body["stream"];
|
|
604
|
+
delete body["stream_options"];
|
|
605
|
+
} else if (model.providerType === "anthropic") {
|
|
606
|
+
delete body["stream_options"];
|
|
603
607
|
}
|
|
604
608
|
const response = await fetch(url, {
|
|
605
609
|
method: "POST",
|
|
@@ -649,7 +653,7 @@ async function benchmarkSingleModelRest(model) {
|
|
|
649
653
|
if (trimmedLine.startsWith("data: ")) {
|
|
650
654
|
const jsonStr = trimmedLine.slice(6);
|
|
651
655
|
if (jsonStr === "[DONE]")
|
|
652
|
-
|
|
656
|
+
continue;
|
|
653
657
|
const chunk = JSON.parse(jsonStr);
|
|
654
658
|
const chunkTyped = chunk;
|
|
655
659
|
if (chunkTyped.type === "content_block_delta" && chunkTyped.delta?.text) {
|
|
@@ -690,7 +694,7 @@ async function benchmarkSingleModelRest(model) {
|
|
|
690
694
|
if (trimmedLine.startsWith("data: ")) {
|
|
691
695
|
const jsonStr = trimmedLine.slice(6);
|
|
692
696
|
if (jsonStr === "[DONE]")
|
|
693
|
-
|
|
697
|
+
continue;
|
|
694
698
|
const chunk = JSON.parse(jsonStr);
|
|
695
699
|
if (chunk.choices?.[0]?.delta?.content)
|
|
696
700
|
streamedText += chunk.choices[0].delta.content;
|
package/package.json
CHANGED