@tanstack/ai-anthropic 0.18.11 → 0.19.1
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/esm/adapters/files.d.ts +25 -0
- package/dist/esm/adapters/files.js +61 -0
- package/dist/esm/adapters/files.js.map +1 -0
- package/dist/esm/adapters/text.d.ts +11 -3
- package/dist/esm/adapters/text.js +47 -22
- package/dist/esm/adapters/text.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/model-meta.d.ts +26 -4
- package/dist/esm/model-meta.js +52 -3
- package/dist/esm/model-meta.js.map +1 -1
- package/dist/esm/text/text-provider-options.d.ts +3 -3
- package/dist/esm/text/text-provider-options.js.map +1 -1
- package/package.json +3 -3
- package/src/adapters/files.ts +85 -0
- package/src/adapters/text.ts +105 -40
- package/src/index.ts +8 -0
- package/src/model-meta.ts +79 -4
- package/src/text/text-provider-options.ts +3 -5
package/src/index.ts
CHANGED
|
@@ -22,6 +22,14 @@ export {
|
|
|
22
22
|
type AnthropicSummarizeConfig,
|
|
23
23
|
type AnthropicSummarizeModel,
|
|
24
24
|
} from './adapters/summarize'
|
|
25
|
+
|
|
26
|
+
// Files adapter - upload media to the Anthropic Files API (beta) by file_id
|
|
27
|
+
export {
|
|
28
|
+
AnthropicFilesAdapter,
|
|
29
|
+
createAnthropicFiles,
|
|
30
|
+
anthropicFiles,
|
|
31
|
+
type AnthropicFilesConfig,
|
|
32
|
+
} from './adapters/files'
|
|
25
33
|
// ============================================================================
|
|
26
34
|
// Type Exports
|
|
27
35
|
// ============================================================================
|
package/src/model-meta.ts
CHANGED
|
@@ -509,7 +509,15 @@ const CLAUDE_OPUS_5 = {
|
|
|
509
509
|
max_output_tokens: 128_000,
|
|
510
510
|
supports: {
|
|
511
511
|
input: ['text', 'image', 'document'],
|
|
512
|
-
tools: [
|
|
512
|
+
tools: [
|
|
513
|
+
'web_search',
|
|
514
|
+
'web_fetch',
|
|
515
|
+
'code_execution',
|
|
516
|
+
'computer_use',
|
|
517
|
+
'bash',
|
|
518
|
+
'text_editor',
|
|
519
|
+
'memory',
|
|
520
|
+
],
|
|
513
521
|
},
|
|
514
522
|
pricing: {
|
|
515
523
|
input: {
|
|
@@ -528,7 +536,8 @@ const CLAUDE_OPUS_5 = {
|
|
|
528
536
|
AnthropicStopSequencesOptions &
|
|
529
537
|
AnthropicThinkingOptions &
|
|
530
538
|
AnthropicToolChoiceOptions &
|
|
531
|
-
AnthropicSamplingOptions
|
|
539
|
+
AnthropicSamplingOptions &
|
|
540
|
+
AnthropicOutputConfigOptions
|
|
532
541
|
>
|
|
533
542
|
|
|
534
543
|
const CLAUDE_OPUS_5_FAST = {
|
|
@@ -567,7 +576,15 @@ const CLAUDE_FABLE_5_1 = {
|
|
|
567
576
|
max_output_tokens: 128_000,
|
|
568
577
|
supports: {
|
|
569
578
|
input: ['text', 'image', 'document'],
|
|
570
|
-
tools: [
|
|
579
|
+
tools: [
|
|
580
|
+
'web_search',
|
|
581
|
+
'web_fetch',
|
|
582
|
+
'code_execution',
|
|
583
|
+
'computer_use',
|
|
584
|
+
'bash',
|
|
585
|
+
'text_editor',
|
|
586
|
+
'memory',
|
|
587
|
+
],
|
|
571
588
|
},
|
|
572
589
|
pricing: {
|
|
573
590
|
input: {
|
|
@@ -591,7 +608,48 @@ const CLAUDE_FABLE_5_1 = {
|
|
|
591
608
|
AnthropicOutputConfigOptions
|
|
592
609
|
>
|
|
593
610
|
|
|
611
|
+
const CLAUDE_OPUS_5_5 = {
|
|
612
|
+
name: 'claude-opus-5-5',
|
|
613
|
+
id: 'claude-opus-5-5',
|
|
614
|
+
context_window: 1_000_000,
|
|
615
|
+
max_output_tokens: 128_000,
|
|
616
|
+
supports: {
|
|
617
|
+
input: ['text', 'image', 'document'],
|
|
618
|
+
// No 'computer_use': this model accepts only `computer_toolset_20260801`,
|
|
619
|
+
// and `computerUseTool()` sends the older versions, which return a 400.
|
|
620
|
+
tools: [
|
|
621
|
+
'web_search',
|
|
622
|
+
'web_fetch',
|
|
623
|
+
'code_execution',
|
|
624
|
+
'bash',
|
|
625
|
+
'text_editor',
|
|
626
|
+
'memory',
|
|
627
|
+
],
|
|
628
|
+
},
|
|
629
|
+
pricing: {
|
|
630
|
+
input: {
|
|
631
|
+
normal: 4,
|
|
632
|
+
cached: 0.2,
|
|
633
|
+
},
|
|
634
|
+
output: {
|
|
635
|
+
normal: 20,
|
|
636
|
+
},
|
|
637
|
+
},
|
|
638
|
+
} as const satisfies ModelMeta<
|
|
639
|
+
AnthropicCacheControlOptions &
|
|
640
|
+
AnthropicContainerOptions &
|
|
641
|
+
AnthropicContextManagementOptions &
|
|
642
|
+
AnthropicMCPOptions &
|
|
643
|
+
AnthropicServiceTierOptions &
|
|
644
|
+
AnthropicStopSequencesOptions &
|
|
645
|
+
AnthropicAdaptiveOnlyThinkingOptions &
|
|
646
|
+
AnthropicToolChoiceOptions &
|
|
647
|
+
AnthropicSamplingOptions &
|
|
648
|
+
AnthropicOutputConfigOptions
|
|
649
|
+
>
|
|
650
|
+
|
|
594
651
|
export const ANTHROPIC_MODELS = [
|
|
652
|
+
CLAUDE_OPUS_5_5.id,
|
|
595
653
|
CLAUDE_FABLE_5_1.id,
|
|
596
654
|
CLAUDE_OPUS_5.id,
|
|
597
655
|
CLAUDE_OPUS_5_FAST.id,
|
|
@@ -669,6 +727,7 @@ const ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS: Record<string, number> = {
|
|
|
669
727
|
[CLAUDE_OPUS_5.id]: CLAUDE_OPUS_5.max_output_tokens,
|
|
670
728
|
[CLAUDE_OPUS_5_FAST.id]: CLAUDE_OPUS_5_FAST.max_output_tokens,
|
|
671
729
|
[CLAUDE_FABLE_5_1.id]: CLAUDE_FABLE_5_1.max_output_tokens,
|
|
730
|
+
[CLAUDE_OPUS_5_5.id]: CLAUDE_OPUS_5_5.max_output_tokens,
|
|
672
731
|
}
|
|
673
732
|
|
|
674
733
|
/**
|
|
@@ -721,7 +780,10 @@ export const ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set<string>([
|
|
|
721
780
|
CLAUDE_OPUS_4_6.id,
|
|
722
781
|
CLAUDE_OPUS_4_7.id,
|
|
723
782
|
CLAUDE_OPUS_4_8.id,
|
|
783
|
+
CLAUDE_OPUS_5.id,
|
|
724
784
|
CLAUDE_FABLE_5.id,
|
|
785
|
+
CLAUDE_FABLE_5_1.id,
|
|
786
|
+
CLAUDE_OPUS_5_5.id,
|
|
725
787
|
CLAUDE_SONNET_5.id,
|
|
726
788
|
CLAUDE_SONNET_4_5.id,
|
|
727
789
|
CLAUDE_SONNET_4_6.id,
|
|
@@ -852,7 +914,8 @@ export type AnthropicChatModelProviderOptionsByName = {
|
|
|
852
914
|
AnthropicStopSequencesOptions &
|
|
853
915
|
AnthropicThinkingOptions &
|
|
854
916
|
AnthropicToolChoiceOptions &
|
|
855
|
-
AnthropicSamplingOptions
|
|
917
|
+
AnthropicSamplingOptions &
|
|
918
|
+
AnthropicOutputConfigOptions
|
|
856
919
|
[CLAUDE_OPUS_5_FAST.id]: AnthropicContainerOptions &
|
|
857
920
|
AnthropicContextManagementOptions &
|
|
858
921
|
AnthropicMCPOptions &
|
|
@@ -871,6 +934,16 @@ export type AnthropicChatModelProviderOptionsByName = {
|
|
|
871
934
|
AnthropicToolChoiceOptions &
|
|
872
935
|
AnthropicMaxTokensOptions &
|
|
873
936
|
AnthropicOutputConfigOptions
|
|
937
|
+
[CLAUDE_OPUS_5_5.id]: AnthropicCacheControlOptions &
|
|
938
|
+
AnthropicContainerOptions &
|
|
939
|
+
AnthropicContextManagementOptions &
|
|
940
|
+
AnthropicMCPOptions &
|
|
941
|
+
AnthropicServiceTierOptions &
|
|
942
|
+
AnthropicStopSequencesOptions &
|
|
943
|
+
AnthropicAdaptiveOnlyThinkingOptions &
|
|
944
|
+
AnthropicToolChoiceOptions &
|
|
945
|
+
AnthropicSamplingOptions &
|
|
946
|
+
AnthropicOutputConfigOptions
|
|
874
947
|
}
|
|
875
948
|
|
|
876
949
|
export type AnthropicChatModelToolCapabilitiesByName = {
|
|
@@ -887,6 +960,7 @@ export type AnthropicChatModelToolCapabilitiesByName = {
|
|
|
887
960
|
[CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.tools
|
|
888
961
|
[CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.tools
|
|
889
962
|
[CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.supports.tools
|
|
963
|
+
[CLAUDE_OPUS_5_5.id]: typeof CLAUDE_OPUS_5_5.supports.tools
|
|
890
964
|
}
|
|
891
965
|
|
|
892
966
|
/**
|
|
@@ -914,4 +988,5 @@ export type AnthropicModelInputModalitiesByName = {
|
|
|
914
988
|
[CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.input
|
|
915
989
|
[CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.input
|
|
916
990
|
[CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.supports.input
|
|
991
|
+
[CLAUDE_OPUS_5_5.id]: typeof CLAUDE_OPUS_5_5.supports.input
|
|
917
992
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
BetaContextManagementConfig,
|
|
3
|
+
BetaMessageParam,
|
|
3
4
|
BetaToolChoiceAny,
|
|
4
5
|
BetaToolChoiceAuto,
|
|
5
6
|
BetaToolChoiceTool,
|
|
6
7
|
} from '@anthropic-ai/sdk/resources/beta/messages/messages'
|
|
7
8
|
import type { CacheControlEphemeral } from '@anthropic-ai/sdk/resources'
|
|
8
9
|
import type { AnthropicContainerSkill, AnthropicTool } from '../tools/index'
|
|
9
|
-
import type {
|
|
10
|
-
MessageParam,
|
|
11
|
-
TextBlockParam,
|
|
12
|
-
} from '@anthropic-ai/sdk/resources/messages'
|
|
10
|
+
import type { TextBlockParam } from '@anthropic-ai/sdk/resources/messages'
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Per-prompt metadata Anthropic understands on `systemPrompts` entries.
|
|
@@ -320,7 +318,7 @@ export type ExternalTextProviderOptions = AnthropicCacheControlOptions &
|
|
|
320
318
|
export interface InternalTextProviderOptions extends ExternalTextProviderOptions {
|
|
321
319
|
model: string
|
|
322
320
|
|
|
323
|
-
messages: Array<
|
|
321
|
+
messages: Array<BetaMessageParam>
|
|
324
322
|
|
|
325
323
|
/**
|
|
326
324
|
* The maximum number of tokens to generate before stopping. This parameter only specifies the absolute maximum number of tokens to generate.
|