Class: Google::Cloud::AIPlatform::V1::GenerateContentResponse

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/aiplatform/v1/prediction_service.rb

Overview

Response message for [PredictionService.GenerateContent].

Defined Under Namespace

Classes: PromptFeedback, UsageMetadata

Instance Attribute Summary collapse

Instance Attribute Details

#candidates::Array<::Google::Cloud::AIPlatform::V1::Candidate> (readonly)

Returns Output only. Generated candidates.

Returns:



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'proto_docs/google/cloud/aiplatform/v1/prediction_service.rb', line 593

class GenerateContentResponse
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Content filter results for a prompt sent in the request.
  # @!attribute [r] block_reason
  #   @return [::Google::Cloud::AIPlatform::V1::GenerateContentResponse::PromptFeedback::BlockedReason]
  #     Output only. Blocked reason.
  # @!attribute [r] safety_ratings
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::SafetyRating>]
  #     Output only. Safety ratings.
  # @!attribute [r] block_reason_message
  #   @return [::String]
  #     Output only. A readable block reason message.
  class PromptFeedback
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Blocked reason enumeration.
    module BlockedReason
      # Unspecified blocked reason.
      BLOCKED_REASON_UNSPECIFIED = 0

      # Candidates blocked due to safety.
      SAFETY = 1

      # Candidates blocked due to other reason.
      OTHER = 2

      # Candidates blocked due to the terms which are included from the
      # terminology blocklist.
      BLOCKLIST = 3

      # Candidates blocked due to prohibited content.
      PROHIBITED_CONTENT = 4

      # The user prompt was blocked by Model Armor.
      MODEL_ARMOR = 5

      # The user prompt was blocked due to jailbreak.
      JAILBREAK = 6
    end
  end

  # Usage metadata about response(s).
  # @!attribute [rw] prompt_token_count
  #   @return [::Integer]
  #     Number of tokens in the request. When `cached_content` is set, this is
  #     still the total effective prompt size meaning this includes the number of
  #     tokens in the cached content.
  # @!attribute [rw] candidates_token_count
  #   @return [::Integer]
  #     Number of tokens in the response(s).
  # @!attribute [r] thoughts_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens present in thoughts output.
  # @!attribute [rw] total_token_count
  #   @return [::Integer]
  #     Total token count for prompt and response candidates.
  # @!attribute [r] cached_content_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens in the cached part in the input (the cached
  #     content).
  # @!attribute [r] prompt_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were processed in the request input.
  # @!attribute [r] cache_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities of the cached content in the request
  #     input.
  # @!attribute [r] candidates_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were returned in the response.
  class 
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#create_time::Google::Protobuf::Timestamp (readonly)

Returns Output only. Timestamp when the request is made to the server.

Returns:



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'proto_docs/google/cloud/aiplatform/v1/prediction_service.rb', line 593

class GenerateContentResponse
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Content filter results for a prompt sent in the request.
  # @!attribute [r] block_reason
  #   @return [::Google::Cloud::AIPlatform::V1::GenerateContentResponse::PromptFeedback::BlockedReason]
  #     Output only. Blocked reason.
  # @!attribute [r] safety_ratings
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::SafetyRating>]
  #     Output only. Safety ratings.
  # @!attribute [r] block_reason_message
  #   @return [::String]
  #     Output only. A readable block reason message.
  class PromptFeedback
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Blocked reason enumeration.
    module BlockedReason
      # Unspecified blocked reason.
      BLOCKED_REASON_UNSPECIFIED = 0

      # Candidates blocked due to safety.
      SAFETY = 1

      # Candidates blocked due to other reason.
      OTHER = 2

      # Candidates blocked due to the terms which are included from the
      # terminology blocklist.
      BLOCKLIST = 3

      # Candidates blocked due to prohibited content.
      PROHIBITED_CONTENT = 4

      # The user prompt was blocked by Model Armor.
      MODEL_ARMOR = 5

      # The user prompt was blocked due to jailbreak.
      JAILBREAK = 6
    end
  end

  # Usage metadata about response(s).
  # @!attribute [rw] prompt_token_count
  #   @return [::Integer]
  #     Number of tokens in the request. When `cached_content` is set, this is
  #     still the total effective prompt size meaning this includes the number of
  #     tokens in the cached content.
  # @!attribute [rw] candidates_token_count
  #   @return [::Integer]
  #     Number of tokens in the response(s).
  # @!attribute [r] thoughts_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens present in thoughts output.
  # @!attribute [rw] total_token_count
  #   @return [::Integer]
  #     Total token count for prompt and response candidates.
  # @!attribute [r] cached_content_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens in the cached part in the input (the cached
  #     content).
  # @!attribute [r] prompt_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were processed in the request input.
  # @!attribute [r] cache_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities of the cached content in the request
  #     input.
  # @!attribute [r] candidates_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were returned in the response.
  class 
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#model_version::String (readonly)

