@ai-sdk/anthropic 4.0.84 → 4.0.85
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 +11 -0
- package/dist/index.d.ts +138 -176
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -43
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +10 -10
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +38 -41
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +48 -4
- package/package.json +2 -2
- package/src/anthropic-api.ts +144 -130
- package/src/anthropic-batch.ts +8 -7
- package/src/anthropic-language-model-options.ts +417 -398
- package/src/convert-to-anthropic-prompt.ts +2 -2
- package/src/skills/anthropic-skills.ts +1 -11
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
type ToolNameMapping,
|
|
23
23
|
} from '@ai-sdk/provider-utils';
|
|
24
24
|
import {
|
|
25
|
-
|
|
25
|
+
anthropicFallbackContentSchemaValidator,
|
|
26
26
|
anthropicReasoningMetadataSchema,
|
|
27
27
|
type AnthropicAssistantMessage,
|
|
28
28
|
type AnthropicImageContent,
|
|
@@ -880,7 +880,7 @@ export async function convertToAnthropicPrompt({
|
|
|
880
880
|
|
|
881
881
|
const fallbackMetadata = await safeValidateTypes({
|
|
882
882
|
value: part.providerOptions?.anthropic,
|
|
883
|
-
schema:
|
|
883
|
+
schema: anthropicFallbackContentSchemaValidator,
|
|
884
884
|
});
|
|
885
885
|
|
|
886
886
|
if (!fallbackMetadata.success) {
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
combineHeaders,
|
|
4
4
|
convertInlineFileDataToUint8Array,
|
|
5
5
|
createJsonResponseHandler,
|
|
6
|
+
encodePathSegment,
|
|
6
7
|
getFromApi,
|
|
7
8
|
postFormDataToApi,
|
|
8
9
|
resolve,
|
|
@@ -22,17 +23,6 @@ interface AnthropicSkillsConfig {
|
|
|
22
23
|
fetch?: FetchFunction;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
function encodePathSegment(value: string): string {
|
|
26
|
-
const encodedValue = encodeURIComponent(value);
|
|
27
|
-
|
|
28
|
-
// URL parsing normalizes both literal and percent-encoded dot segments.
|
|
29
|
-
return encodedValue === '.'
|
|
30
|
-
? '%252E'
|
|
31
|
-
: encodedValue === '..'
|
|
32
|
-
? '%252E%252E'
|
|
33
|
-
: encodedValue;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
26
|
export class AnthropicSkills implements SkillsV4 {
|
|
37
27
|
readonly specificationVersion = 'v4';
|
|
38
28
|
|