aws-sdk-bedrockagentruntime 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -399,30 +399,66 @@ module Aws::BedrockAgentRuntime
399
399
 
400
400
  # @!group API Operations
401
401
 
402
- # Invokes the specified Bedrock model to run inference using the input
403
- # provided in the request body.
402
+ # Sends a prompt for the agent to process and respond to.
404
403
  #
405
- # @option params [Types::SessionState] :session_state
406
- # Session state passed by customer. Base64 encoded json string
407
- # representation of SessionState.
404
+ # <note markdown="1"> The CLI doesn't support `InvokeAgent`.
408
405
  #
409
- # @option params [required, String] :agent_id
410
- # Identifier for Agent
406
+ # </note>
411
407
  #
412
- # @option params [required, String] :agent_alias_id
413
- # Identifier for Agent Alias
408
+ # * To continue the same conversation with an agent, use the same
409
+ # `sessionId` value in the request.
414
410
  #
415
- # @option params [required, String] :session_id
416
- # Identifier used for the current session
411
+ # * To activate trace enablement, turn `enableTrace` to `true`. Trace
412
+ # enablement helps you follow the agent's reasoning process that led
413
+ # it to the information it processed, the actions it took, and the
414
+ # final result it yielded. For more information, see [Trace
415
+ # enablement][1].
416
+ #
417
+ # * End a conversation by setting `endSession` to `true`.
418
+ #
419
+ # * Include attributes for the session or prompt in the `sessionState`
420
+ # object.
421
+ #
422
+ # The response is returned in the `bytes` field of the `chunk` object.
423
+ #
424
+ # * The `attribution` object contains citations for parts of the
425
+ # response.
426
+ #
427
+ # * If you set `enableTrace` to `true` in the request, you can trace the
428
+ # agent's steps and reasoning process that led it to the response.
429
+ #
430
+ # * Errors are also surfaced in the response.
417
431
  #
418
- # @option params [Boolean] :end_session
419
- # End current session
432
+ #
433
+ #
434
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-events
435
+ #
436
+ # @option params [required, String] :agent_alias_id
437
+ # The alias of the agent to use.
438
+ #
439
+ # @option params [required, String] :agent_id
440
+ # The unique identifier of the agent to use.
420
441
  #
421
442
  # @option params [Boolean] :enable_trace
422
- # Enable agent trace events for improved debugging
443
+ # Specifies whether to turn on the trace or not to track the agent's
444
+ # reasoning process. For more information, see [Trace enablement][1].
445
+ #
446
+ #
447
+ #
448
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-events
449
+ #
450
+ # @option params [Boolean] :end_session
451
+ # Specifies whether to end the session with the agent or not.
423
452
  #
424
453
  # @option params [required, String] :input_text
425
- # Input data in the format specified in the Content-Type request header.
454
+ # The prompt text to send the agent.
455
+ #
456
+ # @option params [required, String] :session_id
457
+ # The unique identifier of the session. Use the same value across
458
+ # requests to continue the same conversation.
459
+ #
460
+ # @option params [Types::SessionState] :session_state
461
+ # Contains parameters that specify various attributes of the session.
426
462
  #
427
463
  # @return [Types::InvokeAgentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
428
464
  #
@@ -473,18 +509,24 @@ module Aws::BedrockAgentRuntime
473
509
  # Example for registering callbacks with specific events
474
510
  #
475
511
  # handler = Aws::BedrockAgentRuntime::EventStreams::ResponseStream.new
512
+ # handler.on_access_denied_exception_event do |event|
513
+ # event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
514
+ # end
515
+ # handler.on_bad_gateway_exception_event do |event|
516
+ # event # => Aws::BedrockAgentRuntime::Types::badGatewayException
517
+ # end
476
518
  # handler.on_chunk_event do |event|
477
519
  # event # => Aws::BedrockAgentRuntime::Types::chunk
478
520
  # end
479
- # handler.on_trace_event do |event|
480
- # event # => Aws::BedrockAgentRuntime::Types::trace
521
+ # handler.on_conflict_exception_event do |event|
522
+ # event # => Aws::BedrockAgentRuntime::Types::conflictException
523
+ # end
524
+ # handler.on_dependency_failed_exception_event do |event|
525
+ # event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
481
526
  # end
