aws-sdk-bedrockagentruntime 1.14.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-bedrockagentruntime/client.rb +545 -10
- data/lib/aws-sdk-bedrockagentruntime/client_api.rb +272 -0
- data/lib/aws-sdk-bedrockagentruntime/endpoints.rb +42 -0
- data/lib/aws-sdk-bedrockagentruntime/event_streams.rb +89 -0
- data/lib/aws-sdk-bedrockagentruntime/plugins/endpoints.rb +6 -0
- data/lib/aws-sdk-bedrockagentruntime/types.rb +761 -13
- data/lib/aws-sdk-bedrockagentruntime.rb +2 -2
- data/sig/client.rbs +146 -0
- data/sig/resource.rbs +1 -0
- data/sig/types.rbs +209 -3
- metadata +4 -4
@@ -323,6 +323,15 @@ module Aws::BedrockAgentRuntime
|
|
323
323
|
#
|
324
324
|
# @option options [String] :session_token
|
325
325
|
#
|
326
|
+
# @option options [Array] :sigv4a_signing_region_set
|
327
|
+
# A list of regions that should be signed with SigV4a signing. When
|
328
|
+
# not passed, a default `:sigv4a_signing_region_set` is searched for
|
329
|
+
# in the following locations:
|
330
|
+
#
|
331
|
+
# * `Aws.config[:sigv4a_signing_region_set]`
|
332
|
+
# * `ENV['AWS_SIGV4A_SIGNING_REGION_SET']`
|
333
|
+
# * `~/.aws/config`
|
334
|
+
#
|
326
335
|
# @option options [Boolean] :stub_responses (false)
|
327
336
|
# Causes the client to return stubbed responses. By default
|
328
337
|
# fake responses are generated and returned. You can specify
|
@@ -427,7 +436,101 @@ module Aws::BedrockAgentRuntime
|
|
427
436
|
|
428
437
|
# @!group API Operations
|
429
438
|
|
430
|
-
#
|
439
|
+
# Deletes memory from the specified memory identifier.
|
440
|
+
#
|
441
|
+
# @option params [required, String] :agent_alias_id
|
442
|
+
# The unique identifier of an alias of an agent.
|
443
|
+
#
|
444
|
+
# @option params [required, String] :agent_id
|
445
|
+
# The unique identifier of the agent to which the alias belongs.
|
446
|
+
#
|
447
|
+
# @option params [String] :memory_id
|
448
|
+
# The unique identifier of the memory.
|
449
|
+
#
|
450
|
+
# @return [Struct] Returns an empty {Seahorse::Client::Response response}.
|
451
|
+
#
|
452
|
+
# @example Request syntax with placeholder values
|
453
|
+
#
|
454
|
+
# resp = client.delete_agent_memory({
|
455
|
+
# agent_alias_id: "AgentAliasId", # required
|
456
|
+
# agent_id: "AgentId", # required
|
457
|
+
# memory_id: "MemoryId",
|
458
|
+
# })
|
459
|
+
#
|
460
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory AWS API Documentation
|
461
|
+
#
|
462
|
+
# @overload delete_agent_memory(params = {})
|
463
|
+
# @param [Hash] params ({})
|
464
|
+
def delete_agent_memory(params = {}, options = {})
|
465
|
+
req = build_request(:delete_agent_memory, params)
|
466
|
+
req.send_request(options)
|
467
|
+
end
|
468
|
+
|
469
|
+
# Gets the sessions stored in the memory of the agent.
|
470
|
+
#
|
471
|
+
# @option params [required, String] :agent_alias_id
|
472
|
+
# The unique identifier of an alias of an agent.
|
473
|
+
#
|
474
|
+
# @option params [required, String] :agent_id
|
475
|
+
# The unique identifier of the agent to which the alias belongs.
|
476
|
+
#
|
477
|
+
# @option params [Integer] :max_items
|
478
|
+
# The maximum number of items to return in the response. If the total
|
479
|
+
# number of results is greater than this value, use the token returned
|
480
|
+
# in the response in the `nextToken` field when making another request
|
481
|
+
# to return the next batch of results.
|
482
|
+
#
|
483
|
+
# @option params [required, String] :memory_id
|
484
|
+
# The unique identifier of the memory.
|
485
|
+
#
|
486
|
+
# @option params [required, String] :memory_type
|
487
|
+
# The type of memory.
|
488
|
+
#
|
489
|
+
# @option params [String] :next_token
|
490
|
+
# If the total number of results is greater than the maxItems value
|
491
|
+
# provided in the request, enter the token returned in the `nextToken`
|
492
|
+
# field in the response in this field to return the next batch of
|
493
|
+
# results.
|
494
|
+
#
|
495
|
+
# @return [Types::GetAgentMemoryResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
496
|
+
#
|
497
|
+
# * {Types::GetAgentMemoryResponse#memory_contents #memory_contents} => Array<Types::Memory>
|
498
|
+
# * {Types::GetAgentMemoryResponse#next_token #next_token} => String
|
499
|
+
#
|
500
|
+
# The returned {Seahorse::Client::Response response} is a pageable response and is Enumerable. For details on usage see {Aws::PageableResponse PageableResponse}.
|
501
|
+
#
|
502
|
+
# @example Request syntax with placeholder values
|
503
|
+
#
|
504
|
+
# resp = client.get_agent_memory({
|
505
|
+
# agent_alias_id: "AgentAliasId", # required
|
506
|
+
# agent_id: "AgentId", # required
|
507
|
+
# max_items: 1,
|
508
|
+
# memory_id: "MemoryId", # required
|
509
|
+
# memory_type: "SESSION_SUMMARY", # required, accepts SESSION_SUMMARY
|
510
|
+
# next_token: "NextToken",
|
511
|
+
# })
|
512
|
+
#
|
513
|
+
# @example Response structure
|
514
|
+
#
|
515
|
+
# resp.memory_contents #=> Array
|
516
|
+
# resp.memory_contents[0].session_summary.memory_id #=> String
|
517
|
+
# resp.memory_contents[0].session_summary.session_expiry_time #=> Time
|
518
|
+
# resp.memory_contents[0].session_summary.session_id #=> String
|
519
|
+
# resp.memory_contents[0].session_summary.session_start_time #=> Time
|
520
|
+
# resp.memory_contents[0].session_summary.summary_text #=> String
|
521
|
+
# resp.next_token #=> String
|
522
|
+
#
|
523
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/GetAgentMemory AWS API Documentation
|
524
|
+
#
|
525
|
+
# @overload get_agent_memory(params = {})
|
526
|
+
# @param [Hash] params ({})
|
527
|
+
def get_agent_memory(params = {}, options = {})
|
528
|
+
req = build_request(:get_agent_memory, params)
|
529
|
+
req.send_request(options)
|
530
|
+
end
|
531
|
+
|
532
|
+
# <note markdown="1"> The CLI doesn't support streaming operations in Amazon Bedrock,
|
533
|
+
# including `InvokeAgent`.
|
431
534
|
#
|
432
535
|
# </note>
|
433
536
|
#
|
@@ -492,6 +595,9 @@ module Aws::BedrockAgentRuntime
|
|
492
595
|
#
|
493
596
|
# </note>
|
494
597
|
#
|
598
|
+
# @option params [String] :memory_id
|
599
|
+
# The unique identifier of the agent memory.
|
600
|
+
#
|
495
601
|
# @option params [required, String] :session_id
|
496
602
|
# The unique identifier of the session. Use the same value across
|
497
603
|
# requests to continue the same conversation.
|
@@ -513,6 +619,7 @@ module Aws::BedrockAgentRuntime
|
|
513
619
|
#
|
514
620
|
# * {Types::InvokeAgentResponse#completion #completion} => Types::ResponseStream
|
515
621
|
# * {Types::InvokeAgentResponse#content_type #content_type} => String
|
622
|
+
# * {Types::InvokeAgentResponse#memory_id #memory_id} => String
|
516
623
|
# * {Types::InvokeAgentResponse#session_id #session_id} => String
|
517
624
|
#
|
518
625
|
# @example EventStream Operation Example
|
@@ -573,6 +680,9 @@ module Aws::BedrockAgentRuntime
|
|
573
680
|
# handler.on_dependency_failed_exception_event do |event|
|
574
681
|
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
575
682
|
# end
|
683
|
+
# handler.on_files_event do |event|
|
684
|
+
# event # => Aws::BedrockAgentRuntime::Types::files
|
685
|
+
# end
|
576
686
|
# handler.on_internal_server_exception_event do |event|
|
577
687
|
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
578
688
|
# end
|
@@ -616,6 +726,9 @@ module Aws::BedrockAgentRuntime
|
|
616
726
|
# stream.on_dependency_failed_exception_event do |event|
|
617
727
|
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
618
728
|
# end
|
729
|
+
# stream.on_files_event do |event|
|
730
|
+
# event # => Aws::BedrockAgentRuntime::Types::files
|
731
|
+
# end
|
619
732
|
# stream.on_internal_server_exception_event do |event|
|
620
733
|
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
621
734
|
# end
|
@@ -659,6 +772,9 @@ module Aws::BedrockAgentRuntime
|
|
659
772
|
# handler.on_dependency_failed_exception_event do |event|
|
660
773
|
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
661
774
|
# end
|
775
|
+
# handler.on_files_event do |event|
|
776
|
+
# event # => Aws::BedrockAgentRuntime::Types::files
|
777
|
+
# end
|
662
778
|
# handler.on_internal_server_exception_event do |event|
|
663
779
|
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
664
780
|
# end
|
@@ -705,9 +821,104 @@ module Aws::BedrockAgentRuntime
|
|
705
821
|
# enable_trace: false,
|
706
822
|
# end_session: false,
|
707
823
|
# input_text: "InputText",
|
824
|
+
# memory_id: "MemoryId",
|
708
825
|
# session_id: "SessionId", # required
|
709
826
|
# session_state: {
|
827
|
+
# files: [
|
828
|
+
# {
|
829
|
+
# name: "String", # required
|
830
|
+
# source: { # required
|
831
|
+
# byte_content: {
|
832
|
+
# data: "data", # required
|
833
|
+
# media_type: "MimeType", # required
|
834
|
+
# },
|
835
|
+
# s3_location: {
|
836
|
+
# uri: "S3Uri", # required
|
837
|
+
# },
|
838
|
+
# source_type: "S3", # required, accepts S3, BYTE_CONTENT
|
839
|
+
# },
|
840
|
+
# use_case: "CODE_INTERPRETER", # required, accepts CODE_INTERPRETER, CHAT
|
841
|
+
# },
|
842
|
+
# ],
|
710
843
|
# invocation_id: "String",
|
844
|
+
# knowledge_base_configurations: [
|
845
|
+
# {
|
846
|
+
# knowledge_base_id: "KnowledgeBaseId", # required
|
847
|
+
# retrieval_configuration: { # required
|
848
|
+
# vector_search_configuration: { # required
|
849
|
+
# filter: {
|
850
|
+
# and_all: [
|
851
|
+
# {
|
852
|
+
# # recursive RetrievalFilter
|
853
|
+
# },
|
854
|
+
# ],
|
855
|
+
# equals: {
|
856
|
+
# key: "FilterKey", # required
|
857
|
+
# value: { # required
|
858
|
+
# },
|
859
|
+
# },
|
860
|
+
# greater_than: {
|
861
|
+
# key: "FilterKey", # required
|
862
|
+
# value: { # required
|
863
|
+
# },
|
864
|
+
# },
|
865
|
+
# greater_than_or_equals: {
|
866
|
+
# key: "FilterKey", # required
|
867
|
+
# value: { # required
|
868
|
+
# },
|
869
|
+
# },
|
870
|
+
# in: {
|
871
|
+
# key: "FilterKey", # required
|
872
|
+
# value: { # required
|
873
|
+
# },
|
874
|
+
# },
|
875
|
+
# less_than: {
|
876
|
+
# key: "FilterKey", # required
|
877
|
+
# value: { # required
|
878
|
+
# },
|
879
|
+
# },
|
880
|
+
# less_than_or_equals: {
|
881
|
+
# key: "FilterKey", # required
|
882
|
+
# value: { # required
|
883
|
+
# },
|
884
|
+
# },
|
885
|
+
# list_contains: {
|
886
|
+
# key: "FilterKey", # required
|
887
|
+
# value: { # required
|
888
|
+
# },
|
889
|
+
# },
|
890
|
+
# not_equals: {
|
891
|
+
# key: "FilterKey", # required
|
892
|
+
# value: { # required
|
893
|
+
# },
|
894
|
+
# },
|
895
|
+
# not_in: {
|
896
|
+
# key: "FilterKey", # required
|
897
|
+
# value: { # required
|
898
|
+
# },
|
899
|
+
# },
|
900
|
+
# or_all: [
|
901
|
+
# {
|
902
|
+
# # recursive RetrievalFilter
|
903
|
+
# },
|
904
|
+
# ],
|
905
|
+
# starts_with: {
|
906
|
+
# key: "FilterKey", # required
|
907
|
+
# value: { # required
|
908
|
+
# },
|
909
|
+
# },
|
910
|
+
# string_contains: {
|
911
|
+
# key: "FilterKey", # required
|
912
|
+
# value: { # required
|
913
|
+
# },
|
914
|
+
# },
|
915
|
+
# },
|
916
|
+
# number_of_results: 1,
|
917
|
+
# override_search_type: "HYBRID", # accepts HYBRID, SEMANTIC
|
918
|
+
# },
|
919
|
+
# },
|
920
|
+
# },
|
921
|
+
# ],
|
711
922
|
# prompt_session_attributes: {
|
712
923
|
# "String" => "String",
|
713
924
|
# },
|
@@ -747,7 +958,7 @@ module Aws::BedrockAgentRuntime
|
|
747
958
|
#
|
748
959
|
# All events are available at resp.completion:
|
749
960
|
# resp.completion #=> Enumerator
|
750
|
-
# resp.completion.event_types #=> [:access_denied_exception, :bad_gateway_exception, :chunk, :conflict_exception, :dependency_failed_exception, :internal_server_exception, :resource_not_found_exception, :return_control, :service_quota_exceeded_exception, :throttling_exception, :trace, :validation_exception]
|
961
|
+
# resp.completion.event_types #=> [:access_denied_exception, :bad_gateway_exception, :chunk, :conflict_exception, :dependency_failed_exception, :files, :internal_server_exception, :resource_not_found_exception, :return_control, :service_quota_exceeded_exception, :throttling_exception, :trace, :validation_exception]
|
751
962
|
#
|
752
963
|
# For :access_denied_exception event available at #on_access_denied_exception_event callback and response eventstream enumerator:
|
753
964
|
# event.message #=> String
|
@@ -763,8 +974,12 @@ module Aws::BedrockAgentRuntime
|
|
763
974
|
# event.attribution.citations[0].generated_response_part.text_response_part.text #=> String
|
764
975
|
# event.attribution.citations[0].retrieved_references #=> Array
|
765
976
|
# event.attribution.citations[0].retrieved_references[0].content.text #=> String
|
977
|
+
# event.attribution.citations[0].retrieved_references[0].location.confluence_location.url #=> String
|
766
978
|
# event.attribution.citations[0].retrieved_references[0].location.s3_location.uri #=> String
|
767
|
-
# event.attribution.citations[0].retrieved_references[0].location.
|
979
|
+
# event.attribution.citations[0].retrieved_references[0].location.salesforce_location.url #=> String
|
980
|
+
# event.attribution.citations[0].retrieved_references[0].location.share_point_location.url #=> String
|
981
|
+
# event.attribution.citations[0].retrieved_references[0].location.type #=> String, one of "S3", "WEB", "CONFLUENCE", "SALESFORCE", "SHAREPOINT"
|
982
|
+
# event.attribution.citations[0].retrieved_references[0].location.web_location.url #=> String
|
768
983
|
# event.attribution.citations[0].retrieved_references[0].metadata #=> Hash
|
769
984
|
# event.bytes #=> String
|
770
985
|
#
|
@@ -775,6 +990,12 @@ module Aws::BedrockAgentRuntime
|
|
775
990
|
# event.message #=> String
|
776
991
|
# event.resource_name #=> String
|
777
992
|
#
|
993
|
+
# For :files event available at #on_files_event callback and response eventstream enumerator:
|
994
|
+
# event.files #=> Array
|
995
|
+
# event.files[0].bytes #=> String
|
996
|
+
# event.files[0].name #=> String
|
997
|
+
# event.files[0].type #=> String
|
998
|
+
#
|
778
999
|
# For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
|
779
1000
|
# event.message #=> String
|
780
1001
|
#
|
@@ -870,7 +1091,9 @@ module Aws::BedrockAgentRuntime
|
|
870
1091
|
# event.trace.guardrail_trace.trace_id #=> String
|
871
1092
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.action_group_name #=> String
|
872
1093
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.api_path #=> String
|
1094
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.execution_type #=> String, one of "LAMBDA", "RETURN_CONTROL"
|
873
1095
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.function #=> String
|
1096
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.invocation_id #=> String
|
874
1097
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters #=> Array
|
875
1098
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].name #=> String
|
876
1099
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].type #=> String
|
@@ -881,7 +1104,10 @@ module Aws::BedrockAgentRuntime
|
|
881
1104
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].type #=> String
|
882
1105
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].value #=> String
|
883
1106
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.verb #=> String
|
884
|
-
# event.trace.orchestration_trace.invocation_input.
|
1107
|
+
# event.trace.orchestration_trace.invocation_input.code_interpreter_invocation_input.code #=> String
|
1108
|
+
# event.trace.orchestration_trace.invocation_input.code_interpreter_invocation_input.files #=> Array
|
1109
|
+
# event.trace.orchestration_trace.invocation_input.code_interpreter_invocation_input.files[0] #=> String
|
1110
|
+
# event.trace.orchestration_trace.invocation_input.invocation_type #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "FINISH", "ACTION_GROUP_CODE_INTERPRETER"
|
885
1111
|
# event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.knowledge_base_id #=> String
|
886
1112
|
# event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.text #=> String
|
887
1113
|
# event.trace.orchestration_trace.invocation_input.trace_id #=> String
|
@@ -898,11 +1124,20 @@ module Aws::BedrockAgentRuntime
|
|
898
1124
|
# event.trace.orchestration_trace.model_invocation_input.trace_id #=> String
|
899
1125
|
# event.trace.orchestration_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
|
900
1126
|
# event.trace.orchestration_trace.observation.action_group_invocation_output.text #=> String
|
1127
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.execution_error #=> String
|
1128
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.execution_output #=> String
|
1129
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.execution_timeout #=> Boolean
|
1130
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.files #=> Array
|
1131
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.files[0] #=> String
|
901
1132
|
# event.trace.orchestration_trace.observation.final_response.text #=> String
|
902
1133
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references #=> Array
|
903
1134
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].content.text #=> String
|
1135
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.confluence_location.url #=> String
|
904
1136
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.s3_location.uri #=> String
|
905
|
-
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.
|
1137
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.salesforce_location.url #=> String
|
1138
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.share_point_location.url #=> String
|
1139
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.type #=> String, one of "S3", "WEB", "CONFLUENCE", "SALESFORCE", "SHAREPOINT"
|
1140
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.web_location.url #=> String
|
906
1141
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].metadata #=> Hash
|
907
1142
|
# event.trace.orchestration_trace.observation.reprompt_response.source #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "PARSER"
|
908
1143
|
# event.trace.orchestration_trace.observation.reprompt_response.text #=> String
|
@@ -944,6 +1179,7 @@ module Aws::BedrockAgentRuntime
|
|
944
1179
|
# event.message #=> String
|
945
1180
|
#
|
946
1181
|
# resp.content_type #=> String
|
1182
|
+
# resp.memory_id #=> String
|
947
1183
|
# resp.session_id #=> String
|
948
1184
|
#
|
949
1185
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/InvokeAgent AWS API Documentation
|
@@ -973,6 +1209,288 @@ module Aws::BedrockAgentRuntime
|
|
973
1209
|
req.send_request(options, &block)
|
974
1210
|
end
|
975
1211
|
|
1212
|
+
# Invokes an alias of a flow to run the inputs that you specify and
|
1213
|
+
# return the output of each node as a stream. If there's an error, the
|
1214
|
+
# error is returned. For more information, see [Test a flow in Amazon
|
1215
|
+
# Bedrock][1] in the Amazon Bedrock User Guide.
|
1216
|
+
#
|
1217
|
+
#
|
1218
|
+
#
|
1219
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/flows-test.html
|
1220
|
+
#
|
1221
|
+
# @option params [required, String] :flow_alias_identifier
|
1222
|
+
# The unique identifier of the flow alias.
|
1223
|
+
#
|
1224
|
+
# @option params [required, String] :flow_identifier
|
1225
|
+
# The unique identifier of the flow.
|
1226
|
+
#
|
1227
|
+
# @option params [required, Array<Types::FlowInput>] :inputs
|
1228
|
+
# A list of objects, each containing information about an input into the
|
1229
|
+
# flow.
|
1230
|
+
#
|
1231
|
+
# @return [Types::InvokeFlowResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1232
|
+
#
|
1233
|
+
# * {Types::InvokeFlowResponse#response_stream #response_stream} => Types::FlowResponseStream
|
1234
|
+
#
|
1235
|
+
# @example EventStream Operation Example
|
1236
|
+
#
|
1237
|
+
# You can process the event once it arrives immediately, or wait until the
|
1238
|
+
# full response is complete and iterate through the eventstream enumerator.
|
1239
|
+
#
|
1240
|
+
# To interact with event immediately, you need to register #invoke_flow
|
1241
|
+
# with callbacks. Callbacks can be registered for specific events or for all
|
1242
|
+
# events, including error events.
|
1243
|
+
#
|
1244
|
+
# Callbacks can be passed into the `:event_stream_handler` option or within a
|
1245
|
+
# block statement attached to the #invoke_flow call directly. Hybrid
|
1246
|
+
# pattern of both is also supported.
|
1247
|
+
#
|
1248
|
+
# `:event_stream_handler` option takes in either a Proc object or
|
1249
|
+
# Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream object.
|
1250
|
+
#
|
1251
|
+
# Usage pattern a): Callbacks with a block attached to #invoke_flow
|
1252
|
+
# Example for registering callbacks for all event types and an error event
|
1253
|
+
#
|
1254
|
+
# client.invoke_flow( # params input# ) do |stream|
|
1255
|
+
# stream.on_error_event do |event|
|
1256
|
+
# # catch unmodeled error event in the stream
|
1257
|
+
# raise event
|
1258
|
+
# # => Aws::Errors::EventError
|
1259
|
+
# # event.event_type => :error
|
1260
|
+
# # event.error_code => String
|
1261
|
+
# # event.error_message => String
|
1262
|
+
# end
|
1263
|
+
#
|
1264
|
+
# stream.on_event do |event|
|
1265
|
+
# # process all events arrive
|
1266
|
+
# puts event.event_type
|
1267
|
+
# ...
|
1268
|
+
# end
|
1269
|
+
#
|
1270
|
+
# end
|
1271
|
+
#
|
1272
|
+
# Usage pattern b): Pass in `:event_stream_handler` for #invoke_flow
|
1273
|
+
#
|
1274
|
+
# 1) Create a Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream object
|
1275
|
+
# Example for registering callbacks with specific events
|
1276
|
+
#
|
1277
|
+
# handler = Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream.new
|
1278
|
+
# handler.on_access_denied_exception_event do |event|
|
1279
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
1280
|
+
# end
|
1281
|
+
# handler.on_bad_gateway_exception_event do |event|
|
1282
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
1283
|
+
# end
|
1284
|
+
# handler.on_conflict_exception_event do |event|
|
1285
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
1286
|
+
# end
|
1287
|
+
# handler.on_dependency_failed_exception_event do |event|
|
1288
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
1289
|
+
# end
|
1290
|
+
# handler.on_flow_completion_event_event do |event|
|
1291
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowCompletionEvent
|
1292
|
+
# end
|
1293
|
+
# handler.on_flow_output_event_event do |event|
|
1294
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowOutputEvent
|
1295
|
+
# end
|
1296
|
+
# handler.on_internal_server_exception_event do |event|
|
1297
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
1298
|
+
# end
|
1299
|
+
# handler.on_resource_not_found_exception_event do |event|
|
1300
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
1301
|
+
# end
|
1302
|
+
# handler.on_service_quota_exceeded_exception_event do |event|
|
1303
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
1304
|
+
# end
|
1305
|
+
# handler.on_throttling_exception_event do |event|
|
1306
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
1307
|
+
# end
|
1308
|
+
# handler.on_validation_exception_event do |event|
|
1309
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
1310
|
+
# end
|
1311
|
+
#
|
1312
|
+
# client.invoke_flow( # params input #, event_stream_handler: handler)
|
1313
|
+
#
|
1314
|
+
# 2) Use a Ruby Proc object
|
1315
|
+
# Example for registering callbacks with specific events
|
1316
|
+
#
|
1317
|
+
# handler = Proc.new do |stream|
|
1318
|
+
# stream.on_access_denied_exception_event do |event|
|
1319
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
1320
|
+
# end
|
1321
|
+
# stream.on_bad_gateway_exception_event do |event|
|
1322
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
1323
|
+
# end
|
1324
|
+
# stream.on_conflict_exception_event do |event|
|
1325
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
1326
|
+
# end
|
1327
|
+
# stream.on_dependency_failed_exception_event do |event|
|
1328
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
1329
|
+
# end
|
1330
|
+
# stream.on_flow_completion_event_event do |event|
|
1331
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowCompletionEvent
|
1332
|
+
# end
|
1333
|
+
# stream.on_flow_output_event_event do |event|
|
1334
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowOutputEvent
|
1335
|
+
# end
|
1336
|
+
# stream.on_internal_server_exception_event do |event|
|
1337
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
1338
|
+
# end
|
1339
|
+
# stream.on_resource_not_found_exception_event do |event|
|
1340
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
1341
|
+
# end
|
1342
|
+
# stream.on_service_quota_exceeded_exception_event do |event|
|
1343
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
1344
|
+
# end
|
1345
|
+
# stream.on_throttling_exception_event do |event|
|
1346
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
1347
|
+
# end
|
1348
|
+
# stream.on_validation_exception_event do |event|
|
1349
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
1350
|
+
# end
|
1351
|
+
# end
|
1352
|
+
#
|
1353
|
+
# client.invoke_flow( # params input #, event_stream_handler: handler)
|
1354
|
+
#
|
1355
|
+
# Usage pattern c): Hybrid pattern of a) and b)
|
1356
|
+
#
|
1357
|
+
# handler = Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream.new
|
1358
|
+
# handler.on_access_denied_exception_event do |event|
|
1359
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
1360
|
+
# end
|
1361
|
+
# handler.on_bad_gateway_exception_event do |event|
|
1362
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
1363
|
+
# end
|
1364
|
+
# handler.on_conflict_exception_event do |event|
|
1365
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
1366
|
+
# end
|
1367
|
+
# handler.on_dependency_failed_exception_event do |event|
|
1368
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
1369
|
+
# end
|
1370
|
+
# handler.on_flow_completion_event_event do |event|
|
1371
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowCompletionEvent
|
1372
|
+
# end
|
1373
|
+
# handler.on_flow_output_event_event do |event|
|
1374
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowOutputEvent
|
1375
|
+
# end
|
1376
|
+
# handler.on_internal_server_exception_event do |event|
|
1377
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
1378
|
+
# end
|
1379
|
+
# handler.on_resource_not_found_exception_event do |event|
|
1380
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
1381
|
+
# end
|
1382
|
+
# handler.on_service_quota_exceeded_exception_event do |event|
|
1383
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
1384
|
+
# end
|
1385
|
+
# handler.on_throttling_exception_event do |event|
|
1386
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
1387
|
+
# end
|
1388
|
+
# handler.on_validation_exception_event do |event|
|
1389
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
1390
|
+
# end
|
1391
|
+
#
|
1392
|
+
# client.invoke_flow( # params input #, event_stream_handler: handler) do |stream|
|
1393
|
+
# stream.on_error_event do |event|
|
1394
|
+
# # catch unmodeled error event in the stream
|
1395
|
+
# raise event
|
1396
|
+
# # => Aws::Errors::EventError
|
1397
|
+
# # event.event_type => :error
|
1398
|
+
# # event.error_code => String
|
1399
|
+
# # event.error_message => String
|
1400
|
+
# end
|
1401
|
+
# end
|
1402
|
+
#
|
1403
|
+
# You can also iterate through events after the response complete.
|
1404
|
+
#
|
1405
|
+
# Events are available at resp.response_stream # => Enumerator
|
1406
|
+
# For parameter input example, please refer to following request syntax
|
1407
|
+
#
|
1408
|
+
# @example Request syntax with placeholder values
|
1409
|
+
#
|
1410
|
+
# resp = client.invoke_flow({
|
1411
|
+
# flow_alias_identifier: "FlowAliasIdentifier", # required
|
1412
|
+
# flow_identifier: "FlowIdentifier", # required
|
1413
|
+
# inputs: [ # required
|
1414
|
+
# {
|
1415
|
+
# content: { # required
|
1416
|
+
# document: {
|
1417
|
+
# },
|
1418
|
+
# },
|
1419
|
+
# node_name: "NodeName", # required
|
1420
|
+
# node_output_name: "NodeOutputName", # required
|
1421
|
+
# },
|
1422
|
+
# ],
|
1423
|
+
# })
|
1424
|
+
#
|
1425
|
+
# @example Response structure
|
1426
|
+
#
|
1427
|
+
# All events are available at resp.response_stream:
|
1428
|
+
# resp.response_stream #=> Enumerator
|
1429
|
+
# resp.response_stream.event_types #=> [:access_denied_exception, :bad_gateway_exception, :conflict_exception, :dependency_failed_exception, :flow_completion_event, :flow_output_event, :internal_server_exception, :resource_not_found_exception, :service_quota_exceeded_exception, :throttling_exception, :validation_exception]
|
1430
|
+
#
|
1431
|
+
# For :access_denied_exception event available at #on_access_denied_exception_event callback and response eventstream enumerator:
|
1432
|
+
# event.message #=> String
|
1433
|
+
#
|
1434
|
+
# For :bad_gateway_exception event available at #on_bad_gateway_exception_event callback and response eventstream enumerator:
|
1435
|
+
# event.message #=> String
|
1436
|
+
# event.resource_name #=> String
|
1437
|
+
#
|
1438
|
+
# For :conflict_exception event available at #on_conflict_exception_event callback and response eventstream enumerator:
|
1439
|
+
# event.message #=> String
|
1440
|
+
#
|
1441
|
+
# For :dependency_failed_exception event available at #on_dependency_failed_exception_event callback and response eventstream enumerator:
|
1442
|
+
# event.message #=> String
|
1443
|
+
# event.resource_name #=> String
|
1444
|
+
#
|
1445
|
+
# For :flow_completion_event event available at #on_flow_completion_event_event callback and response eventstream enumerator:
|
1446
|
+
# event.completion_reason #=> String, one of "SUCCESS"
|
1447
|
+
#
|
1448
|
+
# For :flow_output_event event available at #on_flow_output_event_event callback and response eventstream enumerator:
|
1449
|
+
# event.node_name #=> String
|
1450
|
+
# event.node_type #=> String, one of "FlowInputNode", "FlowOutputNode", "LambdaFunctionNode", "KnowledgeBaseNode", "PromptNode", "ConditionNode", "LexNode"
|
1451
|
+
#
|
1452
|
+
# For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
|
1453
|
+
# event.message #=> String
|
1454
|
+
#
|
1455
|
+
# For :resource_not_found_exception event available at #on_resource_not_found_exception_event callback and response eventstream enumerator:
|
1456
|
+
# event.message #=> String
|
1457
|
+
#
|
1458
|
+
# For :service_quota_exceeded_exception event available at #on_service_quota_exceeded_exception_event callback and response eventstream enumerator:
|
1459
|
+
# event.message #=> String
|
1460
|
+
#
|
1461
|
+
# For :throttling_exception event available at #on_throttling_exception_event callback and response eventstream enumerator:
|
1462
|
+
# event.message #=> String
|
1463
|
+
#
|
1464
|
+
# For :validation_exception event available at #on_validation_exception_event callback and response eventstream enumerator:
|
1465
|
+
# event.message #=> String
|
1466
|
+
#
|
1467
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/InvokeFlow AWS API Documentation
|
1468
|
+
#
|
1469
|
+
# @overload invoke_flow(params = {})
|
1470
|
+
# @param [Hash] params ({})
|
1471
|
+
def invoke_flow(params = {}, options = {}, &block)
|
1472
|
+
params = params.dup
|
1473
|
+
event_stream_handler = case handler = params.delete(:event_stream_handler)
|
1474
|
+
when EventStreams::FlowResponseStream then handler
|
1475
|
+
when Proc then EventStreams::FlowResponseStream.new.tap(&handler)
|
1476
|
+
when nil then EventStreams::FlowResponseStream.new
|
1477
|
+
else
|
1478
|
+
msg = "expected :event_stream_handler to be a block or "\
|
1479
|
+
"instance of Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream"\
|
1480
|
+
", got `#{handler.inspect}` instead"
|
1481
|
+
raise ArgumentError, msg
|
1482
|
+
end
|
1483
|
+
|
1484
|
+
yield(event_stream_handler) if block_given?
|
1485
|
+
|
1486
|
+
req = build_request(:invoke_flow, params)
|
1487
|
+
|
1488
|
+
req.context[:event_stream_handler] = event_stream_handler
|
1489
|
+
req.handlers.add(Aws::Binary::DecodeHandler, priority: 95)
|
1490
|
+
|
1491
|
+
req.send_request(options, &block)
|
1492
|
+
end
|
1493
|
+
|
976
1494
|
# Queries a knowledge base and retrieves information from it.
|
977
1495
|
#
|
978
1496
|
# @option params [required, String] :knowledge_base_id
|
@@ -1089,8 +1607,12 @@ module Aws::BedrockAgentRuntime
|
|
1089
1607
|
# resp.next_token #=> String
|
1090
1608
|
# resp.retrieval_results #=> Array
|
1091
1609
|
# resp.retrieval_results[0].content.text #=> String
|
1610
|
+
# resp.retrieval_results[0].location.confluence_location.url #=> String
|
1092
1611
|
# resp.retrieval_results[0].location.s3_location.uri #=> String
|
1093
|
-
# resp.retrieval_results[0].location.
|
1612
|
+
# resp.retrieval_results[0].location.salesforce_location.url #=> String
|
1613
|
+
# resp.retrieval_results[0].location.share_point_location.url #=> String
|
1614
|
+
# resp.retrieval_results[0].location.type #=> String, one of "S3", "WEB", "CONFLUENCE", "SALESFORCE", "SHAREPOINT"
|
1615
|
+
# resp.retrieval_results[0].location.web_location.url #=> String
|
1094
1616
|
# resp.retrieval_results[0].metadata #=> Hash
|
1095
1617
|
# resp.retrieval_results[0].score #=> Float
|
1096
1618
|
#
|
@@ -1122,8 +1644,12 @@ module Aws::BedrockAgentRuntime
|
|
1122
1644
|
# Contains details about the session with the knowledge base.
|
1123
1645
|
#
|
1124
1646
|
# @option params [String] :session_id
|
1125
|
-
# The unique identifier of the session.
|
1126
|
-
#
|
1647
|
+
# The unique identifier of the session. When you first make a
|
1648
|
+
# `RetrieveAndGenerate` request, Amazon Bedrock automatically generates
|
1649
|
+
# this value. You must reuse this value for all subsequent requests in
|
1650
|
+
# the same conversational session. This value allows Amazon Bedrock to
|
1651
|
+
# maintain context and knowledge from previous interactions. You can't
|
1652
|
+
# explicitly set the `sessionId` yourself.
|
1127
1653
|
#
|
1128
1654
|
# @return [Types::RetrieveAndGenerateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1129
1655
|
#
|
@@ -1200,6 +1726,11 @@ module Aws::BedrockAgentRuntime
|
|
1200
1726
|
# },
|
1201
1727
|
# knowledge_base_id: "KnowledgeBaseId", # required
|
1202
1728
|
# model_arn: "BedrockModelArn", # required
|
1729
|
+
# orchestration_configuration: {
|
1730
|
+
# query_transformation_configuration: { # required
|
1731
|
+
# type: "QUERY_DECOMPOSITION", # required, accepts QUERY_DECOMPOSITION
|
1732
|
+
# },
|
1733
|
+
# },
|
1203
1734
|
# retrieval_configuration: {
|
1204
1735
|
# vector_search_configuration: { # required
|
1205
1736
|
# filter: {
|
@@ -1290,8 +1821,12 @@ module Aws::BedrockAgentRuntime
|
|
1290
1821
|
# resp.citations[0].generated_response_part.text_response_part.text #=> String
|
1291
1822
|
# resp.citations[0].retrieved_references #=> Array
|
1292
1823
|
# resp.citations[0].retrieved_references[0].content.text #=> String
|
1824
|
+
# resp.citations[0].retrieved_references[0].location.confluence_location.url #=> String
|
1293
1825
|
# resp.citations[0].retrieved_references[0].location.s3_location.uri #=> String
|
1294
|
-
# resp.citations[0].retrieved_references[0].location.
|
1826
|
+
# resp.citations[0].retrieved_references[0].location.salesforce_location.url #=> String
|
1827
|
+
# resp.citations[0].retrieved_references[0].location.share_point_location.url #=> String
|
1828
|
+
# resp.citations[0].retrieved_references[0].location.type #=> String, one of "S3", "WEB", "CONFLUENCE", "SALESFORCE", "SHAREPOINT"
|
1829
|
+
# resp.citations[0].retrieved_references[0].location.web_location.url #=> String
|
1295
1830
|
# resp.citations[0].retrieved_references[0].metadata #=> Hash
|
1296
1831
|
# resp.guardrail_action #=> String, one of "INTERVENED", "NONE"
|
1297
1832
|
# resp.output.text #=> String
|
@@ -1319,7 +1854,7 @@ module Aws::BedrockAgentRuntime
|
|
1319
1854
|
params: params,
|
1320
1855
|
config: config)
|
1321
1856
|
context[:gem_name] = 'aws-sdk-bedrockagentruntime'
|
1322
|
-
context[:gem_version] = '1.
|
1857
|
+
context[:gem_version] = '1.16.0'
|
1323
1858
|
Seahorse::Client::Request.new(handlers, context)
|
1324
1859
|
end
|
1325
1860
|
|