aws-sdk-bedrockruntime 1.0.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.
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::BedrockRuntime
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::BedrockRuntime::EndpointProvider',
17
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
+ 'object that responds to `#resolve_endpoint(parameters)` '\
19
+ 'where `parameters` is a Struct similar to '\
20
+ '`Aws::BedrockRuntime::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::BedrockRuntime::EndpointProvider.new
23
+ end
24
+
25
+ # @api private
26
+ class Handler < Seahorse::Client::Handler
27
+ def call(context)
28
+ # If endpoint was discovered, do not resolve or apply the endpoint.
29
+ unless context[:discovered_endpoint]
30
+ params = parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+ end
36
+
37
+ context[:endpoint_params] = params
38
+ context[:auth_scheme] =
39
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
+
41
+ @handler.call(context)
42
+ end
43
+
44
+ private
45
+
46
+ def apply_endpoint_headers(context, headers)
47
+ headers.each do |key, values|
48
+ value = values
49
+ .compact
50
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
51
+ .join(',')
52
+
53
+ context.http_request.headers[key] = value
54
+ end
55
+ end
56
+
57
+ def parameters_for_operation(context)
58
+ case context.operation_name
59
+ when :invoke_model
60
+ Aws::BedrockRuntime::Endpoints::InvokeModel.build(context)
61
+ when :invoke_model_with_response_stream
62
+ Aws::BedrockRuntime::Endpoints::InvokeModelWithResponseStream.build(context)
63
+ end
64
+ end
65
+ end
66
+
67
+ def add_handlers(handlers, _config)
68
+ handlers.add(Handler, step: :build, priority: 75)
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::BedrockRuntime
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,321 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::BedrockRuntime
11
+ module Types
12
+
13
+ # The request is denied because of missing access permissions.
14
+ #
15
+ # @!attribute [rw] message
16
+ # @return [String]
17
+ #
18
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/AccessDeniedException AWS API Documentation
19
+ #
20
+ class AccessDeniedException < Struct.new(
21
+ :message)
22
+ SENSITIVE = []
23
+ include Aws::Structure
24
+ end
25
+
26
+ # An internal server error occurred. Retry your request.
27
+ #
28
+ # @!attribute [rw] message
29
+ # @return [String]
30
+ #
31
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InternalServerException AWS API Documentation
32
+ #
33
+ class InternalServerException < Struct.new(
34
+ :message)
35
+ SENSITIVE = []
36
+ include Aws::Structure
37
+ end
38
+
39
+ # @!attribute [rw] accept
40
+ # The desired MIME type of the inference body in the response. The
41
+ # default value is `application/json`.
42
+ # @return [String]
43
+ #
44
+ # @!attribute [rw] body
45
+ # Input data in the format specified in the content-type request
46
+ # header. To see the format and content of this field for different
47
+ # models, refer to [Inference parameters][1].
48
+ #
49
+ #
50
+ #
51
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
52
+ # @return [String]
53
+ #
54
+ # @!attribute [rw] content_type
55
+ # The MIME type of the input data in the request. The default value is
56
+ # `application/json`.
57
+ # @return [String]
58
+ #
59
+ # @!attribute [rw] model_id
60
+ # Identifier of the model.
61
+ # @return [String]
62
+ #
63
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelRequest AWS API Documentation
64
+ #
65
+ class InvokeModelRequest < Struct.new(
66
+ :accept,
67
+ :body,
68
+ :content_type,
69
+ :model_id)
70
+ SENSITIVE = [:body]
71
+ include Aws::Structure
72
+ end
73
+
74
+ # @!attribute [rw] body
75
+ # Inference response from the model in the format specified in the
76
+ # content-type header field. To see the format and content of this
77
+ # field for different models, refer to [Inference parameters][1].
78
+ #
79
+ #
80
+ #
81
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
82
+ # @return [String]
83
+ #
84
+ # @!attribute [rw] content_type
85
+ # The MIME type of the inference result.
86
+ # @return [String]
87
+ #
88
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelResponse AWS API Documentation
89
+ #
90
+ class InvokeModelResponse < Struct.new(
91
+ :body,
92
+ :content_type)
93
+ SENSITIVE = [:body]
94
+ include Aws::Structure
95
+ end
96
+
97
+ # @!attribute [rw] accept
98
+ # The desired MIME type of the inference body in the response. The
99
+ # default value is `application/json`.
100
+ # @return [String]
101
+ #
102
+ # @!attribute [rw] body
103
+ # Inference input in the format specified by the content-type. To see
104
+ # the format and content of this field for different models, refer to
105
+ # [Inference parameters][1].
106
+ #
107
+ #
108
+ #
109
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
110
+ # @return [String]
111
+ #
112
+ # @!attribute [rw] content_type
113
+ # The MIME type of the input data in the request. The default value is
114
+ # `application/json`.
115
+ # @return [String]
116
+ #
117
+ # @!attribute [rw] model_id
118
+ # Id of the model to invoke using the streaming request.
119
+ # @return [String]
120
+ #
121
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithResponseStreamRequest AWS API Documentation
122
+ #
123
+ class InvokeModelWithResponseStreamRequest < Struct.new(
124
+ :accept,
125
+ :body,
126
+ :content_type,
127
+ :model_id)
128
+ SENSITIVE = [:body]
129
+ include Aws::Structure
130
+ end
131
+
132
+ # @!attribute [rw] body
133
+ # Inference response from the model in the format specified by
134
+ # Content-Type. To see the format and content of this field for
135
+ # different models, refer to [Inference parameters][1].
136
+ #
137
+ #
138
+ #
139
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
140
+ # @return [Types::ResponseStream]
141
+ #
142
+ # @!attribute [rw] content_type
143
+ # The MIME type of the inference result.
144
+ # @return [String]
145
+ #
146
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithResponseStreamResponse AWS API Documentation
147
+ #
148
+ class InvokeModelWithResponseStreamResponse < Struct.new(
149
+ :body,
150
+ :content_type)
151
+ SENSITIVE = []
152
+ include Aws::Structure
153
+ end
154
+
155
+ # The request failed due to an error while processing the model.
156
+ #
157
+ # @!attribute [rw] message
158
+ # @return [String]
159
+ #
160
+ # @!attribute [rw] original_status_code
161
+ # The original status code.
162
+ # @return [Integer]
163
+ #
164
+ # @!attribute [rw] resource_name
165
+ # The resource name.
166
+ # @return [String]
167
+ #
168
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ModelErrorException AWS API Documentation
169
+ #
170
+ class ModelErrorException < Struct.new(
171
+ :message,
172
+ :original_status_code,
173
+ :resource_name)
174
+ SENSITIVE = []
175
+ include Aws::Structure
176
+ end
177
+
178
+ # The model specified in the request is not ready to serve inference
179
+ # requests.
180
+ #
181
+ # @!attribute [rw] message
182
+ # @return [String]
183
+ #
184
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ModelNotReadyException AWS API Documentation
185
+ #
186
+ class ModelNotReadyException < Struct.new(
187
+ :message)
188
+ SENSITIVE = []
189
+ include Aws::Structure
190
+ end
191
+
192
+ # An error occurred while streaming the response.
193
+ #
194
+ # @!attribute [rw] message
195
+ # @return [String]
196
+ #
197
+ # @!attribute [rw] original_message
198
+ # The original message.
199
+ # @return [String]
200
+ #
201
+ # @!attribute [rw] original_status_code
202
+ # The original status code.
203
+ # @return [Integer]
204
+ #
205
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ModelStreamErrorException AWS API Documentation
206
+ #
207
+ class ModelStreamErrorException < Struct.new(
208
+ :message,
209
+ :original_message,
210
+ :original_status_code)
211
+ SENSITIVE = []
212
+ include Aws::Structure
213
+ end
214
+
215
+ # The request took too long to process. Processing time exceeded the
216
+ # model timeout length.
217
+ #
218
+ # @!attribute [rw] message
219
+ # @return [String]
220
+ #
221
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ModelTimeoutException AWS API Documentation
222
+ #
223
+ class ModelTimeoutException < Struct.new(
224
+ :message)
225
+ SENSITIVE = []
226
+ include Aws::Structure
227
+ end
228
+
229
+ # Payload content included in the response.
230
+ #
231
+ # @!attribute [rw] bytes
232
+ # Base64-encoded bytes of payload data.
233
+ # @return [String]
234
+ #
235
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/PayloadPart AWS API Documentation
236
+ #
237
+ class PayloadPart < Struct.new(
238
+ :bytes,
239
+ :event_type)
240
+ SENSITIVE = [:bytes]
241
+ include Aws::Structure
242
+ end
243
+
244
+ # The specified resource ARN was not found. Check the ARN and try your
245
+ # request again.
246
+ #
247
+ # @!attribute [rw] message
248
+ # @return [String]
249
+ #
250
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ResourceNotFoundException AWS API Documentation
251
+ #
252
+ class ResourceNotFoundException < Struct.new(
253
+ :message)
254
+ SENSITIVE = []
255
+ include Aws::Structure
256
+ end
257
+
258
+ # The number of requests exceeds the service quota. Resubmit your
259
+ # request later.
260
+ #
261
+ # @!attribute [rw] message
262
+ # @return [String]
263
+ #
264
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ServiceQuotaExceededException AWS API Documentation
265
+ #
266
+ class ServiceQuotaExceededException < Struct.new(
267
+ :message)
268
+ SENSITIVE = []
269
+ include Aws::Structure
270
+ end
271
+
272
+ # The number of requests exceeds the limit. Resubmit your request later.
273
+ #
274
+ # @!attribute [rw] message
275
+ # @return [String]
276
+ #
277
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ThrottlingException AWS API Documentation
278
+ #
279
+ class ThrottlingException < Struct.new(
280
+ :message)
281
+ SENSITIVE = []
282
+ include Aws::Structure
283
+ end
284
+
285
+ # Input validation failed. Check your request parameters and retry the
286
+ # request.
287
+ #
288
+ # @!attribute [rw] message
289
+ # @return [String]
290
+ #
291
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ValidationException AWS API Documentation
292
+ #
293
+ class ValidationException < Struct.new(
294
+ :message)
295
+ SENSITIVE = []
296
+ include Aws::Structure
297
+ end
298
+
299
+ # Definition of content in the response stream.
300
+ #
301
+ # EventStream is an Enumerator of Events.
302
+ # #event_types #=> Array, returns all modeled event types in the stream
303
+ #
304
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ResponseStream AWS API Documentation
305
+ #
306
+ class ResponseStream < Enumerator
307
+
308
+ def event_types
309
+ [
310
+ :chunk,
311
+ :internal_server_exception,
312
+ :model_stream_error_exception,
313
+ :throttling_exception,
314
+ :validation_exception
315
+ ]
316
+ end
317
+
318
+ end
319
+
320
+ end
321
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ require 'aws-sdk-core'
12
+ require 'aws-sigv4'
13
+
14
+ require_relative 'aws-sdk-bedrockruntime/types'
15
+ require_relative 'aws-sdk-bedrockruntime/client_api'
16
+ require_relative 'aws-sdk-bedrockruntime/plugins/endpoints.rb'
17
+ require_relative 'aws-sdk-bedrockruntime/client'
18
+ require_relative 'aws-sdk-bedrockruntime/errors'
19
+ require_relative 'aws-sdk-bedrockruntime/resource'
20
+ require_relative 'aws-sdk-bedrockruntime/endpoint_parameters'
21
+ require_relative 'aws-sdk-bedrockruntime/endpoint_provider'
22
+ require_relative 'aws-sdk-bedrockruntime/endpoints'
23
+ require_relative 'aws-sdk-bedrockruntime/customizations'
24
+ require_relative 'aws-sdk-bedrockruntime/event_streams'
25
+
26
+ # This module provides support for Amazon Bedrock Runtime. This module is available in the
27
+ # `aws-sdk-bedrockruntime` gem.
28
+ #
29
+ # # Client
30
+ #
31
+ # The {Client} class provides one method for each API operation. Operation
32
+ # methods each accept a hash of request parameters and return a response
33
+ # structure.
34
+ #
35
+ # bedrock_runtime = Aws::BedrockRuntime::Client.new
36
+ # resp = bedrock_runtime.invoke_model(params)
37
+ #
38
+ # See {Client} for more information.
39
+ #
40
+ # # Errors
41
+ #
42
+ # Errors returned from Amazon Bedrock Runtime are defined in the
43
+ # {Errors} module and all extend {Errors::ServiceError}.
44
+ #
45
+ # begin
46
+ # # do stuff
47
+ # rescue Aws::BedrockRuntime::Errors::ServiceError
48
+ # # rescues all Amazon Bedrock Runtime API errors
49
+ # end
50
+ #
51
+ # See {Errors} for more information.
52
+ #
53
+ # @!group service
54
+ module Aws::BedrockRuntime
55
+
56
+ GEM_VERSION = '1.0.0'
57
+
58
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-sdk-bedrockruntime
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Amazon Web Services
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-09-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.184.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.184.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: aws-sigv4
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.1'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.1'
47
+ description: Official AWS Ruby gem for Amazon Bedrock Runtime. This gem is part of
48
+ the AWS SDK for Ruby.
49
+ email:
50
+ - aws-dr-rubygems@amazon.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - CHANGELOG.md
56
+ - LICENSE.txt
57
+ - VERSION
58
+ - lib/aws-sdk-bedrockruntime.rb
59
+ - lib/aws-sdk-bedrockruntime/client.rb
60
+ - lib/aws-sdk-bedrockruntime/client_api.rb
61
+ - lib/aws-sdk-bedrockruntime/customizations.rb
62
+ - lib/aws-sdk-bedrockruntime/endpoint_parameters.rb
63
+ - lib/aws-sdk-bedrockruntime/endpoint_provider.rb
64
+ - lib/aws-sdk-bedrockruntime/endpoints.rb
65
+ - lib/aws-sdk-bedrockruntime/errors.rb
66
+ - lib/aws-sdk-bedrockruntime/event_streams.rb
67
+ - lib/aws-sdk-bedrockruntime/plugins/endpoints.rb
68
+ - lib/aws-sdk-bedrockruntime/resource.rb
69
+ - lib/aws-sdk-bedrockruntime/types.rb
70
+ homepage: https://github.com/aws/aws-sdk-ruby
71
+ licenses:
72
+ - Apache-2.0
73
+ metadata:
74
+ source_code_uri: https://github.com/aws/aws-sdk-ruby/tree/version-3/gems/aws-sdk-bedrockruntime
75
+ changelog_uri: https://github.com/aws/aws-sdk-ruby/tree/version-3/gems/aws-sdk-bedrockruntime/CHANGELOG.md
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '2.3'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 3.1.6
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: AWS SDK for Ruby - Amazon Bedrock Runtime
95
+ test_files: []