FirebaseAILogic Framework Reference

ResponseStream

struct ResponseStream<Content, PartialContent> : AsyncSequence

An asynchronous sequence of snapshots of the model’s response.

  • Declaration

    Swift

    public typealias Element = Snapshot
  • A snapshot of the model’s response at a point in time.

    Declaration

    Swift

    public struct Snapshot
  • An iterator that provides snapshots of the model’s response.

    Declaration

    Swift

    public struct AsyncIterator : AsyncIteratorProtocol
  • Declaration

    Swift

    public func makeAsyncIterator() -> AsyncIterator
  • Collects the entire streamed response into a single Response.

    Throws

    A GenerationError if the model fails to generate a response.

    Declaration

    Swift

    public nonisolated(nonsending) func collect() async throws -> sending GenerativeModelSession.Response<Content>

    Return Value

    The final Response containing the fully generated content.