482
527
  # handler.on_internal_server_exception_event do |event|
483
528
  # event # => Aws::BedrockAgentRuntime::Types::internalServerException
484
529
  # end
485
- # handler.on_validation_exception_event do |event|
486
- # event # => Aws::BedrockAgentRuntime::Types::validationException
487
- # end
488
530
  # handler.on_resource_not_found_exception_event do |event|
489
531
  # event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
490
532
  # end
@@ -494,17 +536,11 @@ module Aws::BedrockAgentRuntime
494
536
  # handler.on_throttling_exception_event do |event|
495
537
  # event # => Aws::BedrockAgentRuntime::Types::throttlingException
496
538
  # end
497
- # handler.on_access_denied_exception_event do |event|
498
- # event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
499
- # end
500
- # handler.on_conflict_exception_event do |event|
501
- # event # => Aws::BedrockAgentRuntime::Types::conflictException
502
- # end
503
- # handler.on_dependency_failed_exception_event do |event|
504
- # event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
539
+ # handler.on_trace_event do |event|
540
+ # event # => Aws::BedrockAgentRuntime::Types::trace
505
541
  # end
506
- # handler.on_bad_gateway_exception_event do |event|
507
- # event # => Aws::BedrockAgentRuntime::Types::badGatewayException
542
+ # handler.on_validation_exception_event do |event|
543
+ # event # => Aws::BedrockAgentRuntime::Types::validationException
508
544
  # end
509
545
  #
510
546
  # client.invoke_agent( # params input #, event_stream_handler: handler)
@@ -513,18 +549,24 @@ module Aws::BedrockAgentRuntime
513
549
  # Example for registering callbacks with specific events
514
550
  #
515
551
  # handler = Proc.new do |stream|
552
+ # stream.on_access_denied_exception_event do |event|
553
+ # event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
554
+ # end
555
+ # stream.on_bad_gateway_exception_event do |event|
556
+ # event # => Aws::BedrockAgentRuntime::Types::badGatewayException
557
+ # end
516
558
  # stream.on_chunk_event do |event|
517
559
  # event # => Aws::BedrockAgentRuntime::Types::chunk
518
560
  # end
519
- # stream.on_trace_event do |event|
520
- # event # => Aws::BedrockAgentRuntime::Types::trace
561
+ # stream.on_conflict_exception_event do |event|
562
+ # event # => Aws::BedrockAgentRuntime::Types::conflictException
563
+ # end
564
+ # stream.on_dependency_failed_exception_event do |event|
565
+ # event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
521
566
  # end
522
567
  # stream.on_internal_server_exception_event do |event|
523
568
  # event # => Aws::BedrockAgentRuntime::Types::internalServerException
524
569
  # end
525
- # stream.on_validation_exception_event do |event|
526
- # event # => Aws::BedrockAgentRuntime::Types::validationException
527
- # end
528
570
  # stream.on_resource_not_found_exception_event do |event|
529
571
  # event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
530
572
  # end
@@ -534,17 +576,11 @@ module Aws::BedrockAgentRuntime
534
576
  # stream.on_throttling_exception_event do |event|
535
577
  # event # => Aws::BedrockAgentRuntime::Types::throttlingException
536
578
  # end
537
- # stream.on_access_denied_exception_event do |event|
538
- # event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
539
- # end
540
- # stream.on_conflict_exception_event do |event|
541
- # event # => Aws::BedrockAgentRuntime::Types::conflictException
542
- # end
543
- # stream.on_dependency_failed_exception_event do |event|
544
- # event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
579
+ # stream.on_trace_event do |event|
580
+ # event # => Aws::BedrockAgentRuntime::Types::trace
545
581
  # end
546
- # stream.on_bad_gateway_exception_event do |event|
547
- # event # => Aws::BedrockAgentRuntime::Types::badGatewayException
582
+ # stream.on_validation_exception_event do |event|
583
+ # event # => Aws::BedrockAgentRuntime::Types::validationException
548
584
  # end
549
585
  # end
550
586
  #
@@ -553,18 +589,24 @@ module Aws::BedrockAgentRuntime
553
589
  # Usage pattern c): hybird pattern of a) and b)
