lib/bedrock_runtime/client.rb in ruby-amazon-bedrock-0.1.1 vs lib/bedrock_runtime/client.rb in ruby-amazon-bedrock-0.2.0
- old
+ new
@@ -1,10 +1,12 @@
# frozen_string_literal: true
+require 'base64'
require 'aws-sdk-bedrockruntime'
-
require 'bedrock_runtime/payload_factory'
+require 'bedrock_runtime/response_factory'
+require 'pry'
module RubyAmazonBedrock
# Client for interfacing with the Amazon Bedrock Runtime.
#
# This class provides methods to initialize a client for AWS BedrockRuntime
@@ -33,9 +35,12 @@
# id: 'model_id', input: 'This is what you want to generate', options: { option_key: 'option_value' }
# )
def invoke_model(id:, input:, options: {})
payload_builder_class = RubyAmazonBedrock::PayloadFactory.new(id, input, options).create
response = @client.invoke_model(payload_builder_class.build)
- JSON.parse(response.body.read, symbolize_names: true)
+
+ response_builder_class = RubyAmazonBedrock::ResponseFactory.new(payload_builder_class.type, response,
+ options).create
+ response_builder_class.build
end
end
end