FirebaseVertexAI Framework Reference

FinishReason

@available(iOS 15.0, macOS 11.0, *)
public enum FinishReason : String
extension FinishReason: Decodable

A value enumerating possible reasons for a model to terminate a content generation request.

  • Undocumented

    Declaration

    Swift

    case unknown = "FINISH_REASON_UNKNOWN"
  • Undocumented

    Declaration

    Swift

    case unspecified = "FINISH_REASON_UNSPECIFIED"
  • Natural stop point of the model or provided stop sequence.

    Declaration

    Swift

    case stop = "STOP"
  • The maximum number of tokens as specified in the request was reached.

    Declaration

    Swift

    case maxTokens = "MAX_TOKENS"
  • The token generation was stopped because the response was flagged for safety reasons. NOTE: When streaming, the Candidate.content will be empty if content filters blocked the output.

    Declaration

    Swift

    case safety = "SAFETY"
  • The token generation was stopped because the response was flagged for unauthorized citations.

    Declaration

    Swift

    case recitation = "RECITATION"
  • All other reasons that stopped token generation.

    Declaration

    Swift

    case other = "OTHER"
  • Declaration

    Swift

    public init(from decoder: Decoder) throws