554
590
  #
555
591
  # handler = Aws::BedrockAgentRuntime::EventStreams::ResponseStream.new
592
+ # handler.on_access_denied_exception_event do |event|
593
+ # event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
594
+ # end
595
+ # handler.on_bad_gateway_exception_event do |event|
596
+ # event # => Aws::BedrockAgentRuntime::Types::badGatewayException
597
+ # end
556
598
  # handler.on_chunk_event do |event|
557
599
  # event # => Aws::BedrockAgentRuntime::Types::chunk
558
600
  # end
559
- # handler.on_trace_event do |event|
560
- # event # => Aws::BedrockAgentRuntime::Types::trace
601
+ # handler.on_conflict_exception_event do |event|
602
+ # event # => Aws::BedrockAgentRuntime::Types::conflictException
603
+ # end
604
+ # handler.on_dependency_failed_exception_event do |event|
605
+ # event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
561
606
  # end
562
607
  # handler.on_internal_server_exception_event do |event|
563
608
  # event # => Aws::BedrockAgentRuntime::Types::internalServerException
564
609
  # end
565
- # handler.on_validation_exception_event do |event|
566
- # event # => Aws::BedrockAgentRuntime::Types::validationException
567
- # end
568
610
  # handler.on_resource_not_found_exception_event do |event|
569
611
  # event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
570
612
  # end
@@ -574,17 +616,11 @@ module Aws::BedrockAgentRuntime
574
616
  # handler.on_throttling_exception_event do |event|
575
617
  # event # => Aws::BedrockAgentRuntime::Types::throttlingException
576
618
  # end
577
- # handler.on_access_denied_exception_event do |event|
578
- # event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
579
- # end
580
- # handler.on_conflict_exception_event do |event|
581
- # event # => Aws::BedrockAgentRuntime::Types::conflictException
582
- # end
583
- # handler.on_dependency_failed_exception_event do |event|
584
- # event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
619
+ # handler.on_trace_event do |event|
620
+ # event # => Aws::BedrockAgentRuntime::Types::trace
585
621
  # end
586
- # handler.on_bad_gateway_exception_event do |event|
587
- # event # => Aws::BedrockAgentRuntime::Types::badGatewayException
622
+ # handler.on_validation_exception_event do |event|
623
+ # event # => Aws::BedrockAgentRuntime::Types::validationException
588
624
  # end
589
625
  #
590
626
  # client.invoke_agent( # params input #, event_stream_handler: handler) do |stream|
@@ -607,64 +643,72 @@ module Aws::BedrockAgentRuntime
607
643
  # @example Request syntax with placeholder values
608
644
  #
609
645
  # resp = client.invoke_agent({
646
+ # agent_alias_id: "AgentAliasId", # required
647
+ # agent_id: "AgentId", # required
648
+ # enable_trace: false,
649
+ # end_session: false,
650
+ # input_text: "InputText", # required
651
+ # session_id: "SessionId", # required
610
652
  # session_state: {
611
- # session_attributes: {
653
+ # prompt_session_attributes: {
612
654
  # "String" => "String",
613
655
  # },
614
- # prompt_session_attributes: {
656
+ # session_attributes: {
615
657
  # "String" => "String",
616
658
  # },
617
659
  # },
618
- # agent_id: "AgentId", # required
619
- # agent_alias_id: "AgentAliasId", # required
620
- # session_id: "SessionId", # required
621
- # end_session: false,
622
- # enable_trace: false,
623
- # input_text: "InputText", # required
624
660
  # })
625
661
  #
626
662
  # @example Response structure
627
663
  #
628
664
  # All events are available at resp.completion:
629
665
  # resp.completion #=> Enumerator
630
- # resp.completion.event_types #=> [:chunk, :trace, :internal_server_exception, :validation_exception, :resource_not_found_exception, :service_quota_exceeded_exception, :throttling_exception, :access_denied_exception, :conflict_exception, :dependency_failed_exception, :bad_gateway_exception]
666
+ # resp.completion.event_types #=> [:access_denied_exception, :bad_gateway_exception, :chunk, :conflict_exception, :dependency_failed_exception, :internal_server_exception, :resource_not_found_exception, :service_quota_exceeded_exception, :throttling_exception, :trace, :validation_exception]
667
+ #
668
+ # For :access_denied_exception event available at #on_access_denied_exception_event callback and response eventstream enumerator:
669
+ # event.message #=> String
670
+ #
671
+ # For :bad_gateway_exception event available at #on_bad_gateway_exception_event callback and response eventstream enumerator:
672
+ # event.message #=> String
673
+ # event.resource_name #=> String
631
674
  #