Returns Output only. The model version used to generate the response.

Returns:

  • (::String)

    Output only. The model version used to generate the response.



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'proto_docs/google/cloud/aiplatform/v1/prediction_service.rb', line 593

class GenerateContentResponse
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Content filter results for a prompt sent in the request.
  # @!attribute [r] block_reason
  #   @return [::Google::Cloud::AIPlatform::V1::GenerateContentResponse::PromptFeedback::BlockedReason]
  #     Output only. Blocked reason.
  # @!attribute [r] safety_ratings
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::SafetyRating>]
  #     Output only. Safety ratings.
  # @!attribute [r] block_reason_message
  #   @return [::String]
  #     Output only. A readable block reason message.
  class PromptFeedback
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Blocked reason enumeration.
    module BlockedReason
      # Unspecified blocked reason.
      BLOCKED_REASON_UNSPECIFIED = 0

      # Candidates blocked due to safety.
      SAFETY = 1

      # Candidates blocked due to other reason.
      OTHER = 2

      # Candidates blocked due to the terms which are included from the
      # terminology blocklist.
      BLOCKLIST = 3

      # Candidates blocked due to prohibited content.
      PROHIBITED_CONTENT = 4

      # The user prompt was blocked by Model Armor.
      MODEL_ARMOR = 5

      # The user prompt was blocked due to jailbreak.
      JAILBREAK = 6
    end
  end

  # Usage metadata about response(s).
  # @!attribute [rw] prompt_token_count
  #   @return [::Integer]
  #     Number of tokens in the request. When `cached_content` is set, this is
  #     still the total effective prompt size meaning this includes the number of
  #     tokens in the cached content.
  # @!attribute [rw] candidates_token_count
  #   @return [::Integer]
  #     Number of tokens in the response(s).
  # @!attribute [r] thoughts_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens present in thoughts output.
  # @!attribute [rw] total_token_count
  #   @return [::Integer]
  #     Total token count for prompt and response candidates.
  # @!attribute [r] cached_content_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens in the cached part in the input (the cached
  #     content).
  # @!attribute [r] prompt_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were processed in the request input.
  # @!attribute [r] cache_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities of the cached content in the request
  #     input.
  # @!attribute [r] candidates_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were returned in the response.
  class 
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#prompt_feedback::Google::Cloud::AIPlatform::V1::GenerateContentResponse::PromptFeedback (readonly)

Returns Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.

Returns:



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'proto_docs/google/cloud/aiplatform/v1/prediction_service.rb', line 593

class GenerateContentResponse
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Content filter results for a prompt sent in the request.
  # @!attribute [r] block_reason
  #   @return [::Google::Cloud::AIPlatform::V1::GenerateContentResponse::PromptFeedback::BlockedReason]
  #     Output only. Blocked reason.
  # @!attribute [r] safety_ratings
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::SafetyRating>]
  #     Output only. Safety ratings.
  # @!attribute [r] block_reason_message
  #   @return [::String]
  #     Output only. A readable block reason message.
  class PromptFeedback
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Blocked reason enumeration.
    module BlockedReason
      # Unspecified blocked reason.
      BLOCKED_REASON_UNSPECIFIED = 0

      # Candidates blocked due to safety.
      SAFETY = 1

      # Candidates blocked due to other reason.
      OTHER = 2

      # Candidates blocked due to the terms which are included from the
      # terminology blocklist.
      BLOCKLIST = 3

      # Candidates blocked due to prohibited content.
      PROHIBITED_CONTENT = 4

      # The user prompt was blocked by Model Armor.
      MODEL_ARMOR = 5

      # The user prompt was blocked due to jailbreak.
      JAILBREAK = 6
    end
  end

  # Usage metadata about response(s).
  # @!attribute [rw] prompt_token_count
  #   @return [::Integer]
  #     Number of tokens in the request. When `cached_content` is set, this is
  #     still the total effective prompt size meaning this includes the number of
  #     tokens in the cached content.
  # @!attribute [rw] candidates_token_count
  #   @return [::Integer]
  #     Number of tokens in the response(s).
  # @!attribute [r] thoughts_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens present in thoughts output.
  # @!attribute [rw] total_token_count
  #   @return [::Integer]
  #     Total token count for prompt and response candidates.
  # @!attribute [r] cached_content_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens in the cached part in the input (the cached
  #     content).
  # @!attribute [r] prompt_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were processed in the request input.
  # @!attribute [r] cache_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities of the cached content in the request
  #     input.
  # @!attribute [r] candidates_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were returned in the response.
  class 
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#response_id::String (readonly)

