Skip to content
Merged
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
6 changes: 5 additions & 1 deletion firebase-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Unreleased

* [fixed] Fixed `FirebaseAI.getInstance` StackOverflowException (#6971)
* [fixed] Fixed an issue that was causing the SDK to send empty `FunctionDeclaration` descriptions to the API.
* [fixed] Fixed an issue that was causing the SDK to send empty `FunctionDeclaration` descriptions to the API.
* [changed] Introduced the `Voice` class, which accepts a voice name, and deprecated the `Voices` class.
* [changed] **Breaking Change**: Updated `SpeechConfig` to take in `Voice` class instead of `Voices` class.
* **Action Required:** Update all references of `SpeechConfig` initialization to use `Voice` class.


# 16.0.0
* [feature] Initial release of the Firebase AI SDK (`firebase-ai`). This SDK *replaces* the previous
Vertex AI in Firebase SDK (`firebase-vertexai`) to accommodate the evolving set of supported
Expand Down
34 changes: 20 additions & 14 deletions firebase-ai/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,9 @@ package com.google.firebase.ai.type {
}

@com.google.firebase.ai.type.PublicPreviewAPI public final class SpeechConfig {
ctor public SpeechConfig(com.google.firebase.ai.type.Voices voice);
method public com.google.firebase.ai.type.Voices getVoice();
property public final com.google.firebase.ai.type.Voices voice;
ctor public SpeechConfig(com.google.firebase.ai.type.Voice voice);
method public com.google.firebase.ai.type.Voice getVoice();
property public final com.google.firebase.ai.type.Voice voice;
}

public abstract class StringFormat {
Expand Down Expand Up @@ -914,19 +914,25 @@ package com.google.firebase.ai.type {
property public final int totalTokenCount;
}

@com.google.firebase.ai.type.PublicPreviewAPI public final class Voices {
method public int getOrdinal();
property public final int ordinal;
field public static final com.google.firebase.ai.type.Voices AOEDE;
field public static final com.google.firebase.ai.type.Voices CHARON;
field public static final com.google.firebase.ai.type.Voices.Companion Companion;
field public static final com.google.firebase.ai.type.Voices FENRIR;
field public static final com.google.firebase.ai.type.Voices KORE;
field public static final com.google.firebase.ai.type.Voices PUCK;
field public static final com.google.firebase.ai.type.Voices UNSPECIFIED;
@com.google.firebase.ai.type.PublicPreviewAPI public final class Voice {
ctor public Voice(String voiceName);
method public String getVoiceName();
property public final String voiceName;
}

@Deprecated @com.google.firebase.ai.type.PublicPreviewAPI public final class Voices {
method @Deprecated public int getOrdinal();
property @Deprecated public final int ordinal;
field @Deprecated public static final com.google.firebase.ai.type.Voices AOEDE;
field @Deprecated public static final com.google.firebase.ai.type.Voices CHARON;
field @Deprecated public static final com.google.firebase.ai.type.Voices.Companion Companion;
field @Deprecated public static final com.google.firebase.ai.type.Voices FENRIR;
field @Deprecated public static final com.google.firebase.ai.type.Voices KORE;
field @Deprecated public static final com.google.firebase.ai.type.Voices PUCK;
field @Deprecated public static final com.google.firebase.ai.type.Voices UNSPECIFIED;
}

public static final class Voices.Companion {
@Deprecated public static final class Voices.Companion {
}

}
Expand Down
2 changes: 1 addition & 1 deletion firebase-ai/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

version=16.0.1
version=16.1.0
latestReleasedVersion=16.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import kotlinx.serialization.Serializable
@PublicPreviewAPI
public class SpeechConfig(
/** The voice to be used for the server's speech response. */
public val voice: Voices
public val voice: Voice
) {

@Serializable
internal data class Internal(@SerialName("voice_config") val voiceConfig: VoiceConfigInternal) {
@Serializable
internal data class VoiceConfigInternal(
@SerialName("prebuilt_voice_config") val prebuiltVoiceConfig: Voices.Internal,
@SerialName("prebuilt_voice_config") val prebuiltVoiceConfig: Voice.Internal,
)
}

Expand Down
34 changes: 34 additions & 0 deletions firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Voice.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.firebase.ai.type

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Various voices supported by the server. The list of all voices can be found
* [here](https://cloud.google.com/text-to-speech/docs/chirp3-hd)
*/
@PublicPreviewAPI
public class Voice public constructor(public val voiceName: String) {

@Serializable internal data class Internal(@SerialName("voice_name") val voiceName: String)

internal fun toInternal(): Internal {
return Internal(this.voiceName)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/** Various voices supported by the server */
@Deprecated("Please use the Voice class instead.", ReplaceWith("Voice"))
@PublicPreviewAPI
public class Voices private constructor(public val ordinal: Int) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
import com.google.firebase.ai.type.SpeechConfig;
import com.google.firebase.ai.type.TextPart;
import com.google.firebase.ai.type.UsageMetadata;
import com.google.firebase.ai.type.Voices;
import com.google.firebase.ai.type.Voice;
import com.google.firebase.concurrent.FirebaseExecutors;
import java.util.ArrayList;
import java.util.Calendar;
Expand Down Expand Up @@ -137,7 +137,7 @@ private LiveGenerationConfig getLiveConfig() {
.setFrequencyPenalty(1.0F)
.setPresencePenalty(2.0F)
.setResponseModality(ResponseModality.AUDIO)
.setSpeechConfig(new SpeechConfig(Voices.AOEDE))
.setSpeechConfig(new SpeechConfig(new Voice("AOEDE")))
.build();
}

Expand Down
Loading