632
675
  # For :chunk event available at #on_chunk_event callback and response eventstream enumerator:
633
- # event.bytes #=> String
634
676
  # event.attribution.citations #=> Array
635
- # event.attribution.citations[0].generated_response_part.text_response_part.text #=> String
636
- # event.attribution.citations[0].generated_response_part.text_response_part.span.start #=> Integer
637
677
  # event.attribution.citations[0].generated_response_part.text_response_part.span.end #=> Integer
678
+ # event.attribution.citations[0].generated_response_part.text_response_part.span.start #=> Integer
679
+ # event.attribution.citations[0].generated_response_part.text_response_part.text #=> String
638
680
  # event.attribution.citations[0].retrieved_references #=> Array
639
681
  # event.attribution.citations[0].retrieved_references[0].content.text #=> String
640
- # event.attribution.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
641
682
  # event.attribution.citations[0].retrieved_references[0].location.s3_location.uri #=> String
683
+ # event.attribution.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
684
+ # event.bytes #=> String
685
+ #
686
+ # For :conflict_exception event available at #on_conflict_exception_event callback and response eventstream enumerator:
687
+ # event.message #=> String
688
+ #
689
+ # For :dependency_failed_exception event available at #on_dependency_failed_exception_event callback and response eventstream enumerator:
690
+ # event.message #=> String
691
+ # event.resource_name #=> String
692
+ #
693
+ # For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
694
+ # event.message #=> String
695
+ #
696
+ # For :resource_not_found_exception event available at #on_resource_not_found_exception_event callback and response eventstream enumerator:
697
+ # event.message #=> String
698
+ #
699
+ # For :service_quota_exceeded_exception event available at #on_service_quota_exceeded_exception_event callback and response eventstream enumerator:
700
+ # event.message #=> String
701
+ #
702
+ # For :throttling_exception event available at #on_throttling_exception_event callback and response eventstream enumerator:
703
+ # event.message #=> String
642
704
  #
643
705
  # For :trace event available at #on_trace_event callback and response eventstream enumerator:
644
- # event.agent_id #=> String
645
706
  # event.agent_alias_id #=> String
707
+ # event.agent_id #=> String
646
708
  # event.session_id #=> String
647
- # event.trace.pre_processing_trace.model_invocation_input.trace_id #=> String
648
- # event.trace.pre_processing_trace.model_invocation_input.text #=> String
649
- # event.trace.pre_processing_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
650
- # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.temperature #=> Float
651
- # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.top_p #=> Float
652
- # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.top_k #=> Integer
653
- # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.maximum_length #=> Integer
654
- # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.stop_sequences #=> Array
655
- # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.stop_sequences[0] #=> String
656
- # event.trace.pre_processing_trace.model_invocation_input.override_lambda #=> String
657
- # event.trace.pre_processing_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
658
- # event.trace.pre_processing_trace.model_invocation_input.parser_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
659
- # event.trace.pre_processing_trace.model_invocation_output.trace_id #=> String
660
- # event.trace.pre_processing_trace.model_invocation_output.parsed_response.rationale #=> String
661
- # event.trace.pre_processing_trace.model_invocation_output.parsed_response.is_valid #=> Boolean
662
- # event.trace.orchestration_trace.rationale.trace_id #=> String
663
- # event.trace.orchestration_trace.rationale.text #=> String
664
- # event.trace.orchestration_trace.invocation_input.trace_id #=> String
665
- # event.trace.orchestration_trace.invocation_input.invocation_type #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "FINISH"
709
+ # event.trace.failure_trace.failure_reason #=> String
710
+ # event.trace.failure_trace.trace_id #=> String
666
711
  # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.action_group_name #=> String
667
- # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.verb #=> String
668
712
  # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.api_path #=> String