Returns Output only. response_id is used to identify each response. It is the encoding of the event_id.

Returns:

  • (::String)

    Output only. response_id is used to identify each response. It is the encoding of the event_id.



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'proto_docs/google/cloud/aiplatform/v1/prediction_service.rb', line 593

class GenerateContentResponse
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Content filter results for a prompt sent in the request.
  # @!attribute [r] block_reason
  #   @return [::Google::Cloud::AIPlatform::V1::GenerateContentResponse::PromptFeedback::BlockedReason]
  #     Output only. Blocked reason.
  # @!attribute [r] safety_ratings
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::SafetyRating>]
  #     Output only. Safety ratings.
  # @!attribute [r] block_reason_message
  #   @return [::String]
  #     Output only. A readable block reason message.
  class PromptFeedback
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Blocked reason enumeration.
    module BlockedReason
      # Unspecified blocked reason.
      BLOCKED_REASON_UNSPECIFIED = 0

      # Candidates blocked due to safety.
      SAFETY = 1

      # Candidates blocked due to other reason.
      OTHER = 2

      # Candidates blocked due to the terms which are included from the
      # terminology blocklist.
      BLOCKLIST = 3

      # Candidates blocked due to prohibited content.
      PROHIBITED_CONTENT = 4

      # The user prompt was blocked by Model Armor.
      MODEL_ARMOR = 5

      # The user prompt was blocked due to jailbreak.
      JAILBREAK = 6
    end
  end

  # Usage metadata about response(s).
  # @!attribute [rw] prompt_token_count
  #   @return [::Integer]
  #     Number of tokens in the request. When `cached_content` is set, this is
  #     still the total effective prompt size meaning this includes the number of
  #     tokens in the cached content.
  # @!attribute [rw] candidates_token_count
  #   @return [::Integer]
  #     Number of tokens in the response(s).
  # @!attribute [r] thoughts_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens present in thoughts output.
  # @!attribute [rw] total_token_count
  #   @return [::Integer]
  #     Total token count for prompt and response candidates.
  # @!attribute [r] cached_content_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens in the cached part in the input (the cached
  #     content).
  # @!attribute [r] prompt_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were processed in the request input.
  # @!attribute [r] cache_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities of the cached content in the request
  #     input.
  # @!attribute [r] candidates_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were returned in the response.
  class 
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#usage_metadata::Google::Cloud::AIPlatform::V1::GenerateContentResponse::UsageMetadata

Returns Usage metadata about the response(s).

Returns:



593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'proto_docs/google/cloud/aiplatform/v1/prediction_service.rb', line 593

class GenerateContentResponse
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Content filter results for a prompt sent in the request.
  # @!attribute [r] block_reason
  #   @return [::Google::Cloud::AIPlatform::V1::GenerateContentResponse::PromptFeedback::BlockedReason]
  #     Output only. Blocked reason.
  # @!attribute [r] safety_ratings
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::SafetyRating>]
  #     Output only. Safety ratings.
  # @!attribute [r] block_reason_message
  #   @return [::String]
  #     Output only. A readable block reason message.
  class PromptFeedback
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Blocked reason enumeration.
    module BlockedReason
      # Unspecified blocked reason.
      BLOCKED_REASON_UNSPECIFIED = 0

      # Candidates blocked due to safety.
      SAFETY = 1

      # Candidates blocked due to other reason.
      OTHER = 2

      # Candidates blocked due to the terms which are included from the
      # terminology blocklist.
      BLOCKLIST = 3

      # Candidates blocked due to prohibited content.
      PROHIBITED_CONTENT = 4

      # The user prompt was blocked by Model Armor.
      MODEL_ARMOR = 5

      # The user prompt was blocked due to jailbreak.
      JAILBREAK = 6
    end
  end

  # Usage metadata about response(s).
  # @!attribute [rw] prompt_token_count
  #   @return [::Integer]
  #     Number of tokens in the request. When `cached_content` is set, this is
  #     still the total effective prompt size meaning this includes the number of
  #     tokens in the cached content.
  # @!attribute [rw] candidates_token_count
  #   @return [::Integer]
  #     Number of tokens in the response(s).
  # @!attribute [r] thoughts_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens present in thoughts output.
  # @!attribute [rw] total_token_count
  #   @return [::Integer]
  #     Total token count for prompt and response candidates.
  # @!attribute [r] cached_content_token_count
  #   @return [::Integer]
  #     Output only. Number of tokens in the cached part in the input (the cached
  #     content).
  # @!attribute [r] prompt_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were processed in the request input.
  # @!attribute [r] cache_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities of the cached content in the request
  #     input.
  # @!attribute [r] candidates_tokens_details
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::ModalityTokenCount>]
  #     Output only. List of modalities that were returned in the response.
  class 
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end