Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import Foundation

/// Response message for BidiGenerateContent RPC call.
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, *)
@available(watchOS, unavailable)
struct BidiGenerateContentServerMessage: Sendable {
/// The type of the message.
Expand Down Expand Up @@ -48,7 +48,7 @@

// MARK: - Decodable

@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, *)
@available(watchOS, unavailable)
extension BidiGenerateContentServerMessage: Decodable {
enum CodingKeys: String, CodingKey {
Expand Down Expand Up @@ -89,8 +89,8 @@
throw InvalidMessageTypeError()
}

usageMetadata = try container.decodeIfPresent(

Check failure on line 92 in FirebaseAI/Sources/Types/Internal/Live/BidiGenerateContentServerMessage.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

conformance of 'GenerateContentResponse.UsageMetadata' to 'Decodable' is only available in watchOS 8.0 or newer
GenerateContentResponse.UsageMetadata.self,

Check failure on line 93 in FirebaseAI/Sources/Types/Internal/Live/BidiGenerateContentServerMessage.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'GenerateContentResponse' is only available in watchOS 8.0 or newer
forKey: .usageMetadata
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
///
/// The client should return matching ``FunctionResponsePart``, where the `functionId` fields
/// correspond to individual ``FunctionCallPart``s.
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, *)
@available(watchOS, unavailable)
public struct LiveServerToolCall: Sendable {
let serverToolCall: BidiGenerateContentToolCall

/// A list of ``FunctionCallPart`` to run and return responses for.
public var functionCalls: [FunctionCallPart]? {
serverToolCall.functionCalls?.map { FunctionCallPart($0) }

Check failure on line 26 in FirebaseAI/Sources/Types/Public/Live/LiveServerToolCall.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'FunctionCallPart' is only available in watchOS 8.0 or newer

Check failure on line 26 in FirebaseAI/Sources/Types/Public/Live/LiveServerToolCall.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'FunctionCallPart' is only available in watchOS 8.0 or newer
}

init(_ serverToolCall: BidiGenerateContentToolCall) {
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAI/Sources/Types/Public/Live/LiveSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/// through the incremental API (such as ``sendContent(_:turnComplete:)``).
///
/// To create an instance of this class, see ``LiveGenerativeModel``.
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, *)
@available(watchOS, unavailable)
public final class LiveSession: Sendable {
private let service: LiveSessionService
Expand Down Expand Up @@ -61,7 +61,7 @@
public func sendAudioRealtime(_ audio: Data) async {
// TODO: (b/443984790) address when we add RealtimeInputConfig support
let message = BidiGenerateContentRealtimeInput(
audio: InlineData(data: audio, mimeType: "audio/pcm")

Check failure on line 64 in FirebaseAI/Sources/Types/Public/Live/LiveSession.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'InlineData' is only available in watchOS 8.0 or newer

Check failure on line 64 in FirebaseAI/Sources/Types/Public/Live/LiveSession.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'InlineData' is only available in watchOS 8.0 or newer
)
await service.send(.realtimeInput(message))
}
Expand All @@ -74,7 +74,7 @@
// TODO: (b/448671945) Make public after testing and next release
func sendVideoRealtime(_ video: Data, format: String) async {
let message = BidiGenerateContentRealtimeInput(
video: InlineData(data: video, mimeType: "video/\(format)")

Check failure on line 77 in FirebaseAI/Sources/Types/Public/Live/LiveSession.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'InlineData' is only available in watchOS 8.0 or newer

Check failure on line 77 in FirebaseAI/Sources/Types/Public/Live/LiveSession.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'InlineData' is only available in watchOS 8.0 or newer
)
await service.send(.realtimeInput(message))
}
Expand Down Expand Up @@ -122,7 +122,7 @@
/// the server will await additional messages.
public func sendContent(_ parts: any PartsRepresentable...,
turnComplete: Bool = false) async {
await sendContent([ModelContent(parts: parts)], turnComplete: turnComplete)

Check failure on line 125 in FirebaseAI/Sources/Types/Public/Live/LiveSession.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

conformance of 'Array<Element>' to 'PartsRepresentable' is only available in watchOS 8.0 or newer

Check failure on line 125 in FirebaseAI/Sources/Types/Public/Live/LiveSession.swift

View workflow job for this annotation

GitHub Actions / spm / spm (macos-15, Xcode_16.4, watchOS)

'ModelContent' is only available in watchOS 8.0 or newer
}

/// Permanently stop the conversation with the model, and close the connection to the server
Expand Down
Loading