@ai-sdk/anthropic 3.0.0-beta.93 → 3.0.0-beta.94
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 +8 -0
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -24
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +23 -23
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +23 -23
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, SharedV3Warning
|
|
1
|
+
import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, JSONSchema7, SharedV3ProviderMetadata, SharedV3Warning } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
@@ -33,8 +33,8 @@ declare class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
|
33
33
|
private buildRequestUrl;
|
|
34
34
|
private transformRequestBody;
|
|
35
35
|
private extractCitationDocuments;
|
|
36
|
-
doGenerate(options:
|
|
37
|
-
doStream(options:
|
|
36
|
+
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
37
|
+
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
declare const anthropicTools: {
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV3, JSONSchema7, SharedV3ProviderMetadata, SharedV3Warning
|
|
1
|
+
import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, JSONSchema7, SharedV3ProviderMetadata, SharedV3Warning } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
@@ -33,8 +33,8 @@ declare class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
|
33
33
|
private buildRequestUrl;
|
|
34
34
|
private transformRequestBody;
|
|
35
35
|
private extractCitationDocuments;
|
|
36
|
-
doGenerate(options:
|
|
37
|
-
doStream(options:
|
|
36
|
+
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
37
|
+
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
declare const anthropicTools: {
|
package/dist/internal/index.js
CHANGED
|
@@ -49,29 +49,6 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
|
|
|
49
49
|
errorToMessage: (data) => data.error.message
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
// src/convert-anthropic-messages-usage.ts
|
|
53
|
-
function convertAnthropicMessagesUsage(usage) {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
const inputTokens = usage.input_tokens;
|
|
56
|
-
const outputTokens = usage.output_tokens;
|
|
57
|
-
const cacheCreationTokens = (_a = usage.cache_creation_input_tokens) != null ? _a : 0;
|
|
58
|
-
const cacheReadTokens = (_b = usage.cache_read_input_tokens) != null ? _b : 0;
|
|
59
|
-
return {
|
|
60
|
-
inputTokens: {
|
|
61
|
-
total: inputTokens + cacheCreationTokens + cacheReadTokens,
|
|
62
|
-
noCache: inputTokens,
|
|
63
|
-
cacheRead: cacheReadTokens,
|
|
64
|
-
cacheWrite: cacheCreationTokens
|
|
65
|
-
},
|
|
66
|
-
outputTokens: {
|
|
67
|
-
total: outputTokens,
|
|
68
|
-
text: void 0,
|
|
69
|
-
reasoning: void 0
|
|
70
|
-
},
|
|
71
|
-
raw: usage
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
52
|
// src/anthropic-messages-api.ts
|
|
76
53
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
77
54
|
var import_v42 = require("zod/v4");
|
|
@@ -1331,6 +1308,29 @@ async function prepareTools({
|
|
|
1331
1308
|
}
|
|
1332
1309
|
}
|
|
1333
1310
|
|
|
1311
|
+
// src/convert-anthropic-messages-usage.ts
|
|
1312
|
+
function convertAnthropicMessagesUsage(usage) {
|
|
1313
|
+
var _a, _b;
|
|
1314
|
+
const inputTokens = usage.input_tokens;
|
|
1315
|
+
const outputTokens = usage.output_tokens;
|
|
1316
|
+
const cacheCreationTokens = (_a = usage.cache_creation_input_tokens) != null ? _a : 0;
|
|
1317
|
+
const cacheReadTokens = (_b = usage.cache_read_input_tokens) != null ? _b : 0;
|
|
1318
|
+
return {
|
|
1319
|
+
inputTokens: {
|
|
1320
|
+
total: inputTokens + cacheCreationTokens + cacheReadTokens,
|
|
1321
|
+
noCache: inputTokens,
|
|
1322
|
+
cacheRead: cacheReadTokens,
|
|
1323
|
+
cacheWrite: cacheCreationTokens
|
|
1324
|
+
},
|
|
1325
|
+
outputTokens: {
|
|
1326
|
+
total: outputTokens,
|
|
1327
|
+
text: void 0,
|
|
1328
|
+
reasoning: void 0
|
|
1329
|
+
},
|
|
1330
|
+
raw: usage
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
1334
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1335
1335
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1336
1336
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|