Skip to content

Commit 4398a12

Browse files
author
David Motsonashvili
committed
fixes for gemini comments
1 parent 697ae5d commit 4398a12

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

firebase-ai/api.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ package com.google.firebase.ai.java {
154154
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(boolean enableInterruptions);
155155
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function1<? super com.google.firebase.ai.type.FunctionCallPart,com.google.firebase.ai.type.FunctionResponsePart>? functionCallHandler);
156156
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function1<? super com.google.firebase.ai.type.FunctionCallPart,com.google.firebase.ai.type.FunctionResponsePart>? functionCallHandler, boolean enableInterruptions);
157-
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function1<? super com.google.firebase.ai.type.FunctionCallPart,com.google.firebase.ai.type.FunctionResponsePart>? functionCallHandler, kotlin.jvm.functions.Function2<? super com.google.firebase.ai.type.Transcription?,? super com.google.firebase.ai.type.Transcription?,kotlin.Unit>? transcriptHandler = null, boolean enableInterruptions);
158-
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function2<? super com.google.firebase.ai.type.Transcription?,? super com.google.firebase.ai.type.Transcription?,kotlin.Unit>? transcriptHandler = null);
159-
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function2<? super com.google.firebase.ai.type.Transcription?,? super com.google.firebase.ai.type.Transcription?,kotlin.Unit>? transcriptHandler = null, boolean enableInterruptions);
157+
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function1<? super com.google.firebase.ai.type.FunctionCallPart,com.google.firebase.ai.type.FunctionResponsePart>? functionCallHandler, kotlin.jvm.functions.Function2<? super com.google.firebase.ai.type.Transcription?,? super com.google.firebase.ai.type.Transcription?,kotlin.Unit>? transcriptHandler, boolean enableInterruptions);
158+
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function2<? super com.google.firebase.ai.type.Transcription?,? super com.google.firebase.ai.type.Transcription?,kotlin.Unit>? transcriptHandler);
159+
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> startAudioConversation(kotlin.jvm.functions.Function2<? super com.google.firebase.ai.type.Transcription?,? super com.google.firebase.ai.type.Transcription?,kotlin.Unit>? transcriptHandler, boolean enableInterruptions);
160160
method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture<kotlin.Unit> stopAudioConversation();
161161
method public abstract void stopReceiving();
162162
field public static final com.google.firebase.ai.java.LiveSessionFutures.Companion Companion;
@@ -846,9 +846,9 @@ package com.google.firebase.ai.type {
846846
ctor public LiveGenerationConfig.Builder();
847847
method public com.google.firebase.ai.type.LiveGenerationConfig build();
848848
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setFrequencyPenalty(Float? frequencyPenalty);
849-
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setInputAudioTranscript(com.google.firebase.ai.type.AudioTranscriptionConfig? config);
849+
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setInputAudioTranscription(com.google.firebase.ai.type.AudioTranscriptionConfig? config);
850850
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setMaxOutputTokens(Integer? maxOutputTokens);
851-
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setOutputAudioTranscript(com.google.firebase.ai.type.AudioTranscriptionConfig? config);
851+
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setOutputAudioTranscription(com.google.firebase.ai.type.AudioTranscriptionConfig? config);
852852
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setPresencePenalty(Float? presencePenalty);
853853
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setResponseModality(com.google.firebase.ai.type.ResponseModality? responseModality);
854854
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setSpeechConfig(com.google.firebase.ai.type.SpeechConfig? speechConfig);

firebase-ai/src/main/kotlin/com/google/firebase/ai/java/LiveSessionFutures.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ import org.reactivestreams.Publisher
4242
@PublicPreviewAPI
4343
public abstract class LiveSessionFutures internal constructor() {
4444

45+
/**
46+
* Starts an audio conversation with the model, which can only be stopped using
47+
* [stopAudioConversation].
48+
*/
49+
@RequiresPermission(RECORD_AUDIO)
50+
public abstract fun startAudioConversation(): ListenableFuture<Unit>
51+
4552
/**
4653
* Starts an audio conversation with the model, which can only be stopped using
4754
* [stopAudioConversation] or [close].
@@ -63,16 +70,9 @@ public abstract class LiveSessionFutures internal constructor() {
6370
*/
6471
@RequiresPermission(RECORD_AUDIO)
6572
public abstract fun startAudioConversation(
66-
transcriptHandler: ((Transcription?, Transcription?) -> Unit)? = null,
73+
transcriptHandler: ((Transcription?, Transcription?) -> Unit)?,
6774
): ListenableFuture<Unit>
6875

69-
/**
70-
* Starts an audio conversation with the model, which can only be stopped using
71-
* [stopAudioConversation].
72-
*/
73-
@RequiresPermission(RECORD_AUDIO)
74-
public abstract fun startAudioConversation(): ListenableFuture<Unit>
75-
7676
/**
7777
* Starts an audio conversation with the model, which can only be stopped using
7878
* [stopAudioConversation] or [close].
@@ -102,7 +102,7 @@ public abstract class LiveSessionFutures internal constructor() {
102102
*/
103103
@RequiresPermission(RECORD_AUDIO)
104104
public abstract fun startAudioConversation(
105-
transcriptHandler: ((Transcription?, Transcription?) -> Unit)? = null,
105+
transcriptHandler: ((Transcription?, Transcription?) -> Unit)?,
106106
enableInterruptions: Boolean
107107
): ListenableFuture<Unit>
108108

@@ -113,10 +113,6 @@ public abstract class LiveSessionFutures internal constructor() {
113113
* @param functionCallHandler A callback function that is invoked whenever the model receives a
114114
* function call.
115115
*
116-
* @param transcriptHandler A callback function that is invoked whenever the model receives a
117-
* transcript. The first [Transcription] object is the input transcription, and the second is the
118-
* output transcription
119-
*
120116
* @param enableInterruptions If enabled, allows the user to speak over or interrupt the model's
121117
* ongoing reply.
122118
*
@@ -126,7 +122,6 @@ public abstract class LiveSessionFutures internal constructor() {
126122
@RequiresPermission(RECORD_AUDIO)
127123
public abstract fun startAudioConversation(
128124
functionCallHandler: ((FunctionCallPart) -> FunctionResponsePart)?,
129-
transcriptHandler: ((Transcription?, Transcription?) -> Unit)? = null,
130125
enableInterruptions: Boolean
131126
): ListenableFuture<Unit>
132127

@@ -137,6 +132,10 @@ public abstract class LiveSessionFutures internal constructor() {
137132
* @param functionCallHandler A callback function that is invoked whenever the model receives a
138133
* function call.
139134
*
135+
* @param transcriptHandler A callback function that is invoked whenever the model receives a
136+
* transcript. The first [Transcription] object is the input transcription, and the second is the
137+
* output transcription
138+
*
140139
* @param enableInterruptions If enabled, allows the user to speak over or interrupt the model's
141140
* ongoing reply.
142141
*
@@ -146,6 +145,7 @@ public abstract class LiveSessionFutures internal constructor() {
146145
@RequiresPermission(RECORD_AUDIO)
147146
public abstract fun startAudioConversation(
148147
functionCallHandler: ((FunctionCallPart) -> FunctionResponsePart)?,
148+
transcriptHandler: ((Transcription?, Transcription?) -> Unit)?,
149149
enableInterruptions: Boolean
150150
): ListenableFuture<Unit>
151151

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/AudioTranscriptionConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package com.google.firebase.ai.type
1919
import kotlinx.serialization.Serializable
2020

2121
/** The audio transcription configuration. Its presence enables audio transcription */
22-
public class AudioTranscriptionConfig() {
22+
public class AudioTranscriptionConfig {
2323

2424
@Serializable internal object Internal
2525

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/LiveGenerationConfig.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ private constructor(
136136
this.speechConfig = speechConfig
137137
}
138138

139-
public fun setInputAudioTranscript(config: AudioTranscriptionConfig?): Builder = apply {
139+
public fun setInputAudioTranscription(config: AudioTranscriptionConfig?): Builder = apply {
140140
this.inputAudioTranscription = config
141141
}
142142

143-
public fun setOutputAudioTranscript(config: AudioTranscriptionConfig?): Builder = apply {
143+
public fun setOutputAudioTranscription(config: AudioTranscriptionConfig?): Builder = apply {
144144
this.outputAudioTranscription = config
145145
}
146146

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/LiveSession.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ internal constructor(
121121
) {
122122
startAudioConversation(
123123
functionCallHandler = functionCallHandler,
124+
transcriptHandler = null,
124125
enableInterruptions = enableInterruptions
125126
)
126127
}

0 commit comments

Comments
 (0)