anthropic 1.7.0 → 1.8.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 +20 -0
- data/README.md +1 -1
- data/lib/anthropic/helpers/input_schema/array_of.rb +41 -0
- data/lib/anthropic/helpers/input_schema/base_model.rb +86 -0
- data/lib/anthropic/helpers/input_schema/boolean.rb +29 -0
- data/lib/anthropic/helpers/input_schema/enum_of.rb +63 -0
- data/lib/anthropic/helpers/input_schema/json_schema_converter.rb +199 -0
- data/lib/anthropic/helpers/input_schema/parsed_json.rb +39 -0
- data/lib/anthropic/helpers/input_schema/property_mapping.rb +47 -0
- data/lib/anthropic/helpers/input_schema/union_of.rb +56 -0
- data/lib/anthropic/helpers/input_schema.rb +16 -0
- data/lib/anthropic/helpers/streaming/message_stream.rb +41 -1
- data/lib/anthropic/input_schema.rb +10 -0
- data/lib/anthropic/internal/stream.rb +2 -1
- data/lib/anthropic/internal/transport/base_client.rb +1 -2
- data/lib/anthropic/internal/transport/pooled_net_requester.rb +1 -9
- data/lib/anthropic/internal/type/base_model.rb +2 -9
- data/lib/anthropic/internal/util.rb +1 -1
- data/lib/anthropic/models/beta/beta_bash_code_execution_output_block.rb +25 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_output_block_param.rb +25 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_result_block.rb +44 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_result_block_param.rb +44 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rb +43 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rb +53 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rb +39 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rb +39 -0
- data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +40 -0
- data/lib/anthropic/models/beta/beta_content_block.rb +6 -1
- data/lib/anthropic/models/beta/beta_content_block_param.rb +7 -1
- data/lib/anthropic/models/beta/beta_message.rb +2 -2
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +8 -3
- data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +2 -0
- data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +2 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rb +25 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rb +26 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rb +49 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rb +50 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rb +47 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rb +57 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rb +45 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rb +46 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rb +61 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rb +62 -0
- data/lib/anthropic/models/beta/beta_tool_union.rb +3 -1
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +7 -30
- data/lib/anthropic/models/beta/message_create_params.rb +3 -26
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +6 -36
- data/lib/anthropic/models/beta/messages/beta_message_batch.rb +1 -4
- data/lib/anthropic/models/beta_error_response.rb +7 -1
- data/lib/anthropic/models/error_response.rb +7 -1
- data/lib/anthropic/models/message_count_tokens_params.rb +1 -24
- data/lib/anthropic/models/message_create_params.rb +1 -24
- data/lib/anthropic/models/messages/batch_create_params.rb +2 -28
- data/lib/anthropic/models/tool_use_block.rb +8 -0
- data/lib/anthropic/resources/beta/messages.rb +3 -3
- data/lib/anthropic/resources/messages.rb +85 -1
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +29 -0
- data/rbi/anthropic/errors.rbi +2 -2
- data/rbi/anthropic/helpers/input_schema/array_of.rbi +16 -0
- data/rbi/anthropic/helpers/input_schema/base_model.rbi +21 -0
- data/rbi/anthropic/helpers/input_schema/boolean.rbi +11 -0
- data/rbi/anthropic/helpers/input_schema/enum_of.rbi +30 -0
- data/rbi/anthropic/helpers/input_schema/json_schema_converter.rbi +89 -0
- data/rbi/anthropic/helpers/input_schema/union_of.rbi +23 -0
- data/rbi/anthropic/helpers/structured_output.rbi +16 -0
- data/rbi/anthropic/input_schema.rbi +12 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbi +34 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbi +77 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbi +86 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbi +101 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbi +101 -0
- data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_content_block.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +4 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbi +41 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbi +41 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbi +73 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbi +73 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbi +90 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbi +118 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbi +118 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbi +118 -0
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +1 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +7 -48
- data/rbi/anthropic/models/beta/message_create_params.rbi +6 -48
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +6 -48
- data/rbi/anthropic/models/beta_error_response.rbi +10 -2
- data/rbi/anthropic/models/error_response.rbi +10 -2
- data/rbi/anthropic/models/message_count_tokens_params.rbi +2 -48
- data/rbi/anthropic/models/message_create_params.rbi +2 -48
- data/rbi/anthropic/models/messages/batch_create_params.rbi +2 -48
- data/rbi/anthropic/resources/beta/messages.rbi +6 -72
- data/rbi/anthropic/resources/messages.rbi +3 -72
- data/sig/anthropic/models/beta/beta_bash_code_execution_output_block.rbs +23 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbs +23 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_result_block.rbs +44 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbs +44 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbs +44 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbs +49 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbs +48 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbs +48 -0
- data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +2 -0
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +2 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -0
- data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +7 -1
- data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +7 -1
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbs +29 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbs +29 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbs +49 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbs +49 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbs +46 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbs +51 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbs +53 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbs +53 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbs +61 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbs +61 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +1 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +1 -0
- data/sig/anthropic/models/beta_error_response.rbs +13 -2
- data/sig/anthropic/models/error_response.rbs +13 -2
- metadata +77 -2
@@ -0,0 +1,89 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
module InputSchema
|
6
|
+
JsonSchema = T.type_alias { Anthropic::Internal::AnyHash }
|
7
|
+
|
8
|
+
# To customize the JSON schema conversion for a type, implement the `JsonSchemaConverter` interface.
|
9
|
+
module JsonSchemaConverter
|
10
|
+
POINTER = T.let(Object.new.freeze, T.anything)
|
11
|
+
COUNTER = T.let(Object.new.freeze, T.anything)
|
12
|
+
|
13
|
+
Input =
|
14
|
+
T.type_alias do
|
15
|
+
T.any(
|
16
|
+
Anthropic::Helpers::InputSchema::JsonSchemaConverter,
|
17
|
+
T::Class[T.anything]
|
18
|
+
)
|
19
|
+
end
|
20
|
+
State =
|
21
|
+
T.type_alias do
|
22
|
+
{ defs: T::Hash[Object, String], path: T::Array[String] }
|
23
|
+
end
|
24
|
+
|
25
|
+
# The exact JSON schema produced is subject to improvement between minor release versions.
|
26
|
+
sig do
|
27
|
+
params(
|
28
|
+
state: Anthropic::Helpers::InputSchema::JsonSchemaConverter::State
|
29
|
+
).returns(Anthropic::Helpers::InputSchema::JsonSchema)
|
30
|
+
end
|
31
|
+
def to_json_schema_inner(state:)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Internal helpers methods.
|
35
|
+
class << self
|
36
|
+
# @api private
|
37
|
+
sig do
|
38
|
+
params(schema: Anthropic::Helpers::InputSchema::JsonSchema).returns(
|
39
|
+
Anthropic::Helpers::InputSchema::JsonSchema
|
40
|
+
)
|
41
|
+
end
|
42
|
+
def to_nilable(schema)
|
43
|
+
end
|
44
|
+
|
45
|
+
# @api private
|
46
|
+
sig do
|
47
|
+
params(
|
48
|
+
schema: Anthropic::Helpers::InputSchema::JsonSchema,
|
49
|
+
meta: Anthropic::Internal::AnyHash
|
50
|
+
).void
|
51
|
+
end
|
52
|
+
def assoc_meta!(schema, meta:)
|
53
|
+
end
|
54
|
+
|
55
|
+
# @api private
|
56
|
+
sig do
|
57
|
+
params(
|
58
|
+
state:
|
59
|
+
Anthropic::Helpers::InputSchema::JsonSchemaConverter::State,
|
60
|
+
type: Anthropic::Helpers::InputSchema::JsonSchemaConverter::Input,
|
61
|
+
blk: T.proc.returns(Anthropic::Helpers::InputSchema::JsonSchema)
|
62
|
+
).void
|
63
|
+
end
|
64
|
+
def cache_def!(state, type:, &blk)
|
65
|
+
end
|
66
|
+
|
67
|
+
# @api private
|
68
|
+
sig do
|
69
|
+
params(
|
70
|
+
type: Anthropic::Helpers::InputSchema::JsonSchemaConverter::Input
|
71
|
+
).returns(Anthropic::Helpers::InputSchema::JsonSchema)
|
72
|
+
end
|
73
|
+
def to_json_schema(type)
|
74
|
+
end
|
75
|
+
|
76
|
+
# @api private
|
77
|
+
sig do
|
78
|
+
params(
|
79
|
+
type: Anthropic::Helpers::InputSchema::JsonSchemaConverter::Input,
|
80
|
+
state: Anthropic::Helpers::InputSchema::JsonSchemaConverter::State
|
81
|
+
).returns(Anthropic::Helpers::InputSchema::JsonSchema)
|
82
|
+
end
|
83
|
+
def to_json_schema_inner(type, state:)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
module InputSchema
|
6
|
+
# @example
|
7
|
+
# example = Anthropic::UnionOf[Float, Anthropic::ArrayOf[Integer]]
|
8
|
+
class UnionOf
|
9
|
+
include Anthropic::Internal::Type::Union
|
10
|
+
include Anthropic::Helpers::InputSchema::JsonSchemaConverter
|
11
|
+
|
12
|
+
sig do
|
13
|
+
params(
|
14
|
+
variants:
|
15
|
+
Anthropic::Helpers::InputSchema::JsonSchemaConverter::Input
|
16
|
+
).returns(T.attached_class)
|
17
|
+
end
|
18
|
+
def self.[](*variants)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
# Helpers for the structured output API.
|
6
|
+
#
|
7
|
+
# see https://platform.Anthropic.com/docs/guides/structured-outputs
|
8
|
+
# see https://json-schema.org
|
9
|
+
#
|
10
|
+
# Based on the DSL in {Anthropic::Internal::Type}, but currently only support the limited subset of JSON schema types used in structured output APIs.
|
11
|
+
#
|
12
|
+
# Supported types: {NilClass} {String} {Symbol} {Integer} {Float} {Anthropic::Boolean}, {Anthropic::EnumOf}, {Anthropic::UnionOf}, {Anthropic::ArrayOf}, {Anthropic::BaseModel}
|
13
|
+
module InputSchema
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Anthropic
|
5
|
+
# Convenience aliases for input schema classes
|
6
|
+
InputSchema = Anthropic::Helpers::InputSchema
|
7
|
+
ArrayOf = Anthropic::Helpers::InputSchema::ArrayOf
|
8
|
+
BaseModel = Anthropic::Helpers::InputSchema::BaseModel
|
9
|
+
Boolean = Anthropic::Helpers::InputSchema::Boolean
|
10
|
+
EnumOf = Anthropic::Helpers::InputSchema::EnumOf
|
11
|
+
UnionOf = Anthropic::Helpers::InputSchema::UnionOf
|
12
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaBashCodeExecutionOutputBlock = Beta::BetaBashCodeExecutionOutputBlock
|
6
|
+
|
7
|
+
module Beta
|
8
|
+
class BetaBashCodeExecutionOutputBlock < Anthropic::Internal::Type::BaseModel
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Anthropic::Beta::BetaBashCodeExecutionOutputBlock,
|
13
|
+
Anthropic::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig { returns(String) }
|
18
|
+
attr_accessor :file_id
|
19
|
+
|
20
|
+
sig { returns(Symbol) }
|
21
|
+
attr_accessor :type
|
22
|
+
|
23
|
+
sig { params(file_id: String, type: Symbol).returns(T.attached_class) }
|
24
|
+
def self.new(file_id:, type: :bash_code_execution_output)
|
25
|
+
end
|
26
|
+
|
27
|
+
sig { override.returns({ file_id: String, type: Symbol }) }
|
28
|
+
def to_hash
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaBashCodeExecutionOutputBlockParam =
|
6
|
+
Beta::BetaBashCodeExecutionOutputBlockParam
|
7
|
+
|
8
|
+
module Beta
|
9
|
+
class BetaBashCodeExecutionOutputBlockParam < Anthropic::Internal::Type::BaseModel
|
10
|
+
OrHash =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(
|
13
|
+
Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam,
|
14
|
+
Anthropic::Internal::AnyHash
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
sig { returns(String) }
|
19
|
+
attr_accessor :file_id
|
20
|
+
|
21
|
+
sig { returns(Symbol) }
|
22
|
+
attr_accessor :type
|
23
|
+
|
24
|
+
sig { params(file_id: String, type: Symbol).returns(T.attached_class) }
|
25
|
+
def self.new(file_id:, type: :bash_code_execution_output)
|
26
|
+
end
|
27
|
+
|
28
|
+
sig { override.returns({ file_id: String, type: Symbol }) }
|
29
|
+
def to_hash
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaBashCodeExecutionResultBlock = Beta::BetaBashCodeExecutionResultBlock
|
6
|
+
|
7
|
+
module Beta
|
8
|
+
class BetaBashCodeExecutionResultBlock < Anthropic::Internal::Type::BaseModel
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlock,
|
13
|
+
Anthropic::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig do
|
18
|
+
returns(T::Array[Anthropic::Beta::BetaBashCodeExecutionOutputBlock])
|
19
|
+
end
|
20
|
+
attr_accessor :content
|
21
|
+
|
22
|
+
sig { returns(Integer) }
|
23
|
+
attr_accessor :return_code
|
24
|
+
|
25
|
+
sig { returns(String) }
|
26
|
+
attr_accessor :stderr
|
27
|
+
|
28
|
+
sig { returns(String) }
|
29
|
+
attr_accessor :stdout
|
30
|
+
|
31
|
+
sig { returns(Symbol) }
|
32
|
+
attr_accessor :type
|
33
|
+
|
34
|
+
sig do
|
35
|
+
params(
|
36
|
+
content:
|
37
|
+
T::Array[
|
38
|
+
Anthropic::Beta::BetaBashCodeExecutionOutputBlock::OrHash
|
39
|
+
],
|
40
|
+
return_code: Integer,
|
41
|
+
stderr: String,
|
42
|
+
stdout: String,
|
43
|
+
type: Symbol
|
44
|
+
).returns(T.attached_class)
|
45
|
+
end
|
46
|
+
def self.new(
|
47
|
+
content:,
|
48
|
+
return_code:,
|
49
|
+
stderr:,
|
50
|
+
stdout:,
|
51
|
+
type: :bash_code_execution_result
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
sig do
|
56
|
+
override.returns(
|
57
|
+
{
|
58
|
+
content:
|
59
|
+
T::Array[Anthropic::Beta::BetaBashCodeExecutionOutputBlock],
|
60
|
+
return_code: Integer,
|
61
|
+
stderr: String,
|
62
|
+
stdout: String,
|
63
|
+
type: Symbol
|
64
|
+
}
|
65
|
+
)
|
66
|
+
end
|
67
|
+
def to_hash
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaBashCodeExecutionResultBlockParam =
|
6
|
+
Beta::BetaBashCodeExecutionResultBlockParam
|
7
|
+
|
8
|
+
module Beta
|
9
|
+
class BetaBashCodeExecutionResultBlockParam < Anthropic::Internal::Type::BaseModel
|
10
|
+
OrHash =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(
|
13
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlockParam,
|
14
|
+
Anthropic::Internal::AnyHash
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
sig do
|
19
|
+
returns(
|
20
|
+
T::Array[Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam]
|
21
|
+
)
|
22
|
+
end
|
23
|
+
attr_accessor :content
|
24
|
+
|
25
|
+
sig { returns(Integer) }
|
26
|
+
attr_accessor :return_code
|
27
|
+
|
28
|
+
sig { returns(String) }
|
29
|
+
attr_accessor :stderr
|
30
|
+
|
31
|
+
sig { returns(String) }
|
32
|
+
attr_accessor :stdout
|
33
|
+
|
34
|
+
sig { returns(Symbol) }
|
35
|
+
attr_accessor :type
|
36
|
+
|
37
|
+
sig do
|
38
|
+
params(
|
39
|
+
content:
|
40
|
+
T::Array[
|
41
|
+
Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam::OrHash
|
42
|
+
],
|
43
|
+
return_code: Integer,
|
44
|
+
stderr: String,
|
45
|
+
stdout: String,
|
46
|
+
type: Symbol
|
47
|
+
).returns(T.attached_class)
|
48
|
+
end
|
49
|
+
def self.new(
|
50
|
+
content:,
|
51
|
+
return_code:,
|
52
|
+
stderr:,
|
53
|
+
stdout:,
|
54
|
+
type: :bash_code_execution_result
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
sig do
|
59
|
+
override.returns(
|
60
|
+
{
|
61
|
+
content:
|
62
|
+
T::Array[
|
63
|
+
Anthropic::Beta::BetaBashCodeExecutionOutputBlockParam
|
64
|
+
],
|
65
|
+
return_code: Integer,
|
66
|
+
stderr: String,
|
67
|
+
stdout: String,
|
68
|
+
type: Symbol
|
69
|
+
}
|
70
|
+
)
|
71
|
+
end
|
72
|
+
def to_hash
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaBashCodeExecutionToolResultBlock =
|
6
|
+
Beta::BetaBashCodeExecutionToolResultBlock
|
7
|
+
|
8
|
+
module Beta
|
9
|
+
class BetaBashCodeExecutionToolResultBlock < Anthropic::Internal::Type::BaseModel
|
10
|
+
OrHash =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(
|
13
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
|
14
|
+
Anthropic::Internal::AnyHash
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
sig do
|
19
|
+
returns(
|
20
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::Content::Variants
|
21
|
+
)
|
22
|
+
end
|
23
|
+
attr_accessor :content
|
24
|
+
|
25
|
+
sig { returns(String) }
|
26
|
+
attr_accessor :tool_use_id
|
27
|
+
|
28
|
+
sig { returns(Symbol) }
|
29
|
+
attr_accessor :type
|
30
|
+
|
31
|
+
sig do
|
32
|
+
params(
|
33
|
+
content:
|
34
|
+
T.any(
|
35
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::OrHash,
|
36
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlock::OrHash
|
37
|
+
),
|
38
|
+
tool_use_id: String,
|
39
|
+
type: Symbol
|
40
|
+
).returns(T.attached_class)
|
41
|
+
end
|
42
|
+
def self.new(
|
43
|
+
content:,
|
44
|
+
tool_use_id:,
|
45
|
+
type: :bash_code_execution_tool_result
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
sig do
|
50
|
+
override.returns(
|
51
|
+
{
|
52
|
+
content:
|
53
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::Content::Variants,
|
54
|
+
tool_use_id: String,
|
55
|
+
type: Symbol
|
56
|
+
}
|
57
|
+
)
|
58
|
+
end
|
59
|
+
def to_hash
|
60
|
+
end
|
61
|
+
|
62
|
+
module Content
|
63
|
+
extend Anthropic::Internal::Type::Union
|
64
|
+
|
65
|
+
Variants =
|
66
|
+
T.type_alias do
|
67
|
+
T.any(
|
68
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError,
|
69
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlock
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
sig do
|
74
|
+
override.returns(
|
75
|
+
T::Array[
|
76
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::Content::Variants
|
77
|
+
]
|
78
|
+
)
|
79
|
+
end
|
80
|
+
def self.variants
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaBashCodeExecutionToolResultBlockParam =
|
6
|
+
Beta::BetaBashCodeExecutionToolResultBlockParam
|
7
|
+
|
8
|
+
module Beta
|
9
|
+
class BetaBashCodeExecutionToolResultBlockParam < Anthropic::Internal::Type::BaseModel
|
10
|
+
OrHash =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(
|
13
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam,
|
14
|
+
Anthropic::Internal::AnyHash
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
sig do
|
19
|
+
returns(
|
20
|
+
T.any(
|
21
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam,
|
22
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlockParam
|
23
|
+
)
|
24
|
+
)
|
25
|
+
end
|
26
|
+
attr_accessor :content
|
27
|
+
|
28
|
+
sig { returns(String) }
|
29
|
+
attr_accessor :tool_use_id
|
30
|
+
|
31
|
+
sig { returns(Symbol) }
|
32
|
+
attr_accessor :type
|
33
|
+
|
34
|
+
# Create a cache control breakpoint at this content block.
|
35
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
|
36
|
+
attr_reader :cache_control
|
37
|
+
|
38
|
+
sig do
|
39
|
+
params(
|
40
|
+
cache_control:
|
41
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
|
42
|
+
).void
|
43
|
+
end
|
44
|
+
attr_writer :cache_control
|
45
|
+
|
46
|
+
sig do
|
47
|
+
params(
|
48
|
+
content:
|
49
|
+
T.any(
|
50
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam::OrHash,
|
51
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlockParam::OrHash
|
52
|
+
),
|
53
|
+
tool_use_id: String,
|
54
|
+
cache_control:
|
55
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
56
|
+
type: Symbol
|
57
|
+
).returns(T.attached_class)
|
58
|
+
end
|
59
|
+
def self.new(
|
60
|
+
content:,
|
61
|
+
tool_use_id:,
|
62
|
+
# Create a cache control breakpoint at this content block.
|
63
|
+
cache_control: nil,
|
64
|
+
type: :bash_code_execution_tool_result
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
sig do
|
69
|
+
override.returns(
|
70
|
+
{
|
71
|
+
content:
|
72
|
+
T.any(
|
73
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam,
|
74
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlockParam
|
75
|
+
),
|
76
|
+
tool_use_id: String,
|
77
|
+
type: Symbol,
|
78
|
+
cache_control:
|
79
|
+
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
|
80
|
+
}
|
81
|
+
)
|
82
|
+
end
|
83
|
+
def to_hash
|
84
|
+
end
|
85
|
+
|
86
|
+
module Content
|
87
|
+
extend Anthropic::Internal::Type::Union
|
88
|
+
|
89
|
+
Variants =
|
90
|
+
T.type_alias do
|
91
|
+
T.any(
|
92
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultErrorParam,
|
93
|
+
Anthropic::Beta::BetaBashCodeExecutionResultBlockParam
|
94
|
+
)
|
95
|
+
end
|
96
|
+
|
97
|
+
sig do
|
98
|
+
override.returns(
|
99
|
+
T::Array[
|
100
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam::Content::Variants
|
101
|
+
]
|
102
|
+
)
|
103
|
+
end
|
104
|
+
def self.variants
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
BetaBashCodeExecutionToolResultError =
|
6
|
+
Beta::BetaBashCodeExecutionToolResultError
|
7
|
+
|
8
|
+
module Beta
|
9
|
+
class BetaBashCodeExecutionToolResultError < Anthropic::Internal::Type::BaseModel
|
10
|
+
OrHash =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(
|
13
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError,
|
14
|
+
Anthropic::Internal::AnyHash
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
sig do
|
19
|
+
returns(
|
20
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
|
21
|
+
)
|
22
|
+
end
|
23
|
+
attr_accessor :error_code
|
24
|
+
|
25
|
+
sig { returns(Symbol) }
|
26
|
+
attr_accessor :type
|
27
|
+
|
28
|
+
sig do
|
29
|
+
params(
|
30
|
+
error_code:
|
31
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::OrSymbol,
|
32
|
+
type: Symbol
|
33
|
+
).returns(T.attached_class)
|
34
|
+
end
|
35
|
+
def self.new(error_code:, type: :bash_code_execution_tool_result_error)
|
36
|
+
end
|
37
|
+
|
38
|
+
sig do
|
39
|
+
override.returns(
|
40
|
+
{
|
41
|
+
error_code:
|
42
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol,
|
43
|
+
type: Symbol
|
44
|
+
}
|
45
|
+
)
|
46
|
+
end
|
47
|
+
def to_hash
|
48
|
+
end
|
49
|
+
|
50
|
+
module ErrorCode
|
51
|
+
extend Anthropic::Internal::Type::Enum
|
52
|
+
|
53
|
+
TaggedSymbol =
|
54
|
+
T.type_alias do
|
55
|
+
T.all(
|
56
|
+
Symbol,
|
57
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode
|
58
|
+
)
|
59
|
+
end
|
60
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
61
|
+
|
62
|
+
INVALID_TOOL_INPUT =
|
63
|
+
T.let(
|
64
|
+
:invalid_tool_input,
|
65
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
|
66
|
+
)
|
67
|
+
UNAVAILABLE =
|
68
|
+
T.let(
|
69
|
+
:unavailable,
|
70
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
|
71
|
+
)
|
72
|
+
TOO_MANY_REQUESTS =
|
73
|
+
T.let(
|
74
|
+
:too_many_requests,
|
75
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
|
76
|
+
)
|
77
|
+
EXECUTION_TIME_EXCEEDED =
|
78
|
+
T.let(
|
79
|
+
:execution_time_exceeded,
|
80
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
|
81
|
+
)
|
82
|
+
OUTPUT_FILE_TOO_LARGE =
|
83
|
+
T.let(
|
84
|
+
:output_file_too_large,
|
85
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
|
86
|
+
)
|
87
|
+
|
88
|
+
sig do
|
89
|
+
override.returns(
|
90
|
+
T::Array[
|
91
|
+
Anthropic::Beta::BetaBashCodeExecutionToolResultError::ErrorCode::TaggedSymbol
|
92
|
+
]
|
93
|
+
)
|
94
|
+
end
|
95
|
+
def self.values
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|