anthropic 1.1.1 → 1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -0
- data/README.md +32 -16
- data/lib/anthropic/errors.rb +22 -0
- data/lib/anthropic/helpers/streaming/events.rb +141 -0
- data/lib/anthropic/helpers/streaming/message_stream.rb +238 -0
- data/lib/anthropic/helpers/streaming.rb +37 -0
- data/lib/anthropic/helpers/vertex/client.rb +4 -1
- data/lib/anthropic/internal/stream.rb +4 -2
- data/lib/anthropic/internal/transport/base_client.rb +10 -2
- data/lib/anthropic/internal/type/array_of.rb +6 -1
- data/lib/anthropic/internal/type/base_model.rb +77 -23
- data/lib/anthropic/internal/type/base_stream.rb +3 -1
- data/lib/anthropic/internal/type/boolean.rb +7 -1
- data/lib/anthropic/internal/type/converter.rb +42 -34
- data/lib/anthropic/internal/type/enum.rb +16 -5
- data/lib/anthropic/internal/type/file_input.rb +6 -1
- data/lib/anthropic/internal/type/hash_of.rb +6 -1
- data/lib/anthropic/internal/type/union.rb +17 -9
- data/lib/anthropic/internal/type/unknown.rb +7 -1
- data/lib/anthropic/internal/util.rb +8 -9
- data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
- data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +55 -0
- data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +55 -0
- data/lib/anthropic/models/beta/beta_citations_delta.rb +5 -3
- data/lib/anthropic/models/beta/beta_content_block.rb +5 -5
- data/lib/anthropic/models/beta/beta_content_block_param.rb +20 -17
- data/lib/anthropic/models/beta/beta_message.rb +6 -2
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +7 -7
- data/lib/anthropic/models/beta/beta_request_document_block.rb +75 -0
- data/lib/anthropic/models/beta/beta_search_result_block_param.rb +55 -0
- data/lib/anthropic/models/beta/beta_text_block.rb +2 -2
- data/lib/anthropic/models/beta/beta_text_block_param.rb +2 -2
- data/lib/anthropic/models/beta/beta_text_citation.rb +3 -1
- data/lib/anthropic/models/beta/beta_text_citation_param.rb +3 -1
- data/lib/anthropic/models/beta/beta_tool.rb +7 -1
- data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
- data/lib/anthropic/models/beta/beta_tool_union.rb +7 -7
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +16 -10
- data/lib/anthropic/models/beta/message_create_params.rb +9 -3
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -3
- data/lib/anthropic/models/content_block.rb +5 -5
- data/lib/anthropic/models/content_block_param.rb +11 -11
- data/lib/anthropic/models/message.rb +6 -2
- data/lib/anthropic/models/message_count_tokens_params.rb +9 -3
- data/lib/anthropic/models/message_count_tokens_tool.rb +35 -1
- data/lib/anthropic/models/message_create_params.rb +9 -3
- data/lib/anthropic/models/message_param.rb +3 -3
- data/lib/anthropic/models/messages/batch_create_params.rb +9 -3
- data/lib/anthropic/models/model.rb +6 -0
- data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
- data/lib/anthropic/models/tool.rb +7 -1
- data/lib/anthropic/models/tool_union.rb +34 -1
- data/lib/anthropic/models/tool_use_block.rb +6 -0
- data/lib/anthropic/models.rb +4 -4
- data/lib/anthropic/resources/beta/messages.rb +5 -5
- data/lib/anthropic/resources/messages.rb +68 -7
- data/lib/anthropic/streaming.rb +5 -0
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +8 -0
- data/rbi/anthropic/errors.rbi +16 -0
- data/rbi/anthropic/helpers/streaming/events.rbi +85 -0
- data/rbi/anthropic/helpers/streaming/message_stream.rbi +59 -0
- data/rbi/anthropic/internal/type/base_stream.rbi +8 -1
- data/rbi/anthropic/internal/type/boolean.rbi +2 -0
- data/rbi/anthropic/internal/type/converter.rbi +15 -15
- data/rbi/anthropic/internal/type/union.rbi +5 -0
- data/rbi/anthropic/internal/type/unknown.rbi +2 -0
- data/rbi/anthropic/internal/util.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
- data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +78 -0
- data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +79 -0
- data/rbi/anthropic/models/beta/beta_citations_delta.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_content_block.rbi +3 -3
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +8 -7
- data/rbi/anthropic/models/beta/beta_message.rbi +11 -3
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +6 -6
- data/rbi/anthropic/models/beta/beta_request_document_block.rbi +140 -0
- data/rbi/anthropic/models/beta/beta_search_result_block_param.rbi +91 -0
- data/rbi/anthropic/models/beta/beta_text_block.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_text_block_param.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_text_citation.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_tool.rbi +14 -5
- data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +5 -5
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +39 -27
- data/rbi/anthropic/models/beta/message_create_params.rbi +34 -22
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +34 -22
- data/rbi/anthropic/models/content_block.rbi +3 -3
- data/rbi/anthropic/models/content_block_param.rbi +5 -5
- data/rbi/anthropic/models/message.rbi +11 -3
- data/rbi/anthropic/models/message_count_tokens_params.rbi +18 -2
- data/rbi/anthropic/models/message_count_tokens_tool.rbi +61 -0
- data/rbi/anthropic/models/message_create_params.rbi +18 -2
- data/rbi/anthropic/models/messages/batch_create_params.rbi +18 -2
- data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
- data/rbi/anthropic/models/tool.rbi +16 -5
- data/rbi/anthropic/models/tool_union.rbi +61 -0
- data/rbi/anthropic/resources/beta/messages.rbi +36 -18
- data/rbi/anthropic/resources/messages.rbi +293 -3
- data/rbi/anthropic/streaming.rbi +5 -0
- data/sig/anthropic/errors.rbs +9 -0
- data/sig/anthropic/helpers/streaming/events.rbs +119 -0
- data/sig/anthropic/helpers/streaming/message_stream.rbs +55 -0
- data/sig/anthropic/internal/type/base_stream.rbs +4 -0
- data/sig/anthropic/internal/type/converter.rbs +7 -1
- data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
- data/sig/anthropic/models/beta/beta_citation_search_result_location.rbs +54 -0
- data/sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs +54 -0
- data/sig/anthropic/models/beta/beta_citations_delta.rbs +1 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +2 -2
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +9 -8
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -2
- data/sig/anthropic/models/beta/beta_request_document_block.rbs +66 -0
- data/sig/anthropic/models/beta/beta_search_result_block_param.rbs +53 -0
- data/sig/anthropic/models/beta/beta_text_citation.rbs +1 -0
- data/sig/anthropic/models/beta/beta_text_citation_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_tool.rbs +14 -3
- data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +4 -4
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +4 -4
- data/sig/anthropic/models/content_block.rbs +2 -2
- data/sig/anthropic/models/content_block_param.rbs +5 -5
- data/sig/anthropic/models/message_count_tokens_tool.rbs +28 -0
- data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
- data/sig/anthropic/models/tool.rbs +14 -3
- data/sig/anthropic/models/tool_union.rbs +28 -0
- data/sig/anthropic/streaming.rbs +3 -0
- metadata +26 -3
@@ -5,134 +5,7 @@ module Anthropic
|
|
5
5
|
BetaBase64PDFBlock = Beta::BetaBase64PDFBlock
|
6
6
|
|
7
7
|
module Beta
|
8
|
-
|
9
|
-
OrHash =
|
10
|
-
T.type_alias do
|
11
|
-
T.any(
|
12
|
-
Anthropic::Beta::BetaBase64PDFBlock,
|
13
|
-
Anthropic::Internal::AnyHash
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
sig do
|
18
|
-
returns(
|
19
|
-
T.any(
|
20
|
-
Anthropic::Beta::BetaBase64PDFSource,
|
21
|
-
Anthropic::Beta::BetaPlainTextSource,
|
22
|
-
Anthropic::Beta::BetaContentBlockSource,
|
23
|
-
Anthropic::Beta::BetaURLPDFSource,
|
24
|
-
Anthropic::Beta::BetaFileDocumentSource
|
25
|
-
)
|
26
|
-
)
|
27
|
-
end
|
28
|
-
attr_accessor :source
|
29
|
-
|
30
|
-
sig { returns(Symbol) }
|
31
|
-
attr_accessor :type
|
32
|
-
|
33
|
-
# Create a cache control breakpoint at this content block.
|
34
|
-
sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
|
35
|
-
attr_reader :cache_control
|
36
|
-
|
37
|
-
sig do
|
38
|
-
params(
|
39
|
-
cache_control:
|
40
|
-
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
|
41
|
-
).void
|
42
|
-
end
|
43
|
-
attr_writer :cache_control
|
44
|
-
|
45
|
-
sig { returns(T.nilable(Anthropic::Beta::BetaCitationsConfigParam)) }
|
46
|
-
attr_reader :citations
|
47
|
-
|
48
|
-
sig do
|
49
|
-
params(
|
50
|
-
citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash
|
51
|
-
).void
|
52
|
-
end
|
53
|
-
attr_writer :citations
|
54
|
-
|
55
|
-
sig { returns(T.nilable(String)) }
|
56
|
-
attr_accessor :context
|
57
|
-
|
58
|
-
sig { returns(T.nilable(String)) }
|
59
|
-
attr_accessor :title
|
60
|
-
|
61
|
-
sig do
|
62
|
-
params(
|
63
|
-
source:
|
64
|
-
T.any(
|
65
|
-
Anthropic::Beta::BetaBase64PDFSource::OrHash,
|
66
|
-
Anthropic::Beta::BetaPlainTextSource::OrHash,
|
67
|
-
Anthropic::Beta::BetaContentBlockSource::OrHash,
|
68
|
-
Anthropic::Beta::BetaURLPDFSource::OrHash,
|
69
|
-
Anthropic::Beta::BetaFileDocumentSource::OrHash
|
70
|
-
),
|
71
|
-
cache_control:
|
72
|
-
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
73
|
-
citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash,
|
74
|
-
context: T.nilable(String),
|
75
|
-
title: T.nilable(String),
|
76
|
-
type: Symbol
|
77
|
-
).returns(T.attached_class)
|
78
|
-
end
|
79
|
-
def self.new(
|
80
|
-
source:,
|
81
|
-
# Create a cache control breakpoint at this content block.
|
82
|
-
cache_control: nil,
|
83
|
-
citations: nil,
|
84
|
-
context: nil,
|
85
|
-
title: nil,
|
86
|
-
type: :document
|
87
|
-
)
|
88
|
-
end
|
89
|
-
|
90
|
-
sig do
|
91
|
-
override.returns(
|
92
|
-
{
|
93
|
-
source:
|
94
|
-
T.any(
|
95
|
-
Anthropic::Beta::BetaBase64PDFSource,
|
96
|
-
Anthropic::Beta::BetaPlainTextSource,
|
97
|
-
Anthropic::Beta::BetaContentBlockSource,
|
98
|
-
Anthropic::Beta::BetaURLPDFSource,
|
99
|
-
Anthropic::Beta::BetaFileDocumentSource
|
100
|
-
),
|
101
|
-
type: Symbol,
|
102
|
-
cache_control:
|
103
|
-
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
104
|
-
citations: Anthropic::Beta::BetaCitationsConfigParam,
|
105
|
-
context: T.nilable(String),
|
106
|
-
title: T.nilable(String)
|
107
|
-
}
|
108
|
-
)
|
109
|
-
end
|
110
|
-
def to_hash
|
111
|
-
end
|
112
|
-
|
113
|
-
module Source
|
114
|
-
extend Anthropic::Internal::Type::Union
|
115
|
-
|
116
|
-
Variants =
|
117
|
-
T.type_alias do
|
118
|
-
T.any(
|
119
|
-
Anthropic::Beta::BetaBase64PDFSource,
|
120
|
-
Anthropic::Beta::BetaPlainTextSource,
|
121
|
-
Anthropic::Beta::BetaContentBlockSource,
|
122
|
-
Anthropic::Beta::BetaURLPDFSource,
|
123
|
-
Anthropic::Beta::BetaFileDocumentSource
|
124
|
-
)
|
125
|
-
end
|
126
|
-
|
127
|
-
sig do
|
128
|
-
override.returns(
|
129
|
-
T::Array[Anthropic::Beta::BetaBase64PDFBlock::Source::Variants]
|
130
|
-
)
|
131
|
-
end
|
132
|
-
def self.variants
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
8
|
+
BetaBase64PDFBlock = Anthropic::Models::Beta::BetaRequestDocumentBlock
|
136
9
|
end
|
137
10
|
end
|
138
11
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaCitationSearchResultLocation = Beta::BetaCitationSearchResultLocation
|
6
|
+
|
7
|
+
module Beta
|
8
|
+
class BetaCitationSearchResultLocation < Anthropic::Internal::Type::BaseModel
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Anthropic::Beta::BetaCitationSearchResultLocation,
|
13
|
+
Anthropic::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig { returns(String) }
|
18
|
+
attr_accessor :cited_text
|
19
|
+
|
20
|
+
sig { returns(Integer) }
|
21
|
+
attr_accessor :end_block_index
|
22
|
+
|
23
|
+
sig { returns(Integer) }
|
24
|
+
attr_accessor :search_result_index
|
25
|
+
|
26
|
+
sig { returns(String) }
|
27
|
+
attr_accessor :source
|
28
|
+
|
29
|
+
sig { returns(Integer) }
|
30
|
+
attr_accessor :start_block_index
|
31
|
+
|
32
|
+
sig { returns(T.nilable(String)) }
|
33
|
+
attr_accessor :title
|
34
|
+
|
35
|
+
sig { returns(Symbol) }
|
36
|
+
attr_accessor :type
|
37
|
+
|
38
|
+
sig do
|
39
|
+
params(
|
40
|
+
cited_text: String,
|
41
|
+
end_block_index: Integer,
|
42
|
+
search_result_index: Integer,
|
43
|
+
source: String,
|
44
|
+
start_block_index: Integer,
|
45
|
+
title: T.nilable(String),
|
46
|
+
type: Symbol
|
47
|
+
).returns(T.attached_class)
|
48
|
+
end
|
49
|
+
def self.new(
|
50
|
+
cited_text:,
|
51
|
+
end_block_index:,
|
52
|
+
search_result_index:,
|
53
|
+
source:,
|
54
|
+
start_block_index:,
|
55
|
+
title:,
|
56
|
+
type: :search_result_location
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
sig do
|
61
|
+
override.returns(
|
62
|
+
{
|
63
|
+
cited_text: String,
|
64
|
+
end_block_index: Integer,
|
65
|
+
search_result_index: Integer,
|
66
|
+
source: String,
|
67
|
+
start_block_index: Integer,
|
68
|
+
title: T.nilable(String),
|
69
|
+
type: Symbol
|
70
|
+
}
|
71
|
+
)
|
72
|
+
end
|
73
|
+
def to_hash
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaCitationSearchResultLocationParam =
|
6
|
+
Beta::BetaCitationSearchResultLocationParam
|
7
|
+
|
8
|
+
module Beta
|
9
|
+
class BetaCitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
|
10
|
+
OrHash =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(
|
13
|
+
Anthropic::Beta::BetaCitationSearchResultLocationParam,
|
14
|
+
Anthropic::Internal::AnyHash
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
sig { returns(String) }
|
19
|
+
attr_accessor :cited_text
|
20
|
+
|
21
|
+
sig { returns(Integer) }
|
22
|
+
attr_accessor :end_block_index
|
23
|
+
|
24
|
+
sig { returns(Integer) }
|
25
|
+
attr_accessor :search_result_index
|
26
|
+
|
27
|
+
sig { returns(String) }
|
28
|
+
attr_accessor :source
|
29
|
+
|
30
|
+
sig { returns(Integer) }
|
31
|
+
attr_accessor :start_block_index
|
32
|
+
|
33
|
+
sig { returns(T.nilable(String)) }
|
34
|
+
attr_accessor :title
|
35
|
+
|
36
|
+
sig { returns(Symbol) }
|
37
|
+
attr_accessor :type
|
38
|
+
|
39
|
+
sig do
|
40
|
+
params(
|
41
|
+
cited_text: String,
|
42
|
+
end_block_index: Integer,
|
43
|
+
search_result_index: Integer,
|
44
|
+
source: String,
|
45
|
+
start_block_index: Integer,
|
46
|
+
title: T.nilable(String),
|
47
|
+
type: Symbol
|
48
|
+
).returns(T.attached_class)
|
49
|
+
end
|
50
|
+
def self.new(
|
51
|
+
cited_text:,
|
52
|
+
end_block_index:,
|
53
|
+
search_result_index:,
|
54
|
+
source:,
|
55
|
+
start_block_index:,
|
56
|
+
title:,
|
57
|
+
type: :search_result_location
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
sig do
|
62
|
+
override.returns(
|
63
|
+
{
|
64
|
+
cited_text: String,
|
65
|
+
end_block_index: Integer,
|
66
|
+
search_result_index: Integer,
|
67
|
+
source: String,
|
68
|
+
start_block_index: Integer,
|
69
|
+
title: T.nilable(String),
|
70
|
+
type: Symbol
|
71
|
+
}
|
72
|
+
)
|
73
|
+
end
|
74
|
+
def to_hash
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -27,7 +27,8 @@ module Anthropic
|
|
27
27
|
Anthropic::Beta::BetaCitationCharLocation::OrHash,
|
28
28
|
Anthropic::Beta::BetaCitationPageLocation::OrHash,
|
29
29
|
Anthropic::Beta::BetaCitationContentBlockLocation::OrHash,
|
30
|
-
Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash
|
30
|
+
Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash,
|
31
|
+
Anthropic::Beta::BetaCitationSearchResultLocation::OrHash
|
31
32
|
),
|
32
33
|
type: Symbol
|
33
34
|
).returns(T.attached_class)
|
@@ -55,7 +56,8 @@ module Anthropic
|
|
55
56
|
Anthropic::Beta::BetaCitationCharLocation,
|
56
57
|
Anthropic::Beta::BetaCitationPageLocation,
|
57
58
|
Anthropic::Beta::BetaCitationContentBlockLocation,
|
58
|
-
Anthropic::Beta::BetaCitationsWebSearchResultLocation
|
59
|
+
Anthropic::Beta::BetaCitationsWebSearchResultLocation,
|
60
|
+
Anthropic::Beta::BetaCitationSearchResultLocation
|
59
61
|
)
|
60
62
|
end
|
61
63
|
|
@@ -13,15 +13,15 @@ module Anthropic
|
|
13
13
|
T.type_alias do
|
14
14
|
T.any(
|
15
15
|
Anthropic::Beta::BetaTextBlock,
|
16
|
+
Anthropic::Beta::BetaThinkingBlock,
|
17
|
+
Anthropic::Beta::BetaRedactedThinkingBlock,
|
16
18
|
Anthropic::Beta::BetaToolUseBlock,
|
17
19
|
Anthropic::Beta::BetaServerToolUseBlock,
|
18
20
|
Anthropic::Beta::BetaWebSearchToolResultBlock,
|
19
21
|
Anthropic::Beta::BetaCodeExecutionToolResultBlock,
|
20
22
|
Anthropic::Beta::BetaMCPToolUseBlock,
|
21
23
|
Anthropic::Beta::BetaMCPToolResultBlock,
|
22
|
-
Anthropic::Beta::BetaContainerUploadBlock
|
23
|
-
Anthropic::Beta::BetaThinkingBlock,
|
24
|
-
Anthropic::Beta::BetaRedactedThinkingBlock
|
24
|
+
Anthropic::Beta::BetaContainerUploadBlock
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
@@ -12,18 +12,19 @@ module Anthropic
|
|
12
12
|
Variants =
|
13
13
|
T.type_alias do
|
14
14
|
T.any(
|
15
|
+
Anthropic::Beta::BetaTextBlockParam,
|
16
|
+
Anthropic::Beta::BetaImageBlockParam,
|
17
|
+
Anthropic::Beta::BetaRequestDocumentBlock,
|
18
|
+
Anthropic::Beta::BetaSearchResultBlockParam,
|
19
|
+
Anthropic::Beta::BetaThinkingBlockParam,
|
20
|
+
Anthropic::Beta::BetaRedactedThinkingBlockParam,
|
21
|
+
Anthropic::Beta::BetaToolUseBlockParam,
|
22
|
+
Anthropic::Beta::BetaToolResultBlockParam,
|
15
23
|
Anthropic::Beta::BetaServerToolUseBlockParam,
|
16
24
|
Anthropic::Beta::BetaWebSearchToolResultBlockParam,
|
17
25
|
Anthropic::Beta::BetaCodeExecutionToolResultBlockParam,
|
18
26
|
Anthropic::Beta::BetaMCPToolUseBlockParam,
|
19
27
|
Anthropic::Beta::BetaRequestMCPToolResultBlockParam,
|
20
|
-
Anthropic::Beta::BetaTextBlockParam,
|
21
|
-
Anthropic::Beta::BetaImageBlockParam,
|
22
|
-
Anthropic::Beta::BetaToolUseBlockParam,
|
23
|
-
Anthropic::Beta::BetaToolResultBlockParam,
|
24
|
-
Anthropic::Beta::BetaBase64PDFBlock,
|
25
|
-
Anthropic::Beta::BetaThinkingBlockParam,
|
26
|
-
Anthropic::Beta::BetaRedactedThinkingBlockParam,
|
27
28
|
Anthropic::Beta::BetaContainerUploadBlockParam
|
28
29
|
)
|
29
30
|
end
|
@@ -84,6 +84,10 @@ module Anthropic
|
|
84
84
|
# - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
85
85
|
# - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
86
86
|
# - `"tool_use"`: the model invoked one or more tools
|
87
|
+
# - `"pause_turn"`: we paused a long-running turn. You may provide the response
|
88
|
+
# back as-is in a subsequent request to let the model continue.
|
89
|
+
# - `"refusal"`: when streaming classifiers intervene to handle potential policy
|
90
|
+
# violations
|
87
91
|
#
|
88
92
|
# In non-streaming mode this value is always non-null. In streaming mode, it is
|
89
93
|
# null in the `message_start` event and non-null otherwise.
|
@@ -134,15 +138,15 @@ module Anthropic
|
|
134
138
|
T::Array[
|
135
139
|
T.any(
|
136
140
|
Anthropic::Beta::BetaTextBlock::OrHash,
|
141
|
+
Anthropic::Beta::BetaThinkingBlock::OrHash,
|
142
|
+
Anthropic::Beta::BetaRedactedThinkingBlock::OrHash,
|
137
143
|
Anthropic::Beta::BetaToolUseBlock::OrHash,
|
138
144
|
Anthropic::Beta::BetaServerToolUseBlock::OrHash,
|
139
145
|
Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
|
140
146
|
Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
|
141
147
|
Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
|
142
148
|
Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
|
143
|
-
Anthropic::Beta::BetaContainerUploadBlock::OrHash
|
144
|
-
Anthropic::Beta::BetaThinkingBlock::OrHash,
|
145
|
-
Anthropic::Beta::BetaRedactedThinkingBlock::OrHash
|
149
|
+
Anthropic::Beta::BetaContainerUploadBlock::OrHash
|
146
150
|
)
|
147
151
|
],
|
148
152
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
@@ -206,6 +210,10 @@ module Anthropic
|
|
206
210
|
# - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
207
211
|
# - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
208
212
|
# - `"tool_use"`: the model invoked one or more tools
|
213
|
+
# - `"pause_turn"`: we paused a long-running turn. You may provide the response
|
214
|
+
# back as-is in a subsequent request to let the model continue.
|
215
|
+
# - `"refusal"`: when streaming classifiers intervene to handle potential policy
|
216
|
+
# violations
|
209
217
|
#
|
210
218
|
# In non-streaming mode this value is always non-null. In streaming mode, it is
|
211
219
|
# null in the `message_start` event and non-null otherwise.
|
@@ -33,15 +33,15 @@ module Anthropic
|
|
33
33
|
content_block:
|
34
34
|
T.any(
|
35
35
|
Anthropic::Beta::BetaTextBlock::OrHash,
|
36
|
+
Anthropic::Beta::BetaThinkingBlock::OrHash,
|
37
|
+
Anthropic::Beta::BetaRedactedThinkingBlock::OrHash,
|
36
38
|
Anthropic::Beta::BetaToolUseBlock::OrHash,
|
37
39
|
Anthropic::Beta::BetaServerToolUseBlock::OrHash,
|
38
40
|
Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
|
39
41
|
Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
|
40
42
|
Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
|
41
43
|
Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
|
42
|
-
Anthropic::Beta::BetaContainerUploadBlock::OrHash
|
43
|
-
Anthropic::Beta::BetaThinkingBlock::OrHash,
|
44
|
-
Anthropic::Beta::BetaRedactedThinkingBlock::OrHash
|
44
|
+
Anthropic::Beta::BetaContainerUploadBlock::OrHash
|
45
45
|
),
|
46
46
|
index: Integer,
|
47
47
|
type: Symbol
|
@@ -76,15 +76,15 @@ module Anthropic
|
|
76
76
|
T.type_alias do
|
77
77
|
T.any(
|
78
78
|
Anthropic::Beta::BetaTextBlock,
|
79
|
+
Anthropic::Beta::BetaThinkingBlock,
|
80
|
+
Anthropic::Beta::BetaRedactedThinkingBlock,
|
79
81
|
Anthropic::Beta::BetaToolUseBlock,
|
80
82
|
Anthropic::Beta::BetaServerToolUseBlock,
|
81
83
|
Anthropic::Beta::BetaWebSearchToolResultBlock,
|
82
84
|
Anthropic::Beta::BetaCodeExecutionToolResultBlock,
|
83
85
|
Anthropic::Beta::BetaMCPToolUseBlock,
|
84
86
|
Anthropic::Beta::BetaMCPToolResultBlock,
|
85
|
-
Anthropic::Beta::BetaContainerUploadBlock
|
86
|
-
Anthropic::Beta::BetaThinkingBlock,
|
87
|
-
Anthropic::Beta::BetaRedactedThinkingBlock
|
87
|
+
Anthropic::Beta::BetaContainerUploadBlock
|
88
88
|
)
|
89
89
|
end
|
90
90
|
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaRequestDocumentBlock = Beta::BetaRequestDocumentBlock
|
6
|
+
|
7
|
+
module Beta
|
8
|
+
class BetaRequestDocumentBlock < Anthropic::Internal::Type::BaseModel
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Anthropic::Beta::BetaRequestDocumentBlock,
|
13
|
+
Anthropic::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig do
|
18
|
+
returns(
|
19
|
+
T.any(
|
20
|
+
Anthropic::Beta::BetaBase64PDFSource,
|
21
|
+
Anthropic::Beta::BetaPlainTextSource,
|
22
|
+
Anthropic::Beta::BetaContentBlockSource,
|
23
|
+
Anthropic::Beta::BetaURLPDFSource,
|
24
|
+
Anthropic::Beta::BetaFileDocumentSource
|
25
|
+
)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
attr_accessor :source
|
29
|
+
|
30
|
+
sig { returns(Symbol) }
|
31
|
+
attr_accessor :type
|
32
|
+
|
33
|
+
# Create a cache control breakpoint at this content block.
|
34
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
|
35
|
+
attr_reader :cache_control
|
36
|
+
|
37
|
+
sig do
|
38
|
+
params(
|
39
|
+
cache_control:
|
40
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
|
41
|
+
).void
|
42
|
+
end
|
43
|
+
attr_writer :cache_control
|
44
|
+
|
45
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaCitationsConfigParam)) }
|
46
|
+
attr_reader :citations
|
47
|
+
|
48
|
+
sig do
|
49
|
+
params(
|
50
|
+
citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash
|
51
|
+
).void
|
52
|
+
end
|
53
|
+
attr_writer :citations
|
54
|
+
|
55
|
+
sig { returns(T.nilable(String)) }
|
56
|
+
attr_accessor :context
|
57
|
+
|
58
|
+
sig { returns(T.nilable(String)) }
|
59
|
+
attr_accessor :title
|
60
|
+
|
61
|
+
sig do
|
62
|
+
params(
|
63
|
+
source:
|
64
|
+
T.any(
|
65
|
+
Anthropic::Beta::BetaBase64PDFSource::OrHash,
|
66
|
+
Anthropic::Beta::BetaPlainTextSource::OrHash,
|
67
|
+
Anthropic::Beta::BetaContentBlockSource::OrHash,
|
68
|
+
Anthropic::Beta::BetaURLPDFSource::OrHash,
|
69
|
+
Anthropic::Beta::BetaFileDocumentSource::OrHash
|
70
|
+
),
|
71
|
+
cache_control:
|
72
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
73
|
+
citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash,
|
74
|
+
context: T.nilable(String),
|
75
|
+
title: T.nilable(String),
|
76
|
+
type: Symbol
|
77
|
+
).returns(T.attached_class)
|
78
|
+
end
|
79
|
+
def self.new(
|
80
|
+
source:,
|
81
|
+
# Create a cache control breakpoint at this content block.
|
82
|
+
cache_control: nil,
|
83
|
+
citations: nil,
|
84
|
+
context: nil,
|
85
|
+
title: nil,
|
86
|
+
type: :document
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
sig do
|
91
|
+
override.returns(
|
92
|
+
{
|
93
|
+
source:
|
94
|
+
T.any(
|
95
|
+
Anthropic::Beta::BetaBase64PDFSource,
|
96
|
+
Anthropic::Beta::BetaPlainTextSource,
|
97
|
+
Anthropic::Beta::BetaContentBlockSource,
|
98
|
+
Anthropic::Beta::BetaURLPDFSource,
|
99
|
+
Anthropic::Beta::BetaFileDocumentSource
|
100
|
+
),
|
101
|
+
type: Symbol,
|
102
|
+
cache_control:
|
103
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
104
|
+
citations: Anthropic::Beta::BetaCitationsConfigParam,
|
105
|
+
context: T.nilable(String),
|
106
|
+
title: T.nilable(String)
|
107
|
+
}
|
108
|
+
)
|
109
|
+
end
|
110
|
+
def to_hash
|
111
|
+
end
|
112
|
+
|
113
|
+
module Source
|
114
|
+
extend Anthropic::Internal::Type::Union
|
115
|
+
|
116
|
+
Variants =
|
117
|
+
T.type_alias do
|
118
|
+
T.any(
|
119
|
+
Anthropic::Beta::BetaBase64PDFSource,
|
120
|
+
Anthropic::Beta::BetaPlainTextSource,
|
121
|
+
Anthropic::Beta::BetaContentBlockSource,
|
122
|
+
Anthropic::Beta::BetaURLPDFSource,
|
123
|
+
Anthropic::Beta::BetaFileDocumentSource
|
124
|
+
)
|
125
|
+
end
|
126
|
+
|
127
|
+
sig do
|
128
|
+
override.returns(
|
129
|
+
T::Array[
|
130
|
+
Anthropic::Beta::BetaRequestDocumentBlock::Source::Variants
|
131
|
+
]
|
132
|
+
)
|
133
|
+
end
|
134
|
+
def self.variants
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaSearchResultBlockParam = Beta::BetaSearchResultBlockParam
|
6
|
+
|
7
|
+
module Beta
|
8
|
+
class BetaSearchResultBlockParam < Anthropic::Internal::Type::BaseModel
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Anthropic::Beta::BetaSearchResultBlockParam,
|
13
|
+
Anthropic::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig { returns(T::Array[Anthropic::Beta::BetaTextBlockParam]) }
|
18
|
+
attr_accessor :content
|
19
|
+
|
20
|
+
sig { returns(String) }
|
21
|
+
attr_accessor :source
|
22
|
+
|
23
|
+
sig { returns(String) }
|
24
|
+
attr_accessor :title
|
25
|
+
|
26
|
+
sig { returns(Symbol) }
|
27
|
+
attr_accessor :type
|
28
|
+
|
29
|
+
# Create a cache control breakpoint at this content block.
|
30
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
|
31
|
+
attr_reader :cache_control
|
32
|
+
|
33
|
+
sig do
|
34
|
+
params(
|
35
|
+
cache_control:
|
36
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
|
37
|
+
).void
|
38
|
+
end
|
39
|
+
attr_writer :cache_control
|
40
|
+
|
41
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaCitationsConfigParam)) }
|
42
|
+
attr_reader :citations
|
43
|
+
|
44
|
+
sig do
|
45
|
+
params(
|
46
|
+
citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash
|
47
|
+
).void
|
48
|
+
end
|
49
|
+
attr_writer :citations
|
50
|
+
|
51
|
+
sig do
|
52
|
+
params(
|
53
|
+
content: T::Array[Anthropic::Beta::BetaTextBlockParam::OrHash],
|
54
|
+
source: String,
|
55
|
+
title: String,
|
56
|
+
cache_control:
|
57
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
58
|
+
citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash,
|
59
|
+
type: Symbol
|
60
|
+
).returns(T.attached_class)
|
61
|
+
end
|
62
|
+
def self.new(
|
63
|
+
content:,
|
64
|
+
source:,
|
65
|
+
title:,
|
66
|
+
# Create a cache control breakpoint at this content block.
|
67
|
+
cache_control: nil,
|
68
|
+
citations: nil,
|
69
|
+
type: :search_result
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
sig do
|
74
|
+
override.returns(
|
75
|
+
{
|
76
|
+
content: T::Array[Anthropic::Beta::BetaTextBlockParam],
|
77
|
+
source: String,
|
78
|
+
title: String,
|
79
|
+
type: Symbol,
|
80
|
+
cache_control:
|
81
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
82
|
+
citations: Anthropic::Beta::BetaCitationsConfigParam
|
83
|
+
}
|
84
|
+
)
|
85
|
+
end
|
86
|
+
def to_hash
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -38,7 +38,8 @@ module Anthropic
|
|
38
38
|
Anthropic::Beta::BetaCitationCharLocation::OrHash,
|
39
39
|
Anthropic::Beta::BetaCitationPageLocation::OrHash,
|
40
40
|
Anthropic::Beta::BetaCitationContentBlockLocation::OrHash,
|
41
|
-
Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash
|
41
|
+
Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash,
|
42
|
+
Anthropic::Beta::BetaCitationSearchResultLocation::OrHash
|
42
43
|
)
|
43
44
|
]
|
44
45
|
),
|