FirebaseAI Framework Reference | Latest TMZ Celebrity News & Gossip | Watch TMZ Live

FirebaseAI Framework Reference

Chat

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public final class Chat : Sendable

An object that represents a back-and-forth chat with a model, capturing the history and saving the context in memory between each message sent.

  • The previous content from the chat that has been successfully sent and received from the model. This will be provided to the model for each message sent as context for the discussion.

    Declaration

    Swift

    public var history: [ModelContent] { get set }
  • Sends a message using the existing history of this chat as context. If successful, the message and response will be added to the history. If unsuccessful, history will remain unchanged.

    Throws

    A GenerateContentError if an error occurred.

    Declaration

    Swift

    public func sendMessage(_ parts: any PartsRepresentable...) async throws
      -> GenerateContentResponse

    Parameters

    parts

    The new content to send as a single chat message.

    Return Value

    The model’s response if no error occurred.

  • Sends a message using the existing history of this chat as context. If successful, the message and response will be added to the history. If unsuccessful, history will remain unchanged.

    Throws

    A GenerateContentError if an error occurred.

    Declaration

    Swift

    public func sendMessage(_ content: [ModelContent]) async throws
      -> GenerateContentResponse

    Parameters

    content

    The new content to send as a single chat message.

    Return Value

    The model’s response if no error occurred.

  • Sends a message using the existing history of this chat as context. If successful, the message and response will be added to the history. If unsuccessful, history will remain unchanged.

    Declaration

    Swift

    @available(macOS 12.0, *)
    public func sendMessageStream(_ parts: any PartsRepresentable...) throws
      -> AsyncThrowingStream<GenerateContentResponse, Error>

    Parameters

    parts

    The new content to send as a single chat message.

    Return Value

    A stream containing the model’s response or an error if an error occurred.

  • Sends a message using the existing history of this chat as context. If successful, the message and response will be added to the history. If unsuccessful, history will remain unchanged.

    Declaration

    Swift

    @available(macOS 12.0, *)
    public func sendMessageStream(_ content: [ModelContent]) throws
      -> AsyncThrowingStream<GenerateContentResponse, Error>

    Parameters

    content

    The new content to send as a single chat message.

    Return Value

    A stream containing the model’s response or an error if an error occurred.

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.