FirebaseVertexAI Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
Candidate
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct Candidate : Sendable
extension Candidate: Decodable
A struct representing a possible reply to a content generation prompt. Each content generation
prompt may produce multiple candidate responses.
-
-
The safety rating of the response content.
-
The reason the model stopped generating content, if it exists; for example, if the model
generated a predefined stop sequence.
-
Cited works in the model’s response content, if it exists.
-
Initializer for SwiftUI previews or tests.
-
Initializes a response from a decoder. Used for decoding server responses; not for public
use.
Declaration
Swift
public init(from decoder: Decoder) throws
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-21 UTC.
[null,null,["Last updated 2024-10-21 UTC."],[],[],null,["Candidate \n\n @available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)\n public struct Candidate : Sendable\n\n extension Candidate: Decodable\n\nA struct representing a possible reply to a content generation prompt. Each content generation\nprompt may produce multiple candidate responses.\n- `\n ``\n ``\n `\n\n [content](#/s:16FirebaseVertexAI9CandidateV7contentAA12ModelContentVvp)`\n ` \n The response's content. \n\n Declaration \n Swift \n\n public let content: ../Structs/ModelContent.html\n\n- `\n ``\n ``\n `\n\n [safetyRatings](#/s:16FirebaseVertexAI9CandidateV13safetyRatingsSayAA12SafetyRatingVGvp)`\n ` \n The safety rating of the response content. \n\n Declaration \n Swift \n\n public let safetyRatings: [../Structs/SafetyRating.html]\n\n- `\n ``\n ``\n `\n\n [finishReason](#/s:16FirebaseVertexAI9CandidateV12finishReasonAA06FinishF0VSgvp)`\n ` \n The reason the model stopped generating content, if it exists; for example, if the model\n generated a predefined stop sequence. \n\n Declaration \n Swift \n\n public let finishReason: ../Structs/FinishReason.html?\n\n- `\n ``\n ``\n `\n\n [citationMetadata](#/s:16FirebaseVertexAI9CandidateV16citationMetadataAA08CitationF0VSgvp)`\n ` \n Cited works in the model's response content, if it exists. \n\n Declaration \n Swift \n\n public let citationMetadata: ../Structs/CitationMetadata.html?\n\n- `\n ``\n ``\n `\n\n [init(content:safetyRatings:finishReason:citationMetadata:)](#/s:16FirebaseVertexAI9CandidateV7content13safetyRatings12finishReason16citationMetadataAcA12ModelContentV_SayAA12SafetyRatingVGAA06FinishI0VSgAA08CitationK0VSgtcfc)`\n ` \n Initializer for SwiftUI previews or tests. \n\n Declaration \n Swift \n\n public init(content: ../Structs/ModelContent.html, safetyRatings: [../Structs/SafetyRating.html], finishReason: ../Structs/FinishReason.html?,\n citationMetadata: ../Structs/CitationMetadata.html?)\n\n[Codable Conformances](#/Codable-Conformances)\n\n- `\n ``\n ``\n `\n\n [init(from:)](#/s:16FirebaseVertexAI9CandidateV4fromACs7Decoder_p_tKcfc)`\n ` \n Initializes a response from a decoder. Used for decoding server responses; not for public\n use. \n\n Declaration \n Swift \n\n public init(from decoder: Decoder) throws"]]