669
713
  # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters #=> Array
670
714
  # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].name #=> String
@@ -675,76 +719,68 @@ module Aws::BedrockAgentRuntime
675
719
  # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].name #=> String
676
720
  # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].type #=> String
677
721
  # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].value #=> String
678
- # event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.text #=> String
722
+ # event.trace.orchestration_trace.invocation_input.action_group_invocation_input.verb #=> String
723
+ # event.trace.orchestration_trace.invocation_input.invocation_type #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "FINISH"
679
724
  # event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.knowledge_base_id #=> String
680
- # event.trace.orchestration_trace.observation.trace_id #=> String
681
- # event.trace.orchestration_trace.observation.type #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "FINISH", "ASK_USER", "REPROMPT"
682
- # event.trace.orchestration_trace.observation.action_group_invocation_output.text #=> String
683
- # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references #=> Array
684
- # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].content.text #=> String
685
- # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.type #=> String, one of "S3"
686
- # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.s3_location.uri #=> String
687
- # event.trace.orchestration_trace.observation.final_response.text #=> String
688
- # event.trace.orchestration_trace.observation.reprompt_response.text #=> String
689
- # event.trace.orchestration_trace.observation.reprompt_response.source #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "PARSER"
690
- # event.trace.orchestration_trace.model_invocation_input.trace_id #=> String
691
- # event.trace.orchestration_trace.model_invocation_input.text #=> String
692
- # event.trace.orchestration_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
693
- # event.trace.orchestration_trace.model_invocation_input.inference_configuration.temperature #=> Float
694
- # event.trace.orchestration_trace.model_invocation_input.inference_configuration.top_p #=> Float
695
- # event.trace.orchestration_trace.model_invocation_input.inference_configuration.top_k #=> Integer
725
+ # event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.text #=> String
726
+ # event.trace.orchestration_trace.invocation_input.trace_id #=> String
696
727
  # event.trace.orchestration_trace.model_invocation_input.inference_configuration.maximum_length #=> Integer
697
728
  # event.trace.orchestration_trace.model_invocation_input.inference_configuration.stop_sequences #=> Array
698
729
  # event.trace.orchestration_trace.model_invocation_input.inference_configuration.stop_sequences[0] #=> String
730
+ # event.trace.orchestration_trace.model_invocation_input.inference_configuration.temperature #=> Float
731
+ # event.trace.orchestration_trace.model_invocation_input.inference_configuration.top_k #=> Integer
732
+ # event.trace.orchestration_trace.model_invocation_input.inference_configuration.top_p #=> Float
699
733
  # event.trace.orchestration_trace.model_invocation_input.override_lambda #=> String
700
- # event.trace.orchestration_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
701
734
  # event.trace.orchestration_trace.model_invocation_input.parser_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
702
- # event.trace.post_processing_trace.model_invocation_input.trace_id #=> String
703
- # event.trace.post_processing_trace.model_invocation_input.text #=> String
704
- # event.trace.post_processing_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
705
- # event.trace.post_processing_trace.model_invocation_input.inference_configuration.temperature #=> Float
706
- # event.trace.post_processing_trace.model_invocation_input.inference_configuration.top_p #=> Float
707
- # event.trace.post_processing_trace.model_invocation_input.inference_configuration.top_k #=> Integer
735
+ # event.trace.orchestration_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
736
+ # event.trace.orchestration_trace.model_invocation_input.text #=> String
737
+ # event.trace.orchestration_trace.model_invocation_input.trace_id #=> String
738
+ # event.trace.orchestration_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
739
+ # event.trace.orchestration_trace.observation.action_group_invocation_output.text #=> String
740
+ # event.trace.orchestration_trace.observation.final_response.text #=> String
741
+ # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references #=> Array
742
+ # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].content.text #=> String
743
+ # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.s3_location.uri #=> String
744
+ # event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.type #=> String, one of "S3"
745
+ # event.trace.orchestration_trace.observation.reprompt_response.source #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "PARSER"
746
+ # event.trace.orchestration_trace.observation.reprompt_response.text #=> String
747
+ # event.trace.orchestration_trace.observation.trace_id #=> String
748
+ # event.trace.orchestration_trace.observation.type #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "FINISH", "ASK_USER", "REPROMPT"
749
+ # event.trace.orchestration_trace.rationale.text #=> String
750
+ # event.trace.orchestration_trace.rationale.trace_id #=> String
708
751
  # event.trace.post_processing_trace.model_invocation_input.inference_configuration.maximum_length #=> Integer
