@kenkaiiii/gg-ai 5.1.2 → 5.2.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/README.md +1 -1
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -285,7 +285,7 @@ declare class StreamResult implements AsyncIterable<StreamEvent> {
|
|
|
285
285
|
*
|
|
286
286
|
* ```ts
|
|
287
287
|
* // Stream events
|
|
288
|
-
* for await (const event of stream({ provider: "anthropic", model: "claude-sonnet-
|
|
288
|
+
* for await (const event of stream({ provider: "anthropic", model: "claude-sonnet-5", messages })) {
|
|
289
289
|
* if (event.type === "text_delta") process.stdout.write(event.text);
|
|
290
290
|
* }
|
|
291
291
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -285,7 +285,7 @@ declare class StreamResult implements AsyncIterable<StreamEvent> {
|
|
|
285
285
|
*
|
|
286
286
|
* ```ts
|
|
287
287
|
* // Stream events
|
|
288
|
-
* for await (const event of stream({ provider: "anthropic", model: "claude-sonnet-
|
|
288
|
+
* for await (const event of stream({ provider: "anthropic", model: "claude-sonnet-5", messages })) {
|
|
289
289
|
* if (event.type === "text_delta") process.stdout.write(event.text);
|
|
290
290
|
* }
|
|
291
291
|
*
|
package/dist/index.js
CHANGED
|
@@ -784,7 +784,7 @@ function toAnthropicToolChoice(choice) {
|
|
|
784
784
|
return { type: "tool", name: choice.name };
|
|
785
785
|
}
|
|
786
786
|
function isAdaptiveThinkingModel(model) {
|
|
787
|
-
return /opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-
|
|
787
|
+
return /opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-5|fable-5|mythos-5/.test(model);
|
|
788
788
|
}
|
|
789
789
|
function toAnthropicThinking(level, maxTokens, model) {
|
|
790
790
|
if (isAdaptiveThinkingModel(model)) {
|
|
@@ -1019,6 +1019,7 @@ function parseToolArguments(argsJson) {
|
|
|
1019
1019
|
|
|
1020
1020
|
// src/providers/anthropic.ts
|
|
1021
1021
|
var anthropicClientCache = /* @__PURE__ */ new Map();
|
|
1022
|
+
var NON_STREAMING_REQUEST_TIMEOUT_MS = 6e5;
|
|
1022
1023
|
function createClient(options) {
|
|
1023
1024
|
const isOAuth = options.apiKey?.startsWith("sk-ant-oat");
|
|
1024
1025
|
const userAgent = isOAuth ? options.userAgent ?? "claude-cli/2.1.75 (external, cli)" : "";
|
|
@@ -1193,7 +1194,10 @@ async function* runStream(options) {
|
|
|
1193
1194
|
};
|
|
1194
1195
|
if (!useStreaming) {
|
|
1195
1196
|
try {
|
|
1196
|
-
const
|
|
1197
|
+
const nonStreamingClient = client.withOptions({
|
|
1198
|
+
timeout: NON_STREAMING_REQUEST_TIMEOUT_MS
|
|
1199
|
+
});
|
|
1200
|
+
const message = await nonStreamingClient.messages.create(
|
|
1197
1201
|
{ ...params, stream: false },
|
|
1198
1202
|
requestOptions
|
|
1199
1203
|
);
|