aws-sdk-bedrockagentruntime 1.15.0 → 1.16.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-bedrockagentruntime/client.rb +536 -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 +145 -0
- data/sig/types.rbs +209 -3
- 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
|
@@ -907,11 +1124,20 @@ module Aws::BedrockAgentRuntime
|
|
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"
|
909
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
|
910
1132
|
# event.trace.orchestration_trace.observation.final_response.text #=> String
|
911
1133
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references #=> Array
|
912
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
|
913
1136
|
# 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.
|
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
|
915
1141
|
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].metadata #=> Hash
|
916
1142
|
# event.trace.orchestration_trace.observation.reprompt_response.source #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "PARSER"
|
917
1143
|
# event.trace.orchestration_trace.observation.reprompt_response.text #=> String
|
@@ -953,6 +1179,7 @@ module Aws::BedrockAgentRuntime
|
|
953
1179
|
# event.message #=> String
|
954
1180
|
#
|
955
1181
|
# resp.content_type #=> String
|
1182
|
+
# resp.memory_id #=> String
|
956
1183
|
# resp.session_id #=> String
|
957
1184
|
#
|
958
1185
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/InvokeAgent AWS API Documentation
|
@@ -982,6 +1209,288 @@ module Aws::BedrockAgentRuntime
|
|
982
1209
|
req.send_request(options, &block)
|
983
1210
|
end
|
984
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
|
+
|
985
1494
|
# Queries a knowledge base and retrieves information from it.
|
986
1495
|
#
|
987
1496
|
# @option params [required, String] :knowledge_base_id
|
@@ -1098,8 +1607,12 @@ module Aws::BedrockAgentRuntime
|
|
1098
1607
|
# resp.next_token #=> String
|
1099
1608
|
# resp.retrieval_results #=> Array
|
1100
1609
|
# resp.retrieval_results[0].content.text #=> String
|
1610
|
+
# resp.retrieval_results[0].location.confluence_location.url #=> String
|
1101
1611
|
# resp.retrieval_results[0].location.s3_location.uri #=> String
|
1102
|
-
# 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
|
1103
1616
|
# resp.retrieval_results[0].metadata #=> Hash
|
1104
1617
|
# resp.retrieval_results[0].score #=> Float
|
1105
1618
|
#
|
@@ -1131,8 +1644,12 @@ module Aws::BedrockAgentRuntime
|
|
1131
1644
|
# Contains details about the session with the knowledge base.
|
1132
1645
|
#
|
1133
1646
|
# @option params [String] :session_id
|
1134
|
-
# The unique identifier of the session.
|
1135
|
-
#
|
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.
|
1136
1653
|
#
|
1137
1654
|
# @return [Types::RetrieveAndGenerateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
1138
1655
|
#
|
@@ -1209,6 +1726,11 @@ module Aws::BedrockAgentRuntime
|
|
1209
1726
|
# },
|
1210
1727
|
# knowledge_base_id: "KnowledgeBaseId", # required
|
1211
1728
|
# model_arn: "BedrockModelArn", # required
|
1729
|
+
# orchestration_configuration: {
|
1730
|
+
# query_transformation_configuration: { # required
|
1731
|
+
# type: "QUERY_DECOMPOSITION", # required, accepts QUERY_DECOMPOSITION
|
1732
|
+
# },
|
1733
|
+
# },
|
1212
1734
|
# retrieval_configuration: {
|
1213
1735
|
# vector_search_configuration: { # required
|
1214
1736
|
# filter: {
|
@@ -1299,8 +1821,12 @@ module Aws::BedrockAgentRuntime
|
|
1299
1821
|
# resp.citations[0].generated_response_part.text_response_part.text #=> String
|
1300
1822
|
# resp.citations[0].retrieved_references #=> Array
|
1301
1823
|
# resp.citations[0].retrieved_references[0].content.text #=> String
|
1824
|
+
# resp.citations[0].retrieved_references[0].location.confluence_location.url #=> String
|
1302
1825
|
# resp.citations[0].retrieved_references[0].location.s3_location.uri #=> String
|
1303
|
-
# 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
|
1304
1830
|
# resp.citations[0].retrieved_references[0].metadata #=> Hash
|
1305
1831
|
# resp.guardrail_action #=> String, one of "INTERVENED", "NONE"
|
1306
1832
|
# resp.output.text #=> String
|
@@ -1328,7 +1854,7 @@ module Aws::BedrockAgentRuntime
|
|
1328
1854
|
params: params,
|
1329
1855
|
config: config)
|
1330
1856
|
context[:gem_name] = 'aws-sdk-bedrockagentruntime'
|
1331
|
-
context[:gem_version] = '1.
|
1857
|
+
context[:gem_version] = '1.16.0'
|
1332
1858
|
Seahorse::Client::Request.new(handlers, context)
|
1333
1859
|
end
|
1334
1860
|
|