709
752
  # event.trace.post_processing_trace.model_invocation_input.inference_configuration.stop_sequences #=> Array
710
753
  # event.trace.post_processing_trace.model_invocation_input.inference_configuration.stop_sequences[0] #=> String
754
+ # event.trace.post_processing_trace.model_invocation_input.inference_configuration.temperature #=> Float
755
+ # event.trace.post_processing_trace.model_invocation_input.inference_configuration.top_k #=> Integer
756
+ # event.trace.post_processing_trace.model_invocation_input.inference_configuration.top_p #=> Float
711
757
  # event.trace.post_processing_trace.model_invocation_input.override_lambda #=> String
712
- # event.trace.post_processing_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
713
758
  # event.trace.post_processing_trace.model_invocation_input.parser_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
714
- # event.trace.post_processing_trace.model_invocation_output.trace_id #=> String
759
+ # event.trace.post_processing_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
760
+ # event.trace.post_processing_trace.model_invocation_input.text #=> String
761
+ # event.trace.post_processing_trace.model_invocation_input.trace_id #=> String
762
+ # event.trace.post_processing_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
715
763
  # event.trace.post_processing_trace.model_invocation_output.parsed_response.text #=> String
716
- # event.trace.failure_trace.trace_id #=> String
717
- # event.trace.failure_trace.failure_reason #=> String
718
- #
719
- # For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
720
- # event.message #=> String
764
+ # event.trace.post_processing_trace.model_invocation_output.trace_id #=> String
765
+ # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.maximum_length #=> Integer
766
+ # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.stop_sequences #=> Array
767
+ # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.stop_sequences[0] #=> String
768
+ # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.temperature #=> Float
769
+ # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.top_k #=> Integer
770
+ # event.trace.pre_processing_trace.model_invocation_input.inference_configuration.top_p #=> Float
771
+ # event.trace.pre_processing_trace.model_invocation_input.override_lambda #=> String
772
+ # event.trace.pre_processing_trace.model_invocation_input.parser_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
773
+ # event.trace.pre_processing_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
774
+ # event.trace.pre_processing_trace.model_invocation_input.text #=> String
775
+ # event.trace.pre_processing_trace.model_invocation_input.trace_id #=> String
776
+ # event.trace.pre_processing_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
777
+ # event.trace.pre_processing_trace.model_invocation_output.parsed_response.is_valid #=> Boolean
778
+ # event.trace.pre_processing_trace.model_invocation_output.parsed_response.rationale #=> String
779
+ # event.trace.pre_processing_trace.model_invocation_output.trace_id #=> String
721
780
  #
722
781
  # For :validation_exception event available at #on_validation_exception_event callback and response eventstream enumerator:
723
782
  # event.message #=> String
724
783
  #
725
- # For :resource_not_found_exception event available at #on_resource_not_found_exception_event callback and response eventstream enumerator:
726
- # event.message #=> String
727
- #
728
- # For :service_quota_exceeded_exception event available at #on_service_quota_exceeded_exception_event callback and response eventstream enumerator:
729
- # event.message #=> String
730
- #
731
- # For :throttling_exception event available at #on_throttling_exception_event callback and response eventstream enumerator:
732
- # event.message #=> String
733
- #
734
- # For :access_denied_exception event available at #on_access_denied_exception_event callback and response eventstream enumerator:
735
- # event.message #=> String
736
- #
737
- # For :conflict_exception event available at #on_conflict_exception_event callback and response eventstream enumerator:
738
- # event.message #=> String
739
- #
740
- # For :dependency_failed_exception event available at #on_dependency_failed_exception_event callback and response eventstream enumerator:
741
- # event.message #=> String
742
- # event.resource_name #=> String
743
- #
744
- # For :bad_gateway_exception event available at #on_bad_gateway_exception_event callback and response eventstream enumerator:
745
- # event.message #=> String
746
- # event.resource_name #=> String
747
- #
748
784
  # resp.content_type #=> String
