@kenkaiiii/gg-ai 5.67.0 → 5.68.0

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/index.cjs CHANGED
@@ -1443,7 +1443,7 @@ function streamAnthropic(options) {
1443
1443
  async function* runStream(options) {
1444
1444
  const client = createClient(options);
1445
1445
  const isOAuth = options.apiKey?.startsWith("sk-ant-oat");
1446
- const useStreaming = options.streaming !== false;
1446
+ const useStreaming = options.streaming !== false && !options.prewarm;
1447
1447
  const cacheControl = toAnthropicCacheControl(options.cacheRetention, options.baseUrl);
1448
1448
  const supportsFirstPartyToolExtras = !options.baseUrl || options.baseUrl.includes("api.anthropic.com");
1449
1449
  const downgradedImages = downgradeUnsupportedImages(options.messages, options.supportsImages);
@@ -1467,6 +1467,17 @@ async function* runStream(options) {
1467
1467
  outputConfig = t.outputConfig;
1468
1468
  }
1469
1469
  }
1470
+ if (options.prewarm) {
1471
+ const budget = thinking?.budget_tokens;
1472
+ if (budget != null && budget >= 1) {
1473
+ return {
1474
+ message: { role: "assistant", content: [] },
1475
+ stopReason: "end_turn",
1476
+ usage: { inputTokens: 0, outputTokens: 0 }
1477
+ };
1478
+ }
1479
+ maxTokens = 1;
1480
+ }
1470
1481
  const params = {
1471
1482
  model: options.model,
1472
1483
  max_tokens: maxTokens,