Class: Outhad::Integrations::Source::AwsBedrockModel::Client
- Inherits:
-
SourceConnector
- Object
- SourceConnector
- Outhad::Integrations::Source::AwsBedrockModel::Client
- Defined in:
- lib/outhad/integrations/source/aws_bedrock_model/client.rb
Instance Method Summary collapse
- #check_connection(connection_config) ⇒ Object
- #discover(_connection_config) ⇒ Object
- #read(sync_config) ⇒ Object
Instance Method Details
#check_connection(connection_config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/outhad/integrations/source/aws_bedrock_model/client.rb', line 7 def check_connection(connection_config) connection_config = connection_config.with_indifferent_access create_connection(connection_config) model = connection_config[:inference_profile] || connection_config[:model_id] payload = format_request(model, connection_config[:request_format]) @client_runtime.invoke_model( model_id: model, content_type: "application/json", accept: "application/json", body: payload ) success_status rescue StandardError => e ConnectionStatus.new(status: ConnectionStatusType["failed"], message: e.). end |
#discover(_connection_config) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/outhad/integrations/source/aws_bedrock_model/client.rb', line 23 def discover(_connection_config) catalog_json = read_json(CATALOG_SPEC_PATH) catalog = build_catalog(catalog_json) catalog. rescue StandardError => e handle_exception(e, { context: "AWS:BEDROCK MODEL:DISCOVER:EXCEPTION", type: "error" }) end |
#read(sync_config) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/outhad/integrations/source/aws_bedrock_model/client.rb', line 34 def read(sync_config) connection_config = sync_config.source.connection_specification connection_config = connection_config.with_indifferent_access payload = sync_config.model.query create_connection(connection_config) run_model(connection_config, payload) rescue StandardError => e handle_exception(e, { context: "AWS:BEDROCK MODEL:READ:EXCEPTION", type: "error", sync_id: sync_config.sync_id, sync_run_id: sync_config.sync_run_id }) end |