749
785
  # resp.session_id #=> String
750
786
  #
@@ -775,24 +811,26 @@ module Aws::BedrockAgentRuntime
775
811
  req.send_request(options, &block)
776
812
  end
777
813
 
778
- # Retrieve from knowledge base.
814
+ # Queries a knowledge base and retrieves information from it.
779
815
  #
780
816
  # @option params [required, String] :knowledge_base_id
781
- # Identifier of the KnowledgeBase
817
+ # The unique identifier of the knowledge base to query.
782
818
  #
783
- # @option params [required, Types::KnowledgeBaseQuery] :retrieval_query
784
- # Knowledge base input query.
819
+ # @option params [String] :next_token
820
+ # If there are more results than can fit in the response, the response
821
+ # returns a `nextToken`. Use this token in the `nextToken` field of
822
+ # another request to retrieve the next batch of results.
785
823
  #
786
824
  # @option params [Types::KnowledgeBaseRetrievalConfiguration] :retrieval_configuration
787
- # Search parameters for retrieving from knowledge base.
825
+ # Contains details about how the results should be returned.
788
826
  #
789
- # @option params [String] :next_token
790
- # Opaque continuation token of previous paginated response.
827
+ # @option params [required, Types::KnowledgeBaseQuery] :retrieval_query
828
+ # The query to send the knowledge base.
791
829
  #
792
830
  # @return [Types::RetrieveResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
793
831
  #
794
- # * {Types::RetrieveResponse#retrieval_results #retrieval_results} => Array&lt;Types::KnowledgeBaseRetrievalResult&gt;
795
832
  # * {Types::RetrieveResponse#next_token #next_token} => String
833
+ # * {Types::RetrieveResponse#retrieval_results #retrieval_results} => Array&lt;Types::KnowledgeBaseRetrievalResult&gt;
796
834
  #
797
835
  # The returned {Seahorse::Client::Response response} is a pageable response and is Enumerable. For details on usage see {Aws::PageableResponse PageableResponse}.
798
836
  #
@@ -800,26 +838,26 @@ module Aws::BedrockAgentRuntime
800
838
  #
801
839
  # resp = client.retrieve({
802
840
  # knowledge_base_id: "KnowledgeBaseId", # required
803
- # retrieval_query: { # required
804
- # text: "KnowledgeBaseQueryTextString", # required
805
- # },
841
+ # next_token: "NextToken",
806
842
  # retrieval_configuration: {
807
843
  # vector_search_configuration: { # required
808
844
  # number_of_results: 1,
809
845
  # override_search_type: "HYBRID", # accepts HYBRID, SEMANTIC
810
846
  # },
811
847
  # },
812
- # next_token: "NextToken",
848
+ # retrieval_query: { # required
849
+ # text: "KnowledgeBaseQueryTextString", # required
850
+ # },
813
851
  # })
814
852
  #
815
853
  # @example Response structure
816
854
  #
855
+ # resp.next_token #=> String
817
856
  # resp.retrieval_results #=> Array
818
857
  # resp.retrieval_results[0].content.text #=> String
819
- # resp.retrieval_results[0].location.type #=> String, one of "S3"
820
858
  # resp.retrieval_results[0].location.s3_location.uri #=> String
859
+ # resp.retrieval_results[0].location.type #=> String, one of "S3"
821
860
  # resp.retrieval_results[0].score #=> Float
822
- # resp.next_token #=> String
823
861
  #
824
862
  # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/Retrieve AWS API Documentation
825
863
  #
@@ -830,35 +868,47 @@ module Aws::BedrockAgentRuntime
830
868
  req.send_request(options)
831
869
  end
832
870
 
833
- # RetrieveAndGenerate API
871
+ # Queries a knowledge base and generates responses based on the
872
+ # retrieved results. The response cites up to five sources but only
873
+ # selects the ones that are relevant to the query.
834
874
  #
835
- # @option params [String] :session_id
836
- # Identifier of the session.
875
+ # <note markdown="1"> The `numberOfResults` field is currently unsupported for
876
+ # `RetrieveAndGenerate`. Don't include it in the
877
+ # [vectorSearchConfiguration][1] object.
878
+ #
879
+ # </note>
880
+ #
881
+ #
882
+ #
883
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_KnowledgeBaseVectorSearchConfiguration.html
837
884
  #
