Candidate
public struct Candidate : Sendableextension Candidate: DecodableA struct representing a possible reply to a content generation prompt. Each content generation prompt may produce multiple candidate responses.
-
The response's content.
Declaration
Swift
public let content: ModelContent -
The safety rating of the response content.
Declaration
Swift
public let safetyRatings: [SafetyRating] -
The reason the model stopped generating content, if it exists; for example, if the model generated a predefined stop sequence.
Declaration
Swift
public let finishReason: FinishReason? -
A human-readable description of why the model stopped generating content, if it exists.
Declaration
Swift
public let finishMessage: String? -
Cited works in the model's response content, if it exists.
Declaration
Swift
public let citationMetadata: CitationMetadata? -
Undocumented
Declaration
Swift
public let groundingMetadata: GroundingMetadata? -
Metadata related to the
Tool/urlContext()tool.Declaration
Swift
public let urlContextMetadata: URLContextMetadata? -
init(content:safetyRatings:finishReason:citationMetadata:groundingMetadata:urlContextMetadata:finishMessage:)
Initializer for SwiftUI previews or tests.
Declaration
Swift
public init(content: ModelContent, safetyRatings: [SafetyRating], finishReason: FinishReason?, citationMetadata: CitationMetadata?, groundingMetadata: GroundingMetadata? = nil, urlContextMetadata: URLContextMetadata? = nil, finishMessage: String? = nil)
-
Initializes a response from a decoder. Used for decoding server responses; not for public use.
Declaration
Swift
public init(from decoder: Decoder) throws