From a9ff298eef3a1682dd6a0bac5c14708121f7038e Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Tue, 8 Sep 2026 13:45:06 -0700 Subject: [PATCH 1/7] Deprecate Gemini 3.x tuning parameters --- FirebaseAI/AGENTS.md | 2 +- FirebaseAI/CHANGELOG.md | 5 +++ FirebaseAI/Sources/GenerationConfig.swift | 27 ++++++++++++++++ .../Types/Public/GenerationOptions.swift | 23 ++++++++++++++ .../Public/Live/LiveGenerationConfig.swift | 31 +++++++++++++++++++ 5 files changed, 87 insertions(+), 1 deletion(-) diff --git a/FirebaseAI/AGENTS.md b/FirebaseAI/AGENTS.md index c60433e897a..c99ae42c64d 100644 --- a/FirebaseAI/AGENTS.md +++ b/FirebaseAI/AGENTS.md @@ -20,7 +20,7 @@ This directory contains the main source code for the FirebaseAI library. - **`GenerateContentError.swift`**: Defines the public `GenerateContentError` enum, representing errors that can occur when generating content. - **`GenerateContentRequest.swift`**: Defines the `GenerateContentRequest` struct, representing a request to generate content from the model. - **`GenerateContentResponse.swift`**: Represents the model's response to a generate content request, including usage metadata, candidates, and prompt feedback. -- **`GenerationConfig.swift`**: Defines the `GenerationConfig` struct for configuring model parameters (e.g., temperature, topP). +- **`GenerationConfig.swift`**: Defines the `GenerationConfig` struct for configuring model parameters (e.g., maxOutputTokens). - **`GenerativeAIRequest.swift`**: Defines the `GenerativeAIRequest` protocol for requests sent to the generative AI backend. - **`GenerativeAIService.swift`**: Responsible for making requests to the generative AI backend, handling authentication, URL construction, and response parsing. - **`GenerativeModel.swift`**: Defines the `GenerativeModel` class, representing a remote multimodal model. It provides methods for generating content and starting chats. diff --git a/FirebaseAI/CHANGELOG.md b/FirebaseAI/CHANGELOG.md index 1da1c0451b5..539dcb51250 100644 --- a/FirebaseAI/CHANGELOG.md +++ b/FirebaseAI/CHANGELOG.md @@ -1,3 +1,8 @@ +# Unreleased +- [changed] Deprecated model tuning parameters (`temperature`, `topP`, `topK`, `candidateCount`, + `presencePenalty`, and `frequencyPenalty`) in `GenerationConfig` and `LiveGenerationConfig` as + they are no longer recommended for Gemini 3.x models. + # 12.19.0 - [feature] **Public Preview**: Added `GeminiLanguageModel`, allowing Gemini models to be used with Apple's Foundation Models framework. See the diff --git a/FirebaseAI/Sources/GenerationConfig.swift b/FirebaseAI/Sources/GenerationConfig.swift index 299cd8fd4d8..ec5d82a0c05 100644 --- a/FirebaseAI/Sources/GenerationConfig.swift +++ b/FirebaseAI/Sources/GenerationConfig.swift @@ -174,6 +174,11 @@ public struct GenerationConfig: Sendable, Equatable { /// > that it is not subject to any SLA or deprecation policy and could change in /// > backwards-incompatible ways. /// - imageConfig: Configuration options for generating images. + @available( + *, + deprecated, + message: "temperature, topP, topK, candidateCount, presencePenalty, and frequencyPenalty are no longer recommended for Gemini 3.x models." + ) public init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil, candidateCount: Int? = nil, maxOutputTokens: Int? = nil, presencePenalty: Float? = nil, frequencyPenalty: Float? = nil, @@ -200,6 +205,28 @@ public struct GenerationConfig: Sendable, Equatable { self.speechConfig = speechConfig?.speechConfig } + public init(maxOutputTokens: Int? = nil, + stopSequences: [String]? = nil, responseMIMEType: String? = nil, + responseSchema: Schema? = nil, responseModalities: [ResponseModality]? = nil, + thinkingConfig: ThinkingConfig? = nil, imageConfig: ImageConfig? = nil, + speechConfig: SpeechConfig? = nil) { + temperature = nil + topP = nil + topK = nil + candidateCount = nil + self.maxOutputTokens = maxOutputTokens + presencePenalty = nil + frequencyPenalty = nil + self.stopSequences = stopSequences + self.responseMIMEType = responseMIMEType + self.responseSchema = responseSchema + responseJSONSchema = nil + self.responseModalities = responseModalities + self.thinkingConfig = thinkingConfig + self.imageConfig = imageConfig + self.speechConfig = speechConfig?.speechConfig + } + init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil, candidateCount: Int? = nil, maxOutputTokens: Int? = nil, presencePenalty: Float? = nil, frequencyPenalty: Float? = nil, stopSequences: [String]? = nil, responseMIMEType: String, responseJSONSchema: JSONObject, diff --git a/FirebaseAI/Sources/Types/Public/GenerationOptions.swift b/FirebaseAI/Sources/Types/Public/GenerationOptions.swift index 9b5fb70556c..8ced47ea697 100644 --- a/FirebaseAI/Sources/Types/Public/GenerationOptions.swift +++ b/FirebaseAI/Sources/Types/Public/GenerationOptions.swift @@ -128,9 +128,19 @@ } /// A sampling strategy for how the model picks tokens when generating a response. + @available( + *, + deprecated, + message: "Manually setting sampling mode is no longer recommended for Gemini 3.x models." + ) public var sampling: GenerationOptions.SamplingMode? /// Temperature influences the confidence of the model's response. + @available( + *, + deprecated, + message: "Manually setting temperature is no longer recommended for Gemini 3.x models." + ) public var temperature: Double? /// The maximum number of tokens the model is allowed to produce in its response. @@ -140,6 +150,11 @@ private var _generationOptions: (any GenerationOptionsProtocol)? /// Creates generation options that control token sampling behavior. + @available( + *, + deprecated, + message: "Manually setting sampling mode and temperature is no longer recommended for Gemini 3.x models." + ) public init(sampling: GenerationOptions.SamplingMode? = nil, temperature: Double? = nil, maximumResponseTokens: Int? = nil) { self.sampling = sampling @@ -148,6 +163,14 @@ _generationOptions = nil } + /// Creates generation options that control token sampling behavior. + public init(maximumResponseTokens: Int? = nil) { + sampling = nil + temperature = nil + self.maximumResponseTokens = maximumResponseTokens + _generationOptions = nil + } + #if canImport(FoundationModels) /// Initializes a ``FirebaseAI/GenerationOptions`` from a /// `FoundationModels.GenerationOptions`. diff --git a/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift b/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift index 83d73e0e50c..7a60254acd2 100644 --- a/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift +++ b/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift @@ -126,6 +126,11 @@ public struct LiveGenerationConfig: Sendable { /// This mechanism prevents the context from exceeding a given length. /// - realtimeInputConfig: Configures model input behavior when generating content via the /// realtime supported methods + @available( + *, + deprecated, + message: "temperature, topP, topK, candidateCount, presencePenalty, and frequencyPenalty are no longer recommended for Gemini 3.x models." + ) public init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil, candidateCount: Int? = nil, maxOutputTokens: Int? = nil, presencePenalty: Float? = nil, frequencyPenalty: Float? = nil, @@ -154,6 +159,32 @@ public struct LiveGenerationConfig: Sendable { ) } + public init(maxOutputTokens: Int? = nil, + responseModalities: [ResponseModality]? = nil, + speech: SpeechConfig? = nil, + inputAudioTranscription: AudioTranscriptionConfig? = nil, + outputAudioTranscription: AudioTranscriptionConfig? = nil, + contextWindowCompression: ContextWindowCompressionConfig? = nil, + realtimeInputConfig: RealtimeInputConfig? = nil) { + self.init( + BidiGenerationConfig( + temperature: nil, + topP: nil, + topK: nil, + candidateCount: nil, + maxOutputTokens: maxOutputTokens, + presencePenalty: nil, + frequencyPenalty: nil, + responseModalities: responseModalities, + speechConfig: speech?.speechConfig + ), + inputAudioTranscription: inputAudioTranscription?.audioTranscriptionConfig, + outputAudioTranscription: outputAudioTranscription?.audioTranscriptionConfig, + contextWindowCompression: contextWindowCompression?.bidiContextWindowCompressionConfig, + realtimeInputConfig: realtimeInputConfig?.bidiRealtimeInputConfig + ) + } + init(_ bidiGenerationConfig: BidiGenerationConfig, inputAudioTranscription: BidiAudioTranscriptionConfig? = nil, outputAudioTranscription: BidiAudioTranscriptionConfig? = nil, From 162665b28d4de822bc058abd5f005cdf2cbd523f Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Tue, 8 Sep 2026 14:07:58 -0700 Subject: [PATCH 2/7] Add documentation to new initializers --- FirebaseAI/Sources/GenerationConfig.swift | 18 +++++++++++++++++ .../Public/Live/LiveGenerationConfig.swift | 20 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/FirebaseAI/Sources/GenerationConfig.swift b/FirebaseAI/Sources/GenerationConfig.swift index ec5d82a0c05..7ef75711848 100644 --- a/FirebaseAI/Sources/GenerationConfig.swift +++ b/FirebaseAI/Sources/GenerationConfig.swift @@ -205,6 +205,24 @@ public struct GenerationConfig: Sendable, Equatable { self.speechConfig = speechConfig?.speechConfig } + /// Creates a new `GenerationConfig` value without deprecated tuning parameters. + /// + /// See the + /// [Configure model parameters](https://firebase.google.com/docs/vertex-ai/model-parameters) + /// guide and the + /// [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) + /// for more details. + /// + /// - Parameters: + /// - maxOutputTokens: Maximum number of tokens that can be generated in the response. + /// - stopSequences: A set of up to 5 `String`s that will stop output generation. + /// - responseMIMEType: Output response MIME type of the generated candidate text. + /// - responseSchema: Output schema of the generated candidate text. + /// - responseModalities: The data types (modalities) that may be returned in model responses. + /// - thinkingConfig: Configuration for controlling the "thinking" behavior of compatible Gemini + /// models. + /// - imageConfig: Configuration options for generating images. + /// - speechConfig: Configuration for controlling the voice of the model during conversation. public init(maxOutputTokens: Int? = nil, stopSequences: [String]? = nil, responseMIMEType: String? = nil, responseSchema: Schema? = nil, responseModalities: [ResponseModality]? = nil, diff --git a/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift b/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift index 7a60254acd2..769edda6e49 100644 --- a/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift +++ b/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift @@ -159,6 +159,26 @@ public struct LiveGenerationConfig: Sendable { ) } + /// Creates a new `LiveGenerationConfig` value without deprecated tuning parameters. + /// + /// See the + /// [Configure model parameters](https://firebase.google.com/docs/vertex-ai/model-parameters) + /// guide and the + /// [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) + /// for more details. + /// + /// - Parameters: + /// - maxOutputTokens: Maximum number of tokens that can be generated in the response. + /// - responseModalities: The data types (modalities) that may be returned in model responses. + /// - speech: Controls the voice of the model, when streaming `audio` via `ResponseModality`. + /// - inputAudioTranscription: Configures (and enables) input transcriptions when streaming to + /// the model. + /// - outputAudioTranscription: Configures (and enables) output transcriptions when streaming to + /// the model. + /// - contextWindowCompression: Enables context window compression to manage the model's context + /// window. + /// - realtimeInputConfig: Configures model input behavior when generating content via the + /// realtime supported methods. public init(maxOutputTokens: Int? = nil, responseModalities: [ResponseModality]? = nil, speech: SpeechConfig? = nil, From 3ace8c0e9a437720fb18a9b3f94d9d289c04243b Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Tue, 8 Sep 2026 15:14:12 -0700 Subject: [PATCH 3/7] Fix self-deprecation warnings in GenerationOptions by introducing internal storage --- .../Types/Public/GenerationOptions.swift | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/FirebaseAI/Sources/Types/Public/GenerationOptions.swift b/FirebaseAI/Sources/Types/Public/GenerationOptions.swift index 8ced47ea697..df341139254 100644 --- a/FirebaseAI/Sources/Types/Public/GenerationOptions.swift +++ b/FirebaseAI/Sources/Types/Public/GenerationOptions.swift @@ -127,13 +127,19 @@ } } + var _sampling: GenerationOptions.SamplingMode? + var _temperature: Double? + /// A sampling strategy for how the model picks tokens when generating a response. @available( *, deprecated, message: "Manually setting sampling mode is no longer recommended for Gemini 3.x models." ) - public var sampling: GenerationOptions.SamplingMode? + public var sampling: GenerationOptions.SamplingMode? { + get { _sampling } + set { _sampling = newValue } + } /// Temperature influences the confidence of the model's response. @available( @@ -141,7 +147,10 @@ deprecated, message: "Manually setting temperature is no longer recommended for Gemini 3.x models." ) - public var temperature: Double? + public var temperature: Double? { + get { _temperature } + set { _temperature = newValue } + } /// The maximum number of tokens the model is allowed to produce in its response. public var maximumResponseTokens: Int? @@ -157,16 +166,16 @@ ) public init(sampling: GenerationOptions.SamplingMode? = nil, temperature: Double? = nil, maximumResponseTokens: Int? = nil) { - self.sampling = sampling - self.temperature = temperature + _sampling = sampling + _temperature = temperature self.maximumResponseTokens = maximumResponseTokens _generationOptions = nil } /// Creates generation options that control token sampling behavior. public init(maximumResponseTokens: Int? = nil) { - sampling = nil - temperature = nil + _sampling = nil + _temperature = nil self.maximumResponseTokens = maximumResponseTokens _generationOptions = nil } @@ -183,15 +192,15 @@ _generationOptions = options // TODO: Remove `else` when Xcode 27 is the min. supported Xcode. #if compiler(>=6.4) - sampling = options.samplingMode.map { + _sampling = options.samplingMode.map { SamplingMode(kind: .foundationModelsSamplingMode($0)) } #else - sampling = options.sampling.map { + _sampling = options.sampling.map { SamplingMode(kind: .foundationModelsSamplingMode($0)) } #endif // compiler(>=6.4) - temperature = options.temperature + _temperature = options.temperature maximumResponseTokens = options.maximumResponseTokens } @@ -206,14 +215,14 @@ // TODO: Remove `else` when Xcode 27 is the min. supported Xcode. #if compiler(>=6.4) return FoundationModels.GenerationOptions( - samplingMode: sampling?.samplingMode, - temperature: temperature, + samplingMode: _sampling?.samplingMode, + temperature: _temperature, maximumResponseTokens: maximumResponseTokens ) #else return FoundationModels.GenerationOptions( - sampling: sampling?.samplingMode, - temperature: temperature, + sampling: _sampling?.samplingMode, + temperature: _temperature, maximumResponseTokens: maximumResponseTokens ) #endif // compiler(>=6.4) @@ -230,8 +239,8 @@ } #endif // canImport(FoundationModels) && IS_FOUNDATION_MODELS_SUPPORTED_PLATFORM - return lhs.sampling == rhs.sampling && - lhs.temperature == rhs.temperature && + return lhs._sampling == rhs._sampling && + lhs._temperature == rhs._temperature && lhs.maximumResponseTokens == rhs.maximumResponseTokens } } From d0ace460ea11bcbdb779e77eb25c845a77b3c22b Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Tue, 8 Sep 2026 17:02:21 -0700 Subject: [PATCH 4/7] Mark tests using deprecated APIs with @available(*, deprecated) to fix pod lib lint warnings --- FirebaseAI/Tests/Unit/GenerationConfigTests.swift | 1 + FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift | 1 + FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift | 1 + FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift | 1 + FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift | 1 + 5 files changed, 5 insertions(+) diff --git a/FirebaseAI/Tests/Unit/GenerationConfigTests.swift b/FirebaseAI/Tests/Unit/GenerationConfigTests.swift index 7dd63534b5d..2224795fc83 100644 --- a/FirebaseAI/Tests/Unit/GenerationConfigTests.swift +++ b/FirebaseAI/Tests/Unit/GenerationConfigTests.swift @@ -16,6 +16,7 @@ import Foundation import XCTest +@available(*, deprecated) final class GenerationConfigTests: XCTestCase { let encoder = JSONEncoder() diff --git a/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift b/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift index 9ddee50812a..4a56b44e9ff 100644 --- a/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift +++ b/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift @@ -320,6 +320,7 @@ XCTAssertEqual(functionResponse.response, ["result": .string(CurrentTimeTool.currentTime)]) } + @available(*, deprecated) func testRespondTo_withOptions() async throws { let config = GenerationConfig(temperature: 0.5, responseMIMEType: "application/json") let bundle = BundleTestUtil.bundle() diff --git a/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift b/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift index 35ebf020399..8c5353b29fb 100644 --- a/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift +++ b/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift @@ -1839,6 +1839,7 @@ final class GenerativeModelVertexAITests: XCTestCase { XCTAssertEqual(response.promptTokensDetails[1].tokenCount, 31) } + @available(*, deprecated) func testCountTokens_succeeds_allOptions() async throws { MockURLProtocol.requestHandler = try GenerativeModelTestUtil.httpRequestHandler( forResource: "unary-success-total-tokens", diff --git a/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift b/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift index 204846bed4f..aa90820ae06 100644 --- a/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift +++ b/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift @@ -17,6 +17,7 @@ @testable import FirebaseAILogic + @available(*, deprecated) final class ResponseGenerationOptionsTests: XCTestCase { func testGenerationConfigConversion() { let config = GenerationConfig(temperature: 0.5, topK: 40) diff --git a/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift b/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift index f497562395e..277cfe98723 100644 --- a/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift +++ b/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift @@ -20,6 +20,7 @@ import FoundationModels #endif + @available(*, deprecated) final class GenerationOptionsTests: XCTestCase { #if canImport(FoundationModels) @available(iOS 26.0, macOS 26.0, visionOS 26.0, *) From ad87588d537ead227d465967b89ac254b4b3b41d Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Thu, 10 Sep 2026 09:23:39 -0700 Subject: [PATCH 5/7] Sync with JS PR and address review comments --- FirebaseAI/CHANGELOG.md | 2 +- FirebaseAI/Sources/GenerationConfig.swift | 102 +++++++----------- .../Types/Public/GenerationOptions.swift | 58 +++------- .../Public/Live/LiveGenerationConfig.swift | 99 ++++++----------- .../Tests/Unit/GenerationConfigTests.swift | 56 +--------- .../Unit/GenerativeModelVertexAITests.swift | 5 - .../Unit/ResponseGenerationOptionsTests.swift | 5 +- .../Tests/Unit/Snippets/LiveSnippets.swift | 3 - .../Unit/Types/GenerationOptionsTests.swift | 1 - 9 files changed, 90 insertions(+), 241 deletions(-) diff --git a/FirebaseAI/CHANGELOG.md b/FirebaseAI/CHANGELOG.md index 539dcb51250..ccc1dd6ceea 100644 --- a/FirebaseAI/CHANGELOG.md +++ b/FirebaseAI/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased - [changed] Deprecated model tuning parameters (`temperature`, `topP`, `topK`, `candidateCount`, `presencePenalty`, and `frequencyPenalty`) in `GenerationConfig` and `LiveGenerationConfig` as - they are no longer recommended for Gemini 3.x models. + they are unsupported in Gemini 3.x and later models. # 12.19.0 - [feature] **Public Preview**: Added `GeminiLanguageModel`, allowing Gemini diff --git a/FirebaseAI/Sources/GenerationConfig.swift b/FirebaseAI/Sources/GenerationConfig.swift index 7ef75711848..e7aca54004a 100644 --- a/FirebaseAI/Sources/GenerationConfig.swift +++ b/FirebaseAI/Sources/GenerationConfig.swift @@ -73,67 +73,9 @@ public struct GenerationConfig: Sendable, Equatable { /// for more details. /// /// - Parameters: - /// - temperature:Controls the randomness of the language model's output. Higher values (for - /// example, 1.0) make the text more random and creative, while lower values (for example, - /// 0.1) make it more focused and deterministic. - /// - /// > Note: A temperature of 0 means that the highest probability tokens are always selected. - /// > In this case, responses for a given prompt are mostly deterministic, but a small amount - /// > of variation is still possible. - /// - /// > Important: The range of supported temperature values depends on the model; see the - /// > [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#temperature) - /// > for more details. - /// - topP: Controls diversity of generated text. Higher values (e.g., 0.9) produce more diverse - /// text, while lower values (e.g., 0.5) make the output more focused. - /// - /// The supported range is 0.0 to 1.0. - /// - /// > Important: The default `topP` value depends on the model; see the - /// > [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#top-p) - /// > for more details. - /// - topK: Limits the number of highest probability words the model considers when generating - /// text. For example, a topK of 40 means only the 40 most likely words are considered for the - /// next token. A higher value increases diversity, while a lower value makes the output more - /// deterministic. - /// - /// The supported range is 1 to 40. - /// - /// > Important: Support for `topK` and the default value depends on the model; see the - /// [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#top-k) - /// for more details. - /// - candidateCount: The number of response variations to return; defaults to 1 if not set. - /// Support for multiple candidates depends on the model; see the - /// [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) - /// for more details. /// - maxOutputTokens: Maximum number of tokens that can be generated in the response. /// See the configure model parameters [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#max-output-tokens) /// for more details. - /// - presencePenalty: Controls the likelihood of repeating the same words or phrases already - /// generated in the text. Higher values increase the penalty of repetition, resulting in more - /// diverse output. - /// - /// > Note: While both `presencePenalty` and `frequencyPenalty` discourage repetition, - /// > `presencePenalty` applies the same penalty regardless of how many times the word/phrase - /// > has already appeared, whereas `frequencyPenalty` increases the penalty for *each* - /// > repetition of a word/phrase. - /// - /// > Important: The range of supported `presencePenalty` values depends on the model; see the - /// > [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) - /// > for more details - /// - frequencyPenalty: Controls the likelihood of repeating words or phrases, with the penalty - /// increasing for each repetition. Higher values increase the penalty of repetition, - /// resulting in more diverse output. - /// - /// > Note: While both `frequencyPenalty` and `presencePenalty` discourage repetition, - /// > `frequencyPenalty` increases the penalty for *each* repetition of a word/phrase, whereas - /// > `presencePenalty` applies the same penalty regardless of how many times the word/phrase - /// > has already appeared. - /// - /// > Important: The range of supported `frequencyPenalty` values depends on the model; see - /// > the - /// > [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) - /// > for more details /// - stopSequences: A set of up to 5 `String`s that will stop output generation. If specified, /// the API will stop at the first appearance of a stop sequence. The stop sequence will not /// be included as part of the response. See the @@ -177,7 +119,7 @@ public struct GenerationConfig: Sendable, Equatable { @available( *, deprecated, - message: "temperature, topP, topK, candidateCount, presencePenalty, and frequencyPenalty are no longer recommended for Gemini 3.x models." + message: "candidateCount, temperature, topP, topK, presencePenalty, and frequencyPenalty are unsupported in Gemini 3.x and later models." ) public init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil, candidateCount: Int? = nil, maxOutputTokens: Int? = nil, @@ -215,14 +157,48 @@ public struct GenerationConfig: Sendable, Equatable { /// /// - Parameters: /// - maxOutputTokens: Maximum number of tokens that can be generated in the response. - /// - stopSequences: A set of up to 5 `String`s that will stop output generation. + /// See the configure model parameters [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#max-output-tokens) + /// for more details. + /// - stopSequences: A set of up to 5 `String`s that will stop output generation. If specified, + /// the API will stop at the first appearance of a stop sequence. The stop sequence will not + /// be included as part of the response. See the + /// [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) + /// for more details. /// - responseMIMEType: Output response MIME type of the generated candidate text. - /// - responseSchema: Output schema of the generated candidate text. + /// + /// Supported MIME types: + /// - `text/plain`: Text output; the default behavior if unspecified. + /// - `application/json`: JSON response in the candidates. + /// - `text/x.enum`: For classification tasks, output an enum value as defined in the + /// `responseSchema`. + /// - responseSchema: Output schema of the generated candidate text. If set, a compatible + /// `responseMIMEType` must also be set. + /// + /// Compatible MIME types: + /// - `application/json`: Schema for JSON response. + /// + /// Refer to the + /// [Generate structured + /// output](https://firebase.google.com/docs/vertex-ai/structured-output?platform=ios) guide + /// for more details. /// - responseModalities: The data types (modalities) that may be returned in model responses. + /// + /// See the [multimodal + /// responses](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal-response-generation) + /// documentation for more details. + /// + /// > Warning: Specifying response modalities is a **Public Preview** feature, which means + /// > that it is not subject to any SLA or deprecation policy and could change in + /// > backwards-incompatible ways. /// - thinkingConfig: Configuration for controlling the "thinking" behavior of compatible Gemini - /// models. + /// models; see ``ThinkingConfig`` for more details. + /// - speechConfig: Configuration for controlling the voice of the model during conversation; + /// see ``SpeechConfig`` for more details. + /// + /// > Warning: Specifying a speech configuration is a **Public Preview** feature, which means + /// > that it is not subject to any SLA or deprecation policy and could change in + /// > backwards-incompatible ways. /// - imageConfig: Configuration options for generating images. - /// - speechConfig: Configuration for controlling the voice of the model during conversation. public init(maxOutputTokens: Int? = nil, stopSequences: [String]? = nil, responseMIMEType: String? = nil, responseSchema: Schema? = nil, responseModalities: [ResponseModality]? = nil, diff --git a/FirebaseAI/Sources/Types/Public/GenerationOptions.swift b/FirebaseAI/Sources/Types/Public/GenerationOptions.swift index df341139254..9b5fb70556c 100644 --- a/FirebaseAI/Sources/Types/Public/GenerationOptions.swift +++ b/FirebaseAI/Sources/Types/Public/GenerationOptions.swift @@ -127,30 +127,11 @@ } } - var _sampling: GenerationOptions.SamplingMode? - var _temperature: Double? - /// A sampling strategy for how the model picks tokens when generating a response. - @available( - *, - deprecated, - message: "Manually setting sampling mode is no longer recommended for Gemini 3.x models." - ) - public var sampling: GenerationOptions.SamplingMode? { - get { _sampling } - set { _sampling = newValue } - } + public var sampling: GenerationOptions.SamplingMode? /// Temperature influences the confidence of the model's response. - @available( - *, - deprecated, - message: "Manually setting temperature is no longer recommended for Gemini 3.x models." - ) - public var temperature: Double? { - get { _temperature } - set { _temperature = newValue } - } + public var temperature: Double? /// The maximum number of tokens the model is allowed to produce in its response. public var maximumResponseTokens: Int? @@ -159,23 +140,10 @@ private var _generationOptions: (any GenerationOptionsProtocol)? /// Creates generation options that control token sampling behavior. - @available( - *, - deprecated, - message: "Manually setting sampling mode and temperature is no longer recommended for Gemini 3.x models." - ) public init(sampling: GenerationOptions.SamplingMode? = nil, temperature: Double? = nil, maximumResponseTokens: Int? = nil) { - _sampling = sampling - _temperature = temperature - self.maximumResponseTokens = maximumResponseTokens - _generationOptions = nil - } - - /// Creates generation options that control token sampling behavior. - public init(maximumResponseTokens: Int? = nil) { - _sampling = nil - _temperature = nil + self.sampling = sampling + self.temperature = temperature self.maximumResponseTokens = maximumResponseTokens _generationOptions = nil } @@ -192,15 +160,15 @@ _generationOptions = options // TODO: Remove `else` when Xcode 27 is the min. supported Xcode. #if compiler(>=6.4) - _sampling = options.samplingMode.map { + sampling = options.samplingMode.map { SamplingMode(kind: .foundationModelsSamplingMode($0)) } #else - _sampling = options.sampling.map { + sampling = options.sampling.map { SamplingMode(kind: .foundationModelsSamplingMode($0)) } #endif // compiler(>=6.4) - _temperature = options.temperature + temperature = options.temperature maximumResponseTokens = options.maximumResponseTokens } @@ -215,14 +183,14 @@ // TODO: Remove `else` when Xcode 27 is the min. supported Xcode. #if compiler(>=6.4) return FoundationModels.GenerationOptions( - samplingMode: _sampling?.samplingMode, - temperature: _temperature, + samplingMode: sampling?.samplingMode, + temperature: temperature, maximumResponseTokens: maximumResponseTokens ) #else return FoundationModels.GenerationOptions( - sampling: _sampling?.samplingMode, - temperature: _temperature, + sampling: sampling?.samplingMode, + temperature: temperature, maximumResponseTokens: maximumResponseTokens ) #endif // compiler(>=6.4) @@ -239,8 +207,8 @@ } #endif // canImport(FoundationModels) && IS_FOUNDATION_MODELS_SUPPORTED_PLATFORM - return lhs._sampling == rhs._sampling && - lhs._temperature == rhs._temperature && + return lhs.sampling == rhs.sampling && + lhs.temperature == rhs.temperature && lhs.maximumResponseTokens == rhs.maximumResponseTokens } } diff --git a/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift b/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift index 769edda6e49..7d701537e44 100644 --- a/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift +++ b/FirebaseAI/Sources/Types/Public/Live/LiveGenerationConfig.swift @@ -32,67 +32,9 @@ public struct LiveGenerationConfig: Sendable { /// for more details. /// /// - Parameters: - /// - temperature:Controls the randomness of the language model's output. Higher values (for - /// example, 1.0) make the text more random and creative, while lower values (for example, - /// 0.1) make it more focused and deterministic. - /// - /// > Note: A temperature of 0 means that the highest probability tokens are always selected. - /// > In this case, responses for a given prompt are mostly deterministic, but a small amount - /// > of variation is still possible. - /// - /// > Important: The range of supported temperature values depends on the model; see the - /// > [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#temperature) - /// > for more details. - /// - topP: Controls diversity of generated text. Higher values (e.g., 0.9) produce more diverse - /// text, while lower values (e.g., 0.5) make the output more focused. - /// - /// The supported range is 0.0 to 1.0. - /// - /// > Important: The default `topP` value depends on the model; see the - /// > [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#top-p) - /// > for more details. - /// - topK: Limits the number of highest probability words the model considers when generating - /// text. For example, a topK of 40 means only the 40 most likely words are considered for the - /// next token. A higher value increases diversity, while a lower value makes the output more - /// deterministic. - /// - /// The supported range is 1 to 40. - /// - /// > Important: Support for `topK` and the default value depends on the model; see the - /// [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#top-k) - /// for more details. - /// - candidateCount: The number of response variations to return; defaults to 1 if not set. - /// Support for multiple candidates depends on the model; see the - /// [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) - /// for more details. /// - maxOutputTokens: Maximum number of tokens that can be generated in the response. /// See the configure model parameters [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#max-output-tokens) /// for more details. - /// - presencePenalty: Controls the likelihood of repeating the same words or phrases already - /// generated in the text. Higher values increase the penalty of repetition, resulting in more - /// diverse output. - /// - /// > Note: While both `presencePenalty` and `frequencyPenalty` discourage repetition, - /// > `presencePenalty` applies the same penalty regardless of how many times the word/phrase - /// > has already appeared, whereas `frequencyPenalty` increases the penalty for *each* - /// > repetition of a word/phrase. - /// - /// > Important: The range of supported `presencePenalty` values depends on the model; see the - /// > [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) - /// > for more details - /// - frequencyPenalty: Controls the likelihood of repeating words or phrases, with the penalty - /// increasing for each repetition. Higher values increase the penalty of repetition, - /// resulting in more diverse output. - /// - /// > Note: While both `frequencyPenalty` and `presencePenalty` discourage repetition, - /// > `frequencyPenalty` increases the penalty for *each* repetition of a word/phrase, whereas - /// > `presencePenalty` applies the same penalty regardless of how many times the word/phrase - /// > has already appeared. - /// - /// > Important: The range of supported `frequencyPenalty` values depends on the model; see - /// > the - /// > [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#generationconfig) - /// > for more details /// - responseModalities: The data types (modalities) that may be returned in model responses. /// /// See the [multimodal @@ -129,7 +71,7 @@ public struct LiveGenerationConfig: Sendable { @available( *, deprecated, - message: "temperature, topP, topK, candidateCount, presencePenalty, and frequencyPenalty are no longer recommended for Gemini 3.x models." + message: "candidateCount, temperature, topP, topK, presencePenalty, and frequencyPenalty are unsupported in Gemini 3.x and later models." ) public init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil, candidateCount: Int? = nil, maxOutputTokens: Int? = nil, @@ -159,7 +101,7 @@ public struct LiveGenerationConfig: Sendable { ) } - /// Creates a new `LiveGenerationConfig` value without deprecated tuning parameters. + /// Creates a new `LiveGenerationConfig` value. /// /// See the /// [Configure model parameters](https://firebase.google.com/docs/vertex-ai/model-parameters) @@ -169,16 +111,41 @@ public struct LiveGenerationConfig: Sendable { /// /// - Parameters: /// - maxOutputTokens: Maximum number of tokens that can be generated in the response. + /// See the configure model parameters [documentation](https://firebase.google.com/docs/vertex-ai/model-parameters?platform=ios#max-output-tokens) + /// for more details. /// - responseModalities: The data types (modalities) that may be returned in model responses. - /// - speech: Controls the voice of the model, when streaming `audio` via `ResponseModality`. + /// + /// See the [multimodal + /// responses](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal-response-generation) + /// documentation for more details. + /// + /// > Warning: Specifying response modalities is a **Public Preview** feature, which means + /// > that it is not subject to any SLA or deprecation policy and could change in + /// > backwards-incompatible ways. + /// - speech: Controls the voice of the model, when streaming `audio` via + /// ``ResponseModality``. /// - inputAudioTranscription: Configures (and enables) input transcriptions when streaming to - /// the model. + /// the model. + /// + /// Input transcripts are the model's interpretation of audio data sent to it, and they are + /// populated in model responses via ``LiveServerContent/inputAudioTranscription``. When this + /// field is set to `nil`, input transcripts are not populated in model responses. /// - outputAudioTranscription: Configures (and enables) output transcriptions when streaming to - /// the model. - /// - contextWindowCompression: Enables context window compression to manage the model's context - /// window. + /// the model. + /// + /// Output transcripts are text representations of the audio the model is sending to the + /// client, and they are populated in model responses via + /// ``LiveServerContent/outputAudioTranscription``. When this + /// field is set to `nil`, output transcripts are not populated in model responses. + /// + /// > Important: Transcripts are independent to the model turn. This means transcripts may + /// > come earlier or later than when the model sends the corresponding audio responses. + /// - contextWindowCompression: Enables context window compression to manage the model's + /// context window. + /// + /// This mechanism prevents the context from exceeding a given length. /// - realtimeInputConfig: Configures model input behavior when generating content via the - /// realtime supported methods. + /// realtime supported methods public init(maxOutputTokens: Int? = nil, responseModalities: [ResponseModality]? = nil, speech: SpeechConfig? = nil, diff --git a/FirebaseAI/Tests/Unit/GenerationConfigTests.swift b/FirebaseAI/Tests/Unit/GenerationConfigTests.swift index 2224795fc83..4f81b92e4d3 100644 --- a/FirebaseAI/Tests/Unit/GenerationConfigTests.swift +++ b/FirebaseAI/Tests/Unit/GenerationConfigTests.swift @@ -16,7 +16,6 @@ import Foundation import XCTest -@available(*, deprecated) final class GenerationConfigTests: XCTestCase { let encoder = JSONEncoder() @@ -42,23 +41,11 @@ final class GenerationConfigTests: XCTestCase { } func testEncodeGenerationConfig_allOptions() throws { - let temperature: Float = 0.5 - let topP: Float = 0.75 - let topK = 40 - let candidateCount = 2 let maxOutputTokens = 256 - let presencePenalty: Float = 0.5 - let frequencyPenalty: Float = 0.75 let stopSequences = ["END", "DONE"] let responseMIMEType = "application/json" let generationConfig = GenerationConfig( - temperature: temperature, - topP: topP, - topK: topK, - candidateCount: candidateCount, maxOutputTokens: maxOutputTokens, - presencePenalty: presencePenalty, - frequencyPenalty: frequencyPenalty, stopSequences: stopSequences, responseMIMEType: responseMIMEType, responseSchema: .array(items: .string()), @@ -70,10 +57,7 @@ final class GenerationConfigTests: XCTestCase { let json = try XCTUnwrap(String(data: jsonData, encoding: .utf8)) XCTAssertEqual(json, """ { - "candidateCount" : \(candidateCount), - "frequencyPenalty" : \(frequencyPenalty), "maxOutputTokens" : \(maxOutputTokens), - "presencePenalty" : \(presencePenalty), "responseMimeType" : "\(responseMIMEType)", "responseModalities" : [ "TEXT", @@ -90,10 +74,7 @@ final class GenerationConfigTests: XCTestCase { "stopSequences" : [ "END", "DONE" - ], - "temperature" : \(temperature), - "topK" : \(topK), - "topP" : \(topP) + ] } """) } @@ -350,12 +331,7 @@ final class GenerationConfigTests: XCTestCase { func testMerge_baseNil() throws { let thinkingConfig = ThinkingConfig(thinkingLevel: .high, includeThoughts: true) let overrides = GenerationConfig( - temperature: 0.5, - topK: 10, - candidateCount: 2, maxOutputTokens: 2048, - presencePenalty: 0.3, - frequencyPenalty: 0.2, stopSequences: ["stop"], responseMIMEType: "application/json", responseModalities: [.text], @@ -364,13 +340,7 @@ final class GenerationConfigTests: XCTestCase { let result = try XCTUnwrap(GenerationConfig.merge(nil, with: overrides)) - XCTAssertEqual(result.temperature, 0.5) - XCTAssertNil(result.topP) - XCTAssertEqual(result.topK, 10) - XCTAssertEqual(result.candidateCount, 2) XCTAssertEqual(result.maxOutputTokens, 2048) - XCTAssertEqual(result.presencePenalty, 0.3) - XCTAssertEqual(result.frequencyPenalty, 0.2) XCTAssertEqual(result.stopSequences, ["stop"]) XCTAssertEqual(result.responseMIMEType, "application/json") XCTAssertEqual(result.responseModalities, [.text]) @@ -380,13 +350,7 @@ final class GenerationConfigTests: XCTestCase { func testMerge_overridesNil() throws { let thinkingConfig = ThinkingConfig(thinkingLevel: .minimal, includeThoughts: false) let overrides = GenerationConfig( - temperature: 0.9, - topP: 0.95, - topK: 5, - candidateCount: 4, maxOutputTokens: 1024, - presencePenalty: 0.5, - frequencyPenalty: 0.1, stopSequences: ["test"], responseModalities: [.image], thinkingConfig: thinkingConfig @@ -394,13 +358,7 @@ final class GenerationConfigTests: XCTestCase { let result = try XCTUnwrap(GenerationConfig.merge(nil, with: overrides)) - XCTAssertEqual(result.temperature, 0.9) - XCTAssertEqual(result.topP, 0.95) - XCTAssertEqual(result.topK, 5) - XCTAssertEqual(result.candidateCount, 4) XCTAssertEqual(result.maxOutputTokens, 1024) - XCTAssertEqual(result.presencePenalty, 0.5) - XCTAssertEqual(result.frequencyPenalty, 0.1) XCTAssertEqual(result.stopSequences, ["test"]) XCTAssertNil(result.responseMIMEType) XCTAssertEqual(result.responseModalities, [.image]) @@ -409,24 +367,14 @@ final class GenerationConfigTests: XCTestCase { func testMerge_mergesProperties() throws { let base = GenerationConfig( - temperature: 0.5, - topK: 10, - candidateCount: 1, responseMIMEType: "text/plain" ) let overrides = GenerationConfig( - temperature: 0.8, - topP: 0.9, responseMIMEType: "application/json", thinkingConfig: ThinkingConfig(thinkingBudget: 1024) ) let result = try XCTUnwrap(GenerationConfig.merge(base, with: overrides)) - - XCTAssertEqual(result.temperature, 0.8) - XCTAssertEqual(result.topK, 10) - XCTAssertEqual(result.candidateCount, 1) - XCTAssertEqual(result.topP, 0.9) XCTAssertEqual(result.responseMIMEType, "application/json") XCTAssertEqual(result.thinkingConfig?.thinkingBudget, 1024) } @@ -476,7 +424,7 @@ final class GenerationConfigTests: XCTestCase { func testMerge_speechConfig_fallbackToBase() throws { let base = GenerationConfig(speechConfig: SpeechConfig(voiceName: "Kore")) - let overrides = GenerationConfig(temperature: 0.5) + let overrides = GenerationConfig(maxOutputTokens: 55) let result = try XCTUnwrap(GenerationConfig.merge(base, with: overrides)) XCTAssertEqual(result.speechConfig, SpeechConfig(voiceName: "Kore").speechConfig) diff --git a/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift b/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift index 8c5353b29fb..9761f83215e 100644 --- a/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift +++ b/FirebaseAI/Tests/Unit/GenerativeModelVertexAITests.swift @@ -1839,7 +1839,6 @@ final class GenerativeModelVertexAITests: XCTestCase { XCTAssertEqual(response.promptTokensDetails[1].tokenCount, 31) } - @available(*, deprecated) func testCountTokens_succeeds_allOptions() async throws { MockURLProtocol.requestHandler = try GenerativeModelTestUtil.httpRequestHandler( forResource: "unary-success-total-tokens", @@ -1847,10 +1846,6 @@ final class GenerativeModelVertexAITests: XCTestCase { subdirectory: vertexSubdirectory ) let generationConfig = GenerationConfig( - temperature: 0.5, - topP: 0.9, - topK: 3, - candidateCount: 1, maxOutputTokens: 1024, stopSequences: ["test-stop"], responseMIMEType: "text/plain" diff --git a/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift b/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift index aa90820ae06..1dd901dc04e 100644 --- a/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift +++ b/FirebaseAI/Tests/Unit/ResponseGenerationOptionsTests.swift @@ -17,10 +17,9 @@ @testable import FirebaseAILogic - @available(*, deprecated) final class ResponseGenerationOptionsTests: XCTestCase { func testGenerationConfigConversion() { - let config = GenerationConfig(temperature: 0.5, topK: 40) + let config = GenerationConfig() let options = config.responseGenerationOptions @@ -41,7 +40,7 @@ } func testFactoryMethods() { - let config = GenerationConfig(temperature: 0.7, topP: 0.8) + let config = GenerationConfig() let foundationModelsGenerationOptions = FirebaseAI.GenerationOptions( sampling: .greedy, temperature: 0.4, maximumResponseTokens: 200 ) diff --git a/FirebaseAI/Tests/Unit/Snippets/LiveSnippets.swift b/FirebaseAI/Tests/Unit/Snippets/LiveSnippets.swift index 32b4014a3cf..b4c5f1f175a 100644 --- a/FirebaseAI/Tests/Unit/Snippets/LiveSnippets.swift +++ b/FirebaseAI/Tests/Unit/Snippets/LiveSnippets.swift @@ -215,9 +215,6 @@ final class LiveSnippets: XCTestCase { // Set parameter values in a `LiveGenerationConfig` (example values shown here) let config = LiveGenerationConfig( - temperature: 0.9, - topP: 0.1, - topK: 16, maxOutputTokens: 200, responseModalities: [.audio], speech: SpeechConfig(voiceName: "Fenrir") diff --git a/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift b/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift index 277cfe98723..f497562395e 100644 --- a/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift +++ b/FirebaseAI/Tests/Unit/Types/GenerationOptionsTests.swift @@ -20,7 +20,6 @@ import FoundationModels #endif - @available(*, deprecated) final class GenerationOptionsTests: XCTestCase { #if canImport(FoundationModels) @available(iOS 26.0, macOS 26.0, visionOS 26.0, *) From b049d07cb56f934ae69a7f4fa0a9d1308c605ff6 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Thu, 10 Sep 2026 09:27:23 -0700 Subject: [PATCH 6/7] self review --- FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift b/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift index 4a56b44e9ff..b6ccf0be8df 100644 --- a/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift +++ b/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift @@ -320,9 +320,8 @@ XCTAssertEqual(functionResponse.response, ["result": .string(CurrentTimeTool.currentTime)]) } - @available(*, deprecated) func testRespondTo_withOptions() async throws { - let config = GenerationConfig(temperature: 0.5, responseMIMEType: "application/json") + let config = GenerationConfig(responseMIMEType: "application/json") let bundle = BundleTestUtil.bundle() let fileURL = try XCTUnwrap(bundle.url( forResource: "unary-success-thinking-reply-thought-summary", From e044d47482cf26071af76c24b39dd28d7ae75761 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Thu, 10 Sep 2026 09:32:51 -0700 Subject: [PATCH 7/7] fix --- FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift b/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift index b6ccf0be8df..966db7d0e78 100644 --- a/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift +++ b/FirebaseAI/Tests/Unit/GenerativeModelSessionTests.swift @@ -343,11 +343,6 @@ XCTFail("Expected an object for JSON key 'generationConfig', got: \(json)") return (response, nil) } - guard case let .number(temperature) = generationConfig["temperature"] else { - XCTFail("Expected a number for JSON key 'temperature', got: \(json)") - return (response, nil) - } - XCTAssertEqual(Float(temperature), config.temperature) guard case let .string(responseMIMEType) = generationConfig["responseMimeType"] else { XCTFail("Expected a string for JSON key 'responseMimeType', got: \(json)") return (response, nil)