Skip to content

Commit 1acaefe

Browse files
committed
add initialization functions
1 parent 5487034 commit 1acaefe

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public abstract class LiveSessionFutures internal constructor() {
6868
@RequiresPermission(RECORD_AUDIO)
6969
public abstract fun stopAudioConversation(): ListenableFuture<Unit>
7070

71+
7172
/**
7273
* Stops receiving from the model.
7374
*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ public class AudioRecordInitializationFailedException(message: String) :
219219
public class ServiceConnectionHandshakeFailedException(message: String, cause: Throwable? = null) :
220220
FirebaseAIException(message, cause)
221221

222+
/** The request is missing a permission that is required to perform the requested operation. */
223+
public class PermissionMissingException(message: String, cause: Throwable? = null) :
224+
FirebaseAIException(message, cause)
225+
222226
/** Catch all case for exceptions not explicitly expected. */
223227
public class UnknownException internal constructor(message: String, cause: Throwable? = null) :
224228
FirebaseAIException(message, cause)

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ internal constructor(
131131
}
132132
}
133133

134+
135+
/**
136+
* Indicates whether the underlying websocket connection is active.
137+
*/
138+
public fun isActive(): Boolean = session.isActive
139+
140+
/**
141+
* Indicates whether an audio conversation is being used for this session object.
142+
*/
143+
public fun isAudioConversationRunning(): Boolean = (audioHelper == null)
144+
134145
/**
135146
* Receives responses from the model for both streaming and standard requests.
136147
*

0 commit comments

Comments
 (0)