Class Candidate.Builder
-
- All Implemented Interfaces:
public abstract class Candidate.BuilderBuilder for Candidate.
-
-
Constructor Summary
Constructors Constructor Description Candidate.Builder()
-
Method Summary
Modifier and Type Method Description abstract Candidate.Buildercontent(Content content)Setter for content. Candidate.Buildercontent(Content.Builder contentBuilder)Setter for content builder. Candidate.BuilderclearContent()Clears the value of content field. abstract Candidate.BuildercitationMetadata(CitationMetadata citationMetadata)Setter for citationMetadata. Candidate.BuildercitationMetadata(CitationMetadata.Builder citationMetadataBuilder)Setter for citationMetadata builder. Candidate.BuilderclearCitationMetadata()Clears the value of citationMetadata field. abstract Candidate.BuilderfinishMessage(String finishMessage)Setter for finishMessage. Candidate.BuilderclearFinishMessage()Clears the value of finishMessage field. abstract Candidate.BuildertokenCount(Integer tokenCount)Setter for tokenCount. Candidate.BuilderclearTokenCount()Clears the value of tokenCount field. abstract Candidate.BuilderfinishReason(FinishReason finishReason)Setter for finishReason. Candidate.BuilderclearFinishReason()Clears the value of finishReason field. Candidate.BuilderfinishReason(FinishReason.Known knownType)Setter for finishReason given a known enum. Candidate.BuilderfinishReason(String finishReason)Setter for finishReason given a string. abstract Candidate.BuildergroundingMetadata(GroundingMetadata groundingMetadata)Setter for groundingMetadata. Candidate.BuildergroundingMetadata(GroundingMetadata.Builder groundingMetadataBuilder)Setter for groundingMetadata builder. Candidate.BuilderclearGroundingMetadata()Clears the value of groundingMetadata field. abstract Candidate.BuilderavgLogprobs(Double avgLogprobs)Setter for avgLogprobs. Candidate.BuilderclearAvgLogprobs()Clears the value of avgLogprobs field. abstract Candidate.Builderindex(Integer index)Setter for index. Candidate.BuilderclearIndex()Clears the value of index field. abstract Candidate.BuilderlogprobsResult(LogprobsResult logprobsResult)Setter for logprobsResult. Candidate.BuilderlogprobsResult(LogprobsResult.Builder logprobsResultBuilder)Setter for logprobsResult builder. Candidate.BuilderclearLogprobsResult()Clears the value of logprobsResult field. abstract Candidate.BuildersafetyRatings(List<SafetyRating> safetyRatings)Setter for safetyRatings. Candidate.BuildersafetyRatings(Array<SafetyRating> safetyRatings)Setter for safetyRatings. Candidate.BuildersafetyRatings(Array<SafetyRating.Builder> safetyRatingsBuilders)Setter for safetyRatings builder. Candidate.BuilderclearSafetyRatings()Clears the value of safetyRatings field. abstract Candidate.BuilderurlContextMetadata(UrlContextMetadata urlContextMetadata)Setter for urlContextMetadata. Candidate.BuilderurlContextMetadata(UrlContextMetadata.Builder urlContextMetadataBuilder)Setter for urlContextMetadata builder. Candidate.BuilderclearUrlContextMetadata()Clears the value of urlContextMetadata field. abstract Candidatebuild()-
-
Method Detail
-
content
abstract Candidate.Builder content(Content content)
Setter for content.
content: Contains the multi-part content of the response.
-
content
@CanIgnoreReturnValue() Candidate.Builder content(Content.Builder contentBuilder)
Setter for content builder.
content: Contains the multi-part content of the response.
-
clearContent
@CanIgnoreReturnValue() Candidate.Builder clearContent()
Clears the value of content field.
-
citationMetadata
abstract Candidate.Builder citationMetadata(CitationMetadata citationMetadata)
Setter for citationMetadata.
citationMetadata: Source attribution of the generated content.
-
citationMetadata
@CanIgnoreReturnValue() Candidate.Builder citationMetadata(CitationMetadata.Builder citationMetadataBuilder)
Setter for citationMetadata builder.
citationMetadata: Source attribution of the generated content.
-
clearCitationMetadata
@CanIgnoreReturnValue() Candidate.Builder clearCitationMetadata()
Clears the value of citationMetadata field.
-
finishMessage
abstract Candidate.Builder finishMessage(String finishMessage)
Setter for finishMessage.
finishMessage: Describes the reason the model stopped generating tokens.
-
clearFinishMessage
@CanIgnoreReturnValue() Candidate.Builder clearFinishMessage()
Clears the value of finishMessage field.
-
tokenCount
abstract Candidate.Builder tokenCount(Integer tokenCount)
Setter for tokenCount.
tokenCount: Number of tokens for this candidate.
-
clearTokenCount
@CanIgnoreReturnValue() Candidate.Builder clearTokenCount()
Clears the value of tokenCount field.
-
finishReason
abstract Candidate.Builder finishReason(FinishReason finishReason)
Setter for finishReason.
finishReason: The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
-
clearFinishReason
@CanIgnoreReturnValue() Candidate.Builder clearFinishReason()
Clears the value of finishReason field.
-
finishReason
@CanIgnoreReturnValue() Candidate.Builder finishReason(FinishReason.Known knownType)
Setter for finishReason given a known enum.
finishReason: The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
-
finishReason
@CanIgnoreReturnValue() Candidate.Builder finishReason(String finishReason)
Setter for finishReason given a string.
finishReason: The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
-
groundingMetadata
abstract Candidate.Builder groundingMetadata(GroundingMetadata groundingMetadata)
Setter for groundingMetadata.
groundingMetadata: Output only. Metadata returned when grounding is enabled. It contains the sources used to ground the generated content.
-
groundingMetadata
@CanIgnoreReturnValue() Candidate.Builder groundingMetadata(GroundingMetadata.Builder groundingMetadataBuilder)
Setter for groundingMetadata builder.
groundingMetadata: Output only. Metadata returned when grounding is enabled. It contains the sources used to ground the generated content.
-
clearGroundingMetadata
@CanIgnoreReturnValue() Candidate.Builder clearGroundingMetadata()
Clears the value of groundingMetadata field.
-
avgLogprobs
abstract Candidate.Builder avgLogprobs(Double avgLogprobs)
Setter for avgLogprobs.
avgLogprobs: Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response.
-
clearAvgLogprobs
@CanIgnoreReturnValue() Candidate.Builder clearAvgLogprobs()
Clears the value of avgLogprobs field.
-
index
abstract Candidate.Builder index(Integer index)
Setter for index.
index: Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when `candidate_count` >1.
-
clearIndex
@CanIgnoreReturnValue() Candidate.Builder clearIndex()
Clears the value of index field.
-
logprobsResult
abstract Candidate.Builder logprobsResult(LogprobsResult logprobsResult)
Setter for logprobsResult.
logprobsResult: Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential "hallucinations".
-
logprobsResult
@CanIgnoreReturnValue() Candidate.Builder logprobsResult(LogprobsResult.Builder logprobsResultBuilder)
Setter for logprobsResult builder.
logprobsResult: Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential "hallucinations".
-
clearLogprobsResult
@CanIgnoreReturnValue() Candidate.Builder clearLogprobsResult()
Clears the value of logprobsResult field.
-
safetyRatings
abstract Candidate.Builder safetyRatings(List<SafetyRating> safetyRatings)
Setter for safetyRatings.
safetyRatings: Output only. A list of ratings for the safety of a response candidate. There is at most one rating per category.
-
safetyRatings
@CanIgnoreReturnValue() Candidate.Builder safetyRatings(Array<SafetyRating> safetyRatings)
Setter for safetyRatings.
safetyRatings: Output only. A list of ratings for the safety of a response candidate. There is at most one rating per category.
-
safetyRatings
@CanIgnoreReturnValue() Candidate.Builder safetyRatings(Array<SafetyRating.Builder> safetyRatingsBuilders)
Setter for safetyRatings builder.
safetyRatings: Output only. A list of ratings for the safety of a response candidate. There is at most one rating per category.
-
clearSafetyRatings
@CanIgnoreReturnValue() Candidate.Builder clearSafetyRatings()
Clears the value of safetyRatings field.
-
urlContextMetadata
abstract Candidate.Builder urlContextMetadata(UrlContextMetadata urlContextMetadata)
Setter for urlContextMetadata.
urlContextMetadata: Output only. Metadata returned when the model uses the `url_context` tool to get information from a user-provided URL.
-
urlContextMetadata
@CanIgnoreReturnValue() Candidate.Builder urlContextMetadata(UrlContextMetadata.Builder urlContextMetadataBuilder)
Setter for urlContextMetadata builder.
urlContextMetadata: Output only. Metadata returned when the model uses the `url_context` tool to get information from a user-provided URL.
-
clearUrlContextMetadata
@CanIgnoreReturnValue() Candidate.Builder clearUrlContextMetadata()
Clears the value of urlContextMetadata field.
-
-
-
-