Candidate
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
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? -
Cited works in the model’s response content, if it exists.
Declaration
Swift
public let citationMetadata: CitationMetadata? -
Initializer for SwiftUI previews or tests.
Declaration
Swift
public init(content: ModelContent, safetyRatings: [SafetyRating], finishReason: FinishReason?, citationMetadata: CitationMetadata?)
-
Initializes a response from a decoder. Used for decoding server responses; not for public use.
Declaration
Swift
public init(from decoder: Decoder) throws