838
885
  # @option params [required, Types::RetrieveAndGenerateInput] :input
839
- # Customer input of the turn
886
+ # Contains the query made to the knowledge base.
840
887
  #
841
888
  # @option params [Types::RetrieveAndGenerateConfiguration] :retrieve_and_generate_configuration
842
- # Configures the retrieval and generation for the session.
889
+ # Contains details about the resource being queried and the foundation
890
+ # model used for generation.
843
891
  #
844
892
  # @option params [Types::RetrieveAndGenerateSessionConfiguration] :session_configuration
845
- # Configures common parameters of the session.
893
+ # Contains details about the session with the knowledge base.
894
+ #
895
+ # @option params [String] :session_id
896
+ # The unique identifier of the session. Reuse the same value to continue
897
+ # the same session with the knowledge base.
846
898
  #
847
899
  # @return [Types::RetrieveAndGenerateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
848
900
  #
849
- # * {Types::RetrieveAndGenerateResponse#session_id #session_id} => String
850
- # * {Types::RetrieveAndGenerateResponse#output #output} => Types::RetrieveAndGenerateOutput
851
901
  # * {Types::RetrieveAndGenerateResponse#citations #citations} => Array&lt;Types::Citation&gt;
902
+ # * {Types::RetrieveAndGenerateResponse#output #output} => Types::RetrieveAndGenerateOutput
903
+ # * {Types::RetrieveAndGenerateResponse#session_id #session_id} => String
852
904
  #
853
905
  # @example Request syntax with placeholder values
854
906
  #
855
907
  # resp = client.retrieve_and_generate({
856
- # session_id: "SessionId",
857
908
  # input: { # required
858
909
  # text: "RetrieveAndGenerateInputTextString", # required
859
910
  # },
860
911
  # retrieve_and_generate_configuration: {
861
- # type: "KNOWLEDGE_BASE", # required, accepts KNOWLEDGE_BASE
862
912
  # knowledge_base_configuration: {
863
913
  # knowledge_base_id: "KnowledgeBaseId", # required
864
914
  # model_arn: "BedrockModelArn", # required
@@ -869,24 +919,26 @@ module Aws::BedrockAgentRuntime
869
919
  # },
870
920
  # },
871
921
  # },
922
+ # type: "KNOWLEDGE_BASE", # required, accepts KNOWLEDGE_BASE
872
923
  # },
873
924
  # session_configuration: {
874
925
  # kms_key_arn: "KmsKeyArn", # required
875
926
  # },
927
+ # session_id: "SessionId",
876
928
  # })
877
929
  #
878
930
  # @example Response structure
879
931
  #
880
- # resp.session_id #=> String
881
- # resp.output.text #=> String
882
932
  # resp.citations #=> Array
883
- # resp.citations[0].generated_response_part.text_response_part.text #=> String
884
- # resp.citations[0].generated_response_part.text_response_part.span.start #=> Integer
885
933
  # resp.citations[0].generated_response_part.text_response_part.span.end #=> Integer
934
+ # resp.citations[0].generated_response_part.text_response_part.span.start #=> Integer
935
+ # resp.citations[0].generated_response_part.text_response_part.text #=> String
886
936
  # resp.citations[0].retrieved_references #=> Array
887
937
  # resp.citations[0].retrieved_references[0].content.text #=> String
888
- # resp.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
889
938
  # resp.citations[0].retrieved_references[0].location.s3_location.uri #=> String
939
+ # resp.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
940
+ # resp.output.text #=> String
941
+ # resp.session_id #=> String
890
942
  #
891
943
  # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate AWS API Documentation
892
944
  #
@@ -910,7 +962,7 @@ module Aws::BedrockAgentRuntime
910
962
  params: params,
911
963
  config: config)
912
964
  context[:gem_name] = 'aws-sdk-bedrockagentruntime'
913
- context[:gem_version] = '1.2.0'
965
+ context[:gem_version] = '1.3.0'
914
966
  Seahorse::Client::Request.new(handlers, context)
915
967
  end
916
968