aws-sdk-bedrockagentruntime 1.15.0 → 1.18.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 +15 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-bedrockagentruntime/client.rb +545 -10
- data/lib/aws-sdk-bedrockagentruntime/client_api.rb +293 -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 +848 -17
- data/lib/aws-sdk-bedrockagentruntime.rb +2 -2
- data/sig/client.rbs +145 -0
- data/sig/types.rbs +236 -4
- metadata +2 -2
@@ -436,7 +436,101 @@ module Aws::BedrockAgentRuntime
|
|
436
436
|
|
437
437
|
# @!group API Operations
|
438
438
|
|
439
|
-
#
|
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`.
|
440
534
|
#
|
441
535
|
# </note>
|
442
536
|
#
|
@@ -501,6 +595,9 @@ module Aws::BedrockAgentRuntime
|
|
501
595
|
#
|
502
596
|
# </note>
|
503
597
|
#
|
598
|
+
# @option params [String] :memory_id
|
599
|
+
# The unique identifier of the agent memory.
|
600
|
+
#
|
504
601
|
# @option params [required, String] :session_id
|
505
602
|
# The unique identifier of the session. Use the same value across
|
506
603
|
# requests to continue the same conversation.
|
@@ -522,6 +619,7 @@ module Aws::BedrockAgentRuntime
|
|
522
619
|
#
|
523
620
|
# * {Types::InvokeAgentResponse#completion #completion} => Types::ResponseStream
|
524
621
|
# * {Types::InvokeAgentResponse#content_type #content_type} => String
|
622
|
+
# * {Types::InvokeAgentResponse#memory_id #memory_id} => String
|
525
623
|
# * {Types::InvokeAgentResponse#session_id #session_id} => String
|
526
624
|
#
|
527
625
|
# @example EventStream Operation Example
|
@@ -582,6 +680,9 @@ module Aws::BedrockAgentRuntime
|
|
582
680
|
# handler.on_dependency_failed_exception_event do |event|
|
583
681
|
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
584
682
|
# end
|
683
|
+
# handler.on_files_event do |event|
|
684
|
+
# event # => Aws::BedrockAgentRuntime::Types::files
|
685
|
+
# end
|
585
686
|
# handler.on_internal_server_exception_event do |event|
|
586
687
|
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
587
688
|
# end
|
@@ -625,6 +726,9 @@ module Aws::BedrockAgentRuntime
|
|
625
726
|
# stream.on_dependency_failed_exception_event do |event|
|
626
727
|
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
627
728
|
# end
|
729
|
+
# stream.on_files_event do |event|
|
730
|
+
# event # => Aws::BedrockAgentRuntime::Types::files
|
731
|
+
# end
|
628
732
|
# stream.on_internal_server_exception_event do |event|
|
629
733
|
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
630
734
|
# end
|
@@ -668,6 +772,9 @@ module Aws::BedrockAgentRuntime
|
|
668
772
|
# handler.on_dependency_failed_exception_event do |event|
|
669
773
|
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
670
774
|
# end
|
775
|
+
# handler.on_files_event do |event|
|
776
|
+
# event # => Aws::BedrockAgentRuntime::Types::files
|
777
|
+
# end
|
671
778
|
# handler.on_internal_server_exception_event do |event|
|
672
779
|
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
673
780
|
# end
|
@@ -714,9 +821,104 @@ module Aws::BedrockAgentRuntime
|
|
714
821
|
# enable_trace: false,
|
715
822
|
# end_session: false,
|
716
823
|
# input_text: "InputText",
|
824
|
+
# memory_id: "MemoryId",
|
717
825
|
# session_id: "SessionId", # required
|
718
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
|
+
# ],
|
719
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
|
+
# ],
|
720
922
|
# prompt_session_attributes: {
|
721
923
|
# "String" => "String",
|
722
924
|
# },
|
@@ -756,7 +958,7 @@ module Aws::BedrockAgentRuntime
|
|
756
958
|
#
|
757
959
|
# All events are available at resp.completion:
|
758
960
|
# resp.completion #=> Enumerator
|
759
|
-
# 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]
|
760
962
|
#
|
761
963
|
# For :access_denied_exception event available at #on_access_denied_exception_event callback and response eventstream enumerator:
|
762
964
|
# event.message #=> String
|
@@ -772,8 +974,12 @@ module Aws::BedrockAgentRuntime
|
|
772
974
|
# event.attribution.citations[0].generated_response_part.text_response_part.text #=> String
|
773
975
|
# event.attribution.citations[0].retrieved_references #=> Array
|
774
976
|
# event.attribution.citations[0].retrieved_references[0].content.text #=> String
|
977
|
+
# event.attribution.citations[0].retrieved_references[0].location.confluence_location.url #=> String
|
775
978
|
# event.attribution.citations[0].retrieved_references[0].location.s3_location.uri #=> String
|
776
|
-
# 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
|
777
983
|
# event.attribution.citations[0].retrieved_references[0].metadata #=> Hash
|
778
984
|
# event.bytes #=> String
|
779
985
|
#
|
@@ -784,6 +990,12 @@ module Aws::BedrockAgentRuntime
|
|
784
990
|
# event.message #=> String
|
785
991
|
# event.resource_name #=> String
|
786
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
|
+
#
|
787
999
|
# For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
|
788
1000
|
# event.message #=> String
|
789
1001
|
#
|
@@ -879,7 +1091,9 @@ module Aws::BedrockAgentRuntime
|
|
879
1091
|
# event.trace.guardrail_trace.trace_id #=> String
|
880
1092
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.action_group_name #=> String
|
881
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"
|
882
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
|
883
1097
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters #=> Array
|
884
1098
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].name #=> String
|
885
1099
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].type #=> String
|
@@ -890,7 +1104,10 @@ module Aws::BedrockAgentRuntime
|
|
890
1104
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].type #=> String
|
891
1105
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].value #=> String
|
892
1106
|
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.verb #=> String
|
893
|
-
# 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"
|
894
1111
|
# event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.knowledge_base_id #=> String
|
895
1112
|
# event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.text #=> String
|
896
1113
|
# event.trace.orchestration_trace.invocation_input.trace_id #=> String
|
@@ -906,12 +1123,25 @@ module Aws::BedrockAgentRuntime
|
|
906
1123
|
# event.trace.orchestration_trace.model_invocation_input.text #=> String
|
907
1124
|
# event.trace.orchestration_trace.model_invocation_input.trace_id #=> String
|
908
1125
|
# event.trace.orchestration_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
|
1126
|
+
# event.trace.orchestration_trace.model_invocation_output.metadata.usage.input_tokens #=> Integer
|
1127
|
+
# event.trace.orchestration_trace.model_invocation_output.metadata.usage.output_tokens #=> Integer
|
1128
|
+
# event.trace.orchestration_trace.model_invocation_output.raw_response.content #=> String
|
1129
|
+
# event.trace.orchestration_trace.model_invocation_output.trace_id #=> String
|
909
1130
|
# event.trace.orchestration_trace.observation.action_group_invocation_output.text #=> String
|
1131
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.execution_error #=> String
|
1132
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.execution_output #=> String
|
1133
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.execution_timeout #=> Boolean
|
1134
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.files #=> Array
|
1135
|
+
# event.trace.orchestration_trace.observation.code_interpreter_invocation_output.files[0] #=> String
|
910
1136
|
# event.trace.orchestration_trace.observation.final_response.text #=> String
|
911
1137
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references #=> Array
|
912
1138
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].content.text #=> String
|
1139
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.confluence_location.url #=> String
|
913
1140
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.s3_location.uri #=> String
|
914
|
-
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.
|
1141
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.salesforce_location.url #=> String
|
1142
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.share_point_location.url #=> String
|
1143
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.type #=> String, one of "S3", "WEB", "CONFLUENCE", "SALESFORCE", "SHAREPOINT"
|
1144
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.web_location.url #=> String
|
915
1145
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].metadata #=> Hash
|
916
1146
|
# event.trace.orchestration_trace.observation.reprompt_response.source #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "PARSER"
|
917
1147
|
# event.trace.orchestration_trace.observation.reprompt_response.text #=> String
|
@@ -953,6 +1183,7 @@ module Aws::BedrockAgentRuntime
|
|
953
1183
|
# event.message #=> String
|
954
1184
|
#
|
955
1185
|
# resp.content_type #=> String
|
1186
|
+
# resp.memory_id #=> String
|
956
1187
|
# resp.session_id #=> String
|
957
1188
|
#
|
958
1189
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/InvokeAgent AWS API Documentation
|
@@ -982,6 +1213,293 @@ module Aws::BedrockAgentRuntime
|
|
982
1213
|
req.send_request(options, &block)
|
983
1214
|
end
|
984
1215
|
|
1216
|
+
# Invokes an alias of a flow to run the inputs that you specify and
|
1217
|
+
# return the output of each node as a stream. If there's an error, the
|
1218
|
+
# error is returned. For more information, see [Test a flow in Amazon
|
1219
|
+
# Bedrock][1] in the Amazon Bedrock User Guide.
|
1220
|
+
#
|
1221
|
+
# <note markdown="1"> The CLI doesn't support streaming operations in Amazon Bedrock,
|
1222
|
+
# including `InvokeFlow`.
|
1223
|
+
#
|
1224
|
+
# </note>
|
1225
|
+
#
|
1226
|
+
#
|
1227
|
+
#
|
1228
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/flows-test.html
|
1229
|
+
#
|
1230
|
+
# @option params [required, String] :flow_alias_identifier
|
1231
|
+
# The unique identifier of the flow alias.
|
1232
|
+
#
|
1233
|
+
# @option params [required, String] :flow_identifier
|
1234
|
+
# The unique identifier of the flow.
|
1235
|
+
#
|
1236
|
+
# @option params [required, Array<Types::FlowInput>] :inputs
|
1237
|
+
# A list of objects, each containing information about an input into the
|
1238
|
+
# flow.
|
1239
|
+
#
|
1240
|
+
# @return [Types::InvokeFlowResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1241
|
+
#
|
1242
|
+
# * {Types::InvokeFlowResponse#response_stream #response_stream} => Types::FlowResponseStream
|
1243
|
+
#
|
1244
|
+
# @example EventStream Operation Example
|
1245
|
+
#
|
1246
|
+
# You can process the event once it arrives immediately, or wait until the
|
1247
|
+
# full response is complete and iterate through the eventstream enumerator.
|
1248
|
+
#
|
1249
|
+
# To interact with event immediately, you need to register #invoke_flow
|
1250
|
+
# with callbacks. Callbacks can be registered for specific events or for all
|
1251
|
+
# events, including error events.
|
1252
|
+
#
|
1253
|
+
# Callbacks can be passed into the `:event_stream_handler` option or within a
|
1254
|
+
# block statement attached to the #invoke_flow call directly. Hybrid
|
1255
|
+
# pattern of both is also supported.
|
1256
|
+
#
|
1257
|
+
# `:event_stream_handler` option takes in either a Proc object or
|
1258
|
+
# Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream object.
|
1259
|
+
#
|
1260
|
+
# Usage pattern a): Callbacks with a block attached to #invoke_flow
|
1261
|
+
# Example for registering callbacks for all event types and an error event
|
1262
|
+
#
|
1263
|
+
# client.invoke_flow( # params input# ) do |stream|
|
1264
|
+
# stream.on_error_event do |event|
|
1265
|
+
# # catch unmodeled error event in the stream
|
1266
|
+
# raise event
|
1267
|
+
# # => Aws::Errors::EventError
|
1268
|
+
# # event.event_type => :error
|
1269
|
+
# # event.error_code => String
|
1270
|
+
# # event.error_message => String
|
1271
|
+
# end
|
1272
|
+
#
|
1273
|
+
# stream.on_event do |event|
|
1274
|
+
# # process all events arrive
|
1275
|
+
# puts event.event_type
|
1276
|
+
# ...
|
1277
|
+
# end
|
1278
|
+
#
|
1279
|
+
# end
|
1280
|
+
#
|
1281
|
+
# Usage pattern b): Pass in `:event_stream_handler` for #invoke_flow
|
1282
|
+
#
|
1283
|
+
# 1) Create a Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream object
|
1284
|
+
# Example for registering callbacks with specific events
|
1285
|
+
#
|
1286
|
+
# handler = Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream.new
|
1287
|
+
# handler.on_access_denied_exception_event do |event|
|
1288
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
1289
|
+
# end
|
1290
|
+
# handler.on_bad_gateway_exception_event do |event|
|
1291
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
1292
|
+
# end
|
1293
|
+
# handler.on_conflict_exception_event do |event|
|
1294
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
1295
|
+
# end
|
1296
|
+
# handler.on_dependency_failed_exception_event do |event|
|
1297
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
1298
|
+
# end
|
1299
|
+
# handler.on_flow_completion_event_event do |event|
|
1300
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowCompletionEvent
|
1301
|
+
# end
|
1302
|
+
# handler.on_flow_output_event_event do |event|
|
1303
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowOutputEvent
|
1304
|
+
# end
|
1305
|
+
# handler.on_internal_server_exception_event do |event|
|
1306
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
1307
|
+
# end
|
1308
|
+
# handler.on_resource_not_found_exception_event do |event|
|
1309
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
1310
|
+
# end
|
1311
|
+
# handler.on_service_quota_exceeded_exception_event do |event|
|
1312
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
1313
|
+
# end
|
1314
|
+
# handler.on_throttling_exception_event do |event|
|
1315
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
1316
|
+
# end
|
1317
|
+
# handler.on_validation_exception_event do |event|
|
1318
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
1319
|
+
# end
|
1320
|
+
#
|
1321
|
+
# client.invoke_flow( # params input #, event_stream_handler: handler)
|
1322
|
+
#
|
1323
|
+
# 2) Use a Ruby Proc object
|
1324
|
+
# Example for registering callbacks with specific events
|
1325
|
+
#
|
1326
|
+
# handler = Proc.new do |stream|
|
1327
|
+
# stream.on_access_denied_exception_event do |event|
|
1328
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
1329
|
+
# end
|
1330
|
+
# stream.on_bad_gateway_exception_event do |event|
|
1331
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
1332
|
+
# end
|
1333
|
+
# stream.on_conflict_exception_event do |event|
|
1334
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
1335
|
+
# end
|
1336
|
+
# stream.on_dependency_failed_exception_event do |event|
|
1337
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
1338
|
+
# end
|
1339
|
+
# stream.on_flow_completion_event_event do |event|
|
1340
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowCompletionEvent
|
1341
|
+
# end
|
1342
|
+
# stream.on_flow_output_event_event do |event|
|
1343
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowOutputEvent
|
1344
|
+
# end
|
1345
|
+
# stream.on_internal_server_exception_event do |event|
|
1346
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
1347
|
+
# end
|
1348
|
+
# stream.on_resource_not_found_exception_event do |event|
|
1349
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
1350
|
+
# end
|
1351
|
+
# stream.on_service_quota_exceeded_exception_event do |event|
|
1352
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
1353
|
+
# end
|
1354
|
+
# stream.on_throttling_exception_event do |event|
|
1355
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
1356
|
+
# end
|
1357
|
+
# stream.on_validation_exception_event do |event|
|
1358
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
1359
|
+
# end
|
1360
|
+
# end
|
1361
|
+
#
|
1362
|
+
# client.invoke_flow( # params input #, event_stream_handler: handler)
|
1363
|
+
#
|
1364
|
+
# Usage pattern c): Hybrid pattern of a) and b)
|
1365
|
+
#
|
1366
|
+
# handler = Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream.new
|
1367
|
+
# handler.on_access_denied_exception_event do |event|
|
1368
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
1369
|
+
# end
|
1370
|
+
# handler.on_bad_gateway_exception_event do |event|
|
1371
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
1372
|
+
# end
|
1373
|
+
# handler.on_conflict_exception_event do |event|
|
1374
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
1375
|
+
# end
|
1376
|
+
# handler.on_dependency_failed_exception_event do |event|
|
1377
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
1378
|
+
# end
|
1379
|
+
# handler.on_flow_completion_event_event do |event|
|
1380
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowCompletionEvent
|
1381
|
+
# end
|
1382
|
+
# handler.on_flow_output_event_event do |event|
|
1383
|
+
# event # => Aws::BedrockAgentRuntime::Types::flowOutputEvent
|
1384
|
+
# end
|
1385
|
+
# handler.on_internal_server_exception_event do |event|
|
1386
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
1387
|
+
# end
|
1388
|
+
# handler.on_resource_not_found_exception_event do |event|
|
1389
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
1390
|
+
# end
|
1391
|
+
# handler.on_service_quota_exceeded_exception_event do |event|
|
1392
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
1393
|
+
# end
|
1394
|
+
# handler.on_throttling_exception_event do |event|
|
1395
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
1396
|
+
# end
|
1397
|
+
# handler.on_validation_exception_event do |event|
|
1398
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
1399
|
+
# end
|
1400
|
+
#
|
1401
|
+
# client.invoke_flow( # params input #, event_stream_handler: handler) do |stream|
|
1402
|
+
# stream.on_error_event do |event|
|
1403
|
+
# # catch unmodeled error event in the stream
|
1404
|
+
# raise event
|
1405
|
+
# # => Aws::Errors::EventError
|
1406
|
+
# # event.event_type => :error
|
1407
|
+
# # event.error_code => String
|
1408
|
+
# # event.error_message => String
|
1409
|
+
# end
|
1410
|
+
# end
|
1411
|
+
#
|
1412
|
+
# You can also iterate through events after the response complete.
|
1413
|
+
#
|
1414
|
+
# Events are available at resp.response_stream # => Enumerator
|
1415
|
+
# For parameter input example, please refer to following request syntax
|
1416
|
+
#
|
1417
|
+
# @example Request syntax with placeholder values
|
1418
|
+
#
|
1419
|
+
# resp = client.invoke_flow({
|
1420
|
+
# flow_alias_identifier: "FlowAliasIdentifier", # required
|
1421
|
+
# flow_identifier: "FlowIdentifier", # required
|
1422
|
+
# inputs: [ # required
|
1423
|
+
# {
|
1424
|
+
# content: { # required
|
1425
|
+
# document: {
|
1426
|
+
# },
|
1427
|
+
# },
|
1428
|
+
# node_name: "NodeName", # required
|
1429
|
+
# node_output_name: "NodeOutputName", # required
|
1430
|
+
# },
|
1431
|
+
# ],
|
1432
|
+
# })
|
1433
|
+
#
|
1434
|
+
# @example Response structure
|
1435
|
+
#
|
1436
|
+
# All events are available at resp.response_stream:
|
1437
|
+
# resp.response_stream #=> Enumerator
|
1438
|
+
# 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]
|
1439
|
+
#
|
1440
|
+
# For :access_denied_exception event available at #on_access_denied_exception_event callback and response eventstream enumerator:
|
1441
|
+
# event.message #=> String
|
1442
|
+
#
|
1443
|
+
# For :bad_gateway_exception event available at #on_bad_gateway_exception_event callback and response eventstream enumerator:
|
1444
|
+
# event.message #=> String
|
1445
|
+
# event.resource_name #=> String
|
1446
|
+
#
|
1447
|
+
# For :conflict_exception event available at #on_conflict_exception_event callback and response eventstream enumerator:
|
1448
|
+
# event.message #=> String
|
1449
|
+
#
|
1450
|
+
# For :dependency_failed_exception event available at #on_dependency_failed_exception_event callback and response eventstream enumerator:
|
1451
|
+
# event.message #=> String
|
1452
|
+
# event.resource_name #=> String
|
1453
|
+
#
|
1454
|
+
# For :flow_completion_event event available at #on_flow_completion_event_event callback and response eventstream enumerator:
|
1455
|
+
# event.completion_reason #=> String, one of "SUCCESS"
|
1456
|
+
#
|
1457
|
+
# For :flow_output_event event available at #on_flow_output_event_event callback and response eventstream enumerator:
|
1458
|
+
# event.node_name #=> String
|
1459
|
+
# event.node_type #=> String, one of "FlowInputNode", "FlowOutputNode", "LambdaFunctionNode", "KnowledgeBaseNode", "PromptNode", "ConditionNode", "LexNode"
|
1460
|
+
#
|
1461
|
+
# For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
|
1462
|
+
# event.message #=> String
|
1463
|
+
#
|
1464
|
+
# For :resource_not_found_exception event available at #on_resource_not_found_exception_event callback and response eventstream enumerator:
|
1465
|
+
# event.message #=> String
|
1466
|
+
#
|
1467
|
+
# For :service_quota_exceeded_exception event available at #on_service_quota_exceeded_exception_event callback and response eventstream enumerator:
|
1468
|
+
# event.message #=> String
|
1469
|
+
#
|
1470
|
+
# For :throttling_exception event available at #on_throttling_exception_event callback and response eventstream enumerator:
|
1471
|
+
# event.message #=> String
|
1472
|
+
#
|
1473
|
+
# For :validation_exception event available at #on_validation_exception_event callback and response eventstream enumerator:
|
1474
|
+
# event.message #=> String
|
1475
|
+
#
|
1476
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/InvokeFlow AWS API Documentation
|
1477
|
+
#
|
1478
|
+
# @overload invoke_flow(params = {})
|
1479
|
+
# @param [Hash] params ({})
|
1480
|
+
def invoke_flow(params = {}, options = {}, &block)
|
1481
|
+
params = params.dup
|
1482
|
+
event_stream_handler = case handler = params.delete(:event_stream_handler)
|
1483
|
+
when EventStreams::FlowResponseStream then handler
|
1484
|
+
when Proc then EventStreams::FlowResponseStream.new.tap(&handler)
|
1485
|
+
when nil then EventStreams::FlowResponseStream.new
|
1486
|
+
else
|
1487
|
+
msg = "expected :event_stream_handler to be a block or "\
|
1488
|
+
"instance of Aws::BedrockAgentRuntime::EventStreams::FlowResponseStream"\
|
1489
|
+
", got `#{handler.inspect}` instead"
|
1490
|
+
raise ArgumentError, msg
|
1491
|
+
end
|
1492
|
+
|
1493
|
+
yield(event_stream_handler) if block_given?
|
1494
|
+
|
1495
|
+
req = build_request(:invoke_flow, params)
|
1496
|
+
|
1497
|
+
req.context[:event_stream_handler] = event_stream_handler
|
1498
|
+
req.handlers.add(Aws::Binary::DecodeHandler, priority: 95)
|
1499
|
+
|
1500
|
+
req.send_request(options, &block)
|
1501
|
+
end
|
1502
|
+
|
985
1503
|
# Queries a knowledge base and retrieves information from it.
|
986
1504
|
#
|
987
1505
|
# @option params [required, String] :knowledge_base_id
|
@@ -1098,8 +1616,12 @@ module Aws::BedrockAgentRuntime
|
|
1098
1616
|
# resp.next_token #=> String
|
1099
1617
|
# resp.retrieval_results #=> Array
|
1100
1618
|
# resp.retrieval_results[0].content.text #=> String
|
1619
|
+
# resp.retrieval_results[0].location.confluence_location.url #=> String
|
1101
1620
|
# resp.retrieval_results[0].location.s3_location.uri #=> String
|
1102
|
-
# resp.retrieval_results[0].location.
|
1621
|
+
# resp.retrieval_results[0].location.salesforce_location.url #=> String
|
1622
|
+
# resp.retrieval_results[0].location.share_point_location.url #=> String
|
1623
|
+
# resp.retrieval_results[0].location.type #=> String, one of "S3", "WEB", "CONFLUENCE", "SALESFORCE", "SHAREPOINT"
|
1624
|
+
# resp.retrieval_results[0].location.web_location.url #=> String
|
1103
1625
|
# resp.retrieval_results[0].metadata #=> Hash
|
1104
1626
|
# resp.retrieval_results[0].score #=> Float
|
1105
1627
|
#
|
@@ -1131,8 +1653,12 @@ module Aws::BedrockAgentRuntime
|
|
1131
1653
|
# Contains details about the session with the knowledge base.
|
1132
1654
|
#
|
1133
1655
|
# @option params [String] :session_id
|
1134
|
-
# The unique identifier of the session.
|
1135
|
-
#
|
1656
|
+
# The unique identifier of the session. When you first make a
|
1657
|
+
# `RetrieveAndGenerate` request, Amazon Bedrock automatically generates
|
1658
|
+
# this value. You must reuse this value for all subsequent requests in
|
1659
|
+
# the same conversational session. This value allows Amazon Bedrock to
|
1660
|
+
# maintain context and knowledge from previous interactions. You can't
|
1661
|
+
# explicitly set the `sessionId` yourself.
|
1136
1662
|
#
|
1137
1663
|
# @return [Types::RetrieveAndGenerateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1138
1664
|
#
|
@@ -1209,6 +1735,11 @@ module Aws::BedrockAgentRuntime
|
|
1209
1735
|
# },
|
1210
1736
|
# knowledge_base_id: "KnowledgeBaseId", # required
|
1211
1737
|
# model_arn: "BedrockModelArn", # required
|
1738
|
+
# orchestration_configuration: {
|
1739
|
+
# query_transformation_configuration: { # required
|
1740
|
+
# type: "QUERY_DECOMPOSITION", # required, accepts QUERY_DECOMPOSITION
|
1741
|
+
# },
|
1742
|
+
# },
|
1212
1743
|
# retrieval_configuration: {
|
1213
1744
|
# vector_search_configuration: { # required
|
1214
1745
|
# filter: {
|
@@ -1299,8 +1830,12 @@ module Aws::BedrockAgentRuntime
|
|
1299
1830
|
# resp.citations[0].generated_response_part.text_response_part.text #=> String
|
1300
1831
|
# resp.citations[0].retrieved_references #=> Array
|
1301
1832
|
# resp.citations[0].retrieved_references[0].content.text #=> String
|
1833
|
+
# resp.citations[0].retrieved_references[0].location.confluence_location.url #=> String
|
1302
1834
|
# resp.citations[0].retrieved_references[0].location.s3_location.uri #=> String
|
1303
|
-
# resp.citations[0].retrieved_references[0].location.
|
1835
|
+
# resp.citations[0].retrieved_references[0].location.salesforce_location.url #=> String
|
1836
|
+
# resp.citations[0].retrieved_references[0].location.share_point_location.url #=> String
|
1837
|
+
# resp.citations[0].retrieved_references[0].location.type #=> String, one of "S3", "WEB", "CONFLUENCE", "SALESFORCE", "SHAREPOINT"
|
1838
|
+
# resp.citations[0].retrieved_references[0].location.web_location.url #=> String
|
1304
1839
|
# resp.citations[0].retrieved_references[0].metadata #=> Hash
|
1305
1840
|
# resp.guardrail_action #=> String, one of "INTERVENED", "NONE"
|
1306
1841
|
# resp.output.text #=> String
|
@@ -1328,7 +1863,7 @@ module Aws::BedrockAgentRuntime
|
|
1328
1863
|
params: params,
|
1329
1864
|
config: config)
|
1330
1865
|
context[:gem_name] = 'aws-sdk-bedrockagentruntime'
|
1331
|
-
context[:gem_version] = '1.
|
1866
|
+
context[:gem_version] = '1.18.0'
|
1332
1867
|
Seahorse::Client::Request.new(handlers, context)
|
1333
1868
|
end
|
1334
1869
|
|