@ai-sdk/anthropic 3.0.0-beta.44 → 3.0.0-beta.45
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +32 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +32 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -72,6 +72,7 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
72
72
|
version: z.ZodOptional<z.ZodString>;
|
|
73
73
|
}, z.core.$strip>>>;
|
|
74
74
|
}, z.core.$strip>>;
|
|
75
|
+
toolStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
75
76
|
}, z.core.$strip>;
|
|
76
77
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
77
78
|
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
72
72
|
version: z.ZodOptional<z.ZodString>;
|
|
73
73
|
}, z.core.$strip>>>;
|
|
74
74
|
}, z.core.$strip>>;
|
|
75
|
+
toolStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
75
76
|
}, z.core.$strip>;
|
|
76
77
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
77
78
|
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
31
31
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "3.0.0-beta.
|
|
34
|
+
var VERSION = true ? "3.0.0-beta.45" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -631,7 +631,16 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
631
631
|
version: import_v43.z.string().optional()
|
|
632
632
|
})
|
|
633
633
|
).optional()
|
|
634
|
-
}).optional()
|
|
634
|
+
}).optional(),
|
|
635
|
+
/**
|
|
636
|
+
* Whether to enable tool streaming (and structured output streaming).
|
|
637
|
+
*
|
|
638
|
+
* When set to false, the model will return all tool calls and results
|
|
639
|
+
* at once after a delay.
|
|
640
|
+
*
|
|
641
|
+
* @default true
|
|
642
|
+
*/
|
|
643
|
+
toolStreaming: import_v43.z.boolean().optional()
|
|
635
644
|
});
|
|
636
645
|
|
|
637
646
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1880,9 +1889,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1880
1889
|
seed,
|
|
1881
1890
|
tools,
|
|
1882
1891
|
toolChoice,
|
|
1883
|
-
providerOptions
|
|
1892
|
+
providerOptions,
|
|
1893
|
+
stream
|
|
1884
1894
|
}) {
|
|
1885
|
-
var _a, _b, _c, _d;
|
|
1895
|
+
var _a, _b, _c, _d, _e;
|
|
1886
1896
|
const warnings = [];
|
|
1887
1897
|
if (frequencyPenalty != null) {
|
|
1888
1898
|
warnings.push({
|
|
@@ -2032,6 +2042,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2032
2042
|
});
|
|
2033
2043
|
}
|
|
2034
2044
|
}
|
|
2045
|
+
if (stream && ((_e = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _e : true)) {
|
|
2046
|
+
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
2047
|
+
}
|
|
2035
2048
|
const {
|
|
2036
2049
|
tools: anthropicTools2,
|
|
2037
2050
|
toolChoice: anthropicToolChoice,
|
|
@@ -2055,7 +2068,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2055
2068
|
args: {
|
|
2056
2069
|
...baseArgs,
|
|
2057
2070
|
tools: anthropicTools2,
|
|
2058
|
-
tool_choice: anthropicToolChoice
|
|
2071
|
+
tool_choice: anthropicToolChoice,
|
|
2072
|
+
stream: stream === true ? true : void 0
|
|
2073
|
+
// do not send when not streaming
|
|
2059
2074
|
},
|
|
2060
2075
|
warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
|
|
2061
2076
|
betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas]),
|
|
@@ -2105,7 +2120,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2105
2120
|
}
|
|
2106
2121
|
async doGenerate(options) {
|
|
2107
2122
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2108
|
-
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(
|
|
2123
|
+
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs({
|
|
2124
|
+
...options,
|
|
2125
|
+
stream: false
|
|
2126
|
+
});
|
|
2109
2127
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
2110
2128
|
const {
|
|
2111
2129
|
responseHeaders,
|
|
@@ -2406,9 +2424,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2406
2424
|
};
|
|
2407
2425
|
}
|
|
2408
2426
|
async doStream(options) {
|
|
2409
|
-
const {
|
|
2427
|
+
const {
|
|
2428
|
+
args: body,
|
|
2429
|
+
warnings,
|
|
2430
|
+
betas,
|
|
2431
|
+
usesJsonResponseTool
|
|
2432
|
+
} = await this.getArgs({
|
|
2433
|
+
...options,
|
|
2434
|
+
stream: true
|
|
2435
|
+
});
|
|
2410
2436
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
2411
|
-
const body = { ...args, stream: true };
|
|
2412
2437
|
const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
|
|
2413
2438
|
url: this.buildRequestUrl(true),
|
|
2414
2439
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|