Class Candidate (1.13.0)

public final class Candidate extends GeneratedMessageV3 implements CandidateOrBuilder

A response candidate generated from the model.

Protobuf type google.cloud.vertexai.v1.Candidate

Implements

CandidateOrBuilder

Static Fields

AVG_LOGPROBS_FIELD_NUMBER

public static final int AVG_LOGPROBS_FIELD_NUMBER
Field Value
Type Description
int

CITATION_METADATA_FIELD_NUMBER

public static final int CITATION_METADATA_FIELD_NUMBER
Field Value
Type Description
int

CONTENT_FIELD_NUMBER

public static final int CONTENT_FIELD_NUMBER
Field Value
Type Description
int

FINISH_MESSAGE_FIELD_NUMBER

public static final int FINISH_MESSAGE_FIELD_NUMBER
Field Value
Type Description
int

FINISH_REASON_FIELD_NUMBER

public static final int FINISH_REASON_FIELD_NUMBER
Field Value
Type Description
int

GROUNDING_METADATA_FIELD_NUMBER

public static final int GROUNDING_METADATA_FIELD_NUMBER
Field Value
Type Description
int

INDEX_FIELD_NUMBER

public static final int INDEX_FIELD_NUMBER
Field Value
Type Description
int

SAFETY_RATINGS_FIELD_NUMBER

public static final int SAFETY_RATINGS_FIELD_NUMBER
Field Value
Type Description
int

SCORE_FIELD_NUMBER

public static final int SCORE_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Candidate getDefaultInstance()
Returns
Type Description
Candidate

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static Candidate.Builder newBuilder()
Returns
Type Description
Candidate.Builder

newBuilder(Candidate prototype)

public static Candidate.Builder newBuilder(Candidate prototype)
Parameter
Name Description
prototype Candidate
Returns
Type Description
Candidate.Builder

parseDelimitedFrom(InputStream input)

public static Candidate parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Candidate
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Candidate parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Candidate
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Candidate parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Candidate
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Candidate parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Candidate
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Candidate parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Candidate
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Candidate parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Candidate
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Candidate parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Candidate
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Candidate parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Candidate
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Candidate parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Candidate
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Candidate parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Candidate
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Candidate parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Candidate
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Candidate parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Candidate
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Candidate> parser()
Returns
Type Description
Parser<Candidate>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAvgLogprobs()

public double getAvgLogprobs()

Output only. Average log probability score of the candidate.

double avg_logprobs = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
double

The avgLogprobs.

getCitationMetadata()

public CitationMetadata getCitationMetadata()

Output only. Source attribution of the generated content.

.google.cloud.vertexai.v1.CitationMetadata citation_metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
CitationMetadata

The citationMetadata.

getCitationMetadataOrBuilder()

public CitationMetadataOrBuilder getCitationMetadataOrBuilder()

Output only. Source attribution of the generated content.

.google.cloud.vertexai.v1.CitationMetadata citation_metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
CitationMetadataOrBuilder

getContent()

public Content getContent()

Output only. Content parts of the candidate.

.google.cloud.vertexai.v1.Content content = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Content

The content.

getContentOrBuilder()

public ContentOrBuilder getContentOrBuilder()

Output only. Content parts of the candidate.

.google.cloud.vertexai.v1.Content content = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ContentOrBuilder

getDefaultInstanceForType()

public Candidate getDefaultInstanceForType()
Returns
Type Description
Candidate

getFinishMessage()

public String getFinishMessage()

Output only. Describes the reason the mode stopped generating tokens in more detail. This is only filled when finish_reason is set.

optional string finish_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The finishMessage.

getFinishMessageBytes()

public ByteString getFinishMessageBytes()

Output only. Describes the reason the mode stopped generating tokens in more detail. This is only filled when finish_reason is set.

optional string finish_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for finishMessage.

getFinishReason()

public Candidate.FinishReason getFinishReason()

Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.

.google.cloud.vertexai.v1.Candidate.FinishReason finish_reason = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Candidate.FinishReason

The finishReason.

getFinishReasonValue()

public int getFinishReasonValue()

Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.

.google.cloud.vertexai.v1.Candidate.FinishReason finish_reason = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The enum numeric value on the wire for finishReason.

getGroundingMetadata()

public GroundingMetadata getGroundingMetadata()

Output only. Metadata specifies sources used to ground generated content.

.google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GroundingMetadata

The groundingMetadata.

getGroundingMetadataOrBuilder()

public GroundingMetadataOrBuilder getGroundingMetadataOrBuilder()

Output only. Metadata specifies sources used to ground generated content.

.google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
GroundingMetadataOrBuilder

getIndex()

public int getIndex()

Output only. Index of the candidate.

int32 index = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The index.

getParserForType()

public Parser<Candidate> getParserForType()
Returns
Type Description
Parser<Candidate>
Overrides

getSafetyRatings(int index)

public SafetyRating getSafetyRatings(int index)

Output only. List of ratings for the safety of a response candidate.

There is at most one rating per category.

repeated .google.cloud.vertexai.v1.SafetyRating safety_ratings = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
SafetyRating

getSafetyRatingsCount()

public int getSafetyRatingsCount()

Output only. List of ratings for the safety of a response candidate.

There is at most one rating per category.

repeated .google.cloud.vertexai.v1.SafetyRating safety_ratings = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

getSafetyRatingsList()

public List<SafetyRating> getSafetyRatingsList()

Output only. List of ratings for the safety of a response candidate.

There is at most one rating per category.

repeated .google.cloud.vertexai.v1.SafetyRating safety_ratings = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<SafetyRating>

getSafetyRatingsOrBuilder(int index)

public SafetyRatingOrBuilder getSafetyRatingsOrBuilder(int index)

Output only. List of ratings for the safety of a response candidate.

There is at most one rating per category.

repeated .google.cloud.vertexai.v1.SafetyRating safety_ratings = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
index int
Returns
Type Description
SafetyRatingOrBuilder

getSafetyRatingsOrBuilderList()

public List<? extends SafetyRatingOrBuilder> getSafetyRatingsOrBuilderList()

Output only. List of ratings for the safety of a response candidate.

There is at most one rating per category.

repeated .google.cloud.vertexai.v1.SafetyRating safety_ratings = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
List<? extends com.google.cloud.vertexai.api.SafetyRatingOrBuilder>

getScore()

public double getScore()

Output only. Confidence score of the candidate.

double score = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
double

The score.

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

hasCitationMetadata()

public boolean hasCitationMetadata()

Output only. Source attribution of the generated content.

.google.cloud.vertexai.v1.CitationMetadata citation_metadata = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the citationMetadata field is set.

hasContent()

public boolean hasContent()

Output only. Content parts of the candidate.

.google.cloud.vertexai.v1.Content content = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the content field is set.

hasFinishMessage()

public boolean hasFinishMessage()

Output only. Describes the reason the mode stopped generating tokens in more detail. This is only filled when finish_reason is set.

optional string finish_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the finishMessage field is set.

hasGroundingMetadata()

public boolean hasGroundingMetadata()

Output only. Metadata specifies sources used to ground generated content.

.google.cloud.vertexai.v1.GroundingMetadata grounding_metadata = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the groundingMetadata field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Candidate.Builder newBuilderForType()
Returns
Type Description
Candidate.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Candidate.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Candidate.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Candidate.Builder toBuilder()
Returns
Type Description
Candidate.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException