-
Notifications
You must be signed in to change notification settings - Fork 709
Remove deprecated APIs and internalize response constructors in firebase-ai #8563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,13 +32,13 @@ public class AIModels { | |
| public var app: FirebaseApp? = null | ||
|
|
||
| public val vertexAIFlashModel: GenerativeModel by lazy { | ||
| getGenerativeModel(GenerativeBackend.vertexAI("global"), "gemini-3.5-flash") | ||
| getGenerativeModel(GenerativeBackend.agentPlatform("global"), "gemini-3.5-flash") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the backend has been changed from |
||
| } | ||
| public val vertexAIFlashLiteModel: GenerativeModel by lazy { | ||
| getGenerativeModel(GenerativeBackend.vertexAI("global"), "gemini-3.1-flash-lite") | ||
| getGenerativeModel(GenerativeBackend.agentPlatform("global"), "gemini-3.1-flash-lite") | ||
| } | ||
| public val vertexAI3_5FlashModel: GenerativeModel by lazy { | ||
| getGenerativeModel(GenerativeBackend.vertexAI("global"), "gemini-3.5-flash") | ||
| getGenerativeModel(GenerativeBackend.agentPlatform("global"), "gemini-3.5-flash") | ||
| } | ||
| public val googleAIFlashModel: GenerativeModel by lazy { | ||
| getGenerativeModel(GenerativeBackend.googleAI(), "gemini-3.1-flash-lite") | ||
|
|
@@ -50,7 +50,7 @@ public class AIModels { | |
| getGenerativeModel(GenerativeBackend.googleAI(), "gemini-3.5-flash") | ||
| } | ||
| public val vertexAITemplateModel: TemplateGenerativeModel by lazy { | ||
| FirebaseAI.getInstance(app(), GenerativeBackend.vertexAI()).templateGenerativeModel() | ||
| FirebaseAI.getInstance(app(), GenerativeBackend.agentPlatform()).templateGenerativeModel() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| public val googleAITemplateModel: TemplateGenerativeModel by lazy { | ||
| FirebaseAI.getInstance(app(), GenerativeBackend.googleAI()).templateGenerativeModel() | ||
|
|
@@ -82,7 +82,7 @@ public class AIModels { | |
| config: GenerationConfig? = null | ||
| ): List<GenerativeModel> { | ||
| return listOf( | ||
| getGenerativeModel(GenerativeBackend.vertexAI("global"), modelName, config), | ||
| getGenerativeModel(GenerativeBackend.agentPlatform("global"), modelName, config), | ||
| getGenerativeModel(GenerativeBackend.googleAI(), modelName, config), | ||
| ) | ||
| } | ||
|
|
@@ -122,7 +122,7 @@ public class AIModels { | |
| modelName: String? = null, | ||
| config: LiveGenerationConfig? = null | ||
| ): LiveGenerativeModel { | ||
| return FirebaseAI.getInstance(app(), GenerativeBackend.vertexAI()) | ||
| return FirebaseAI.getInstance(app(), GenerativeBackend.agentPlatform()) | ||
| .liveModel( | ||
| modelName = modelName ?: "gemini-live-2.5-flash-native-audio", | ||
| generationConfig = config, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -184,30 +184,33 @@ public class OnDeviceModelStatus private constructor(private val value: String) | |||||||||||||||
|
|
||||||||||||||||
| /** An abstract class representing the status of an on-device model download operation. */ | ||||||||||||||||
| @PublicPreviewAPI | ||||||||||||||||
| public abstract class DownloadStatus { | ||||||||||||||||
| public abstract class DownloadStatus internal constructor() { | ||||||||||||||||
|
Comment on lines
185
to
+187
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||||||||||||
| /** Represents when a download has just started. */ | ||||||||||||||||
| public class DownloadStarted(public val bytesToDownload: Long) : DownloadStatus() { | ||||||||||||||||
| public class DownloadStarted internal constructor(public val bytesToDownload: Long) : | ||||||||||||||||
| DownloadStatus() { | ||||||||||||||||
| override fun equals(other: Any?): Boolean = | ||||||||||||||||
| other is DownloadStarted && bytesToDownload == other.bytesToDownload | ||||||||||||||||
| override fun hashCode(): Int = bytesToDownload.hashCode() | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| /** Represents when a download is actively in progress. */ | ||||||||||||||||
| public class DownloadInProgress(public val totalBytesDownloaded: Long) : DownloadStatus() { | ||||||||||||||||
| public class DownloadInProgress internal constructor(public val totalBytesDownloaded: Long) : | ||||||||||||||||
| DownloadStatus() { | ||||||||||||||||
| override fun equals(other: Any?): Boolean = | ||||||||||||||||
| other is DownloadInProgress && totalBytesDownloaded == other.totalBytesDownloaded | ||||||||||||||||
| override fun hashCode(): Int = totalBytesDownloaded.hashCode() | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| /** Represents when a download has failed. */ | ||||||||||||||||
| public class DownloadFailed(public val exception: FirebaseAIException) : DownloadStatus() { | ||||||||||||||||
| public class DownloadFailed internal constructor(public val exception: FirebaseAIException) : | ||||||||||||||||
| DownloadStatus() { | ||||||||||||||||
| override fun equals(other: Any?): Boolean = | ||||||||||||||||
| other is DownloadFailed && exception == other.exception | ||||||||||||||||
| override fun hashCode(): Int = exception.hashCode() | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| /** Represents when a download has successfully completed. */ | ||||||||||||||||
| public class DownloadCompleted : DownloadStatus() { | ||||||||||||||||
| public class DownloadCompleted internal constructor() : DownloadStatus() { | ||||||||||||||||
| override fun equals(other: Any?): Boolean = other is DownloadCompleted | ||||||||||||||||
| override fun hashCode(): Int = javaClass.hashCode() | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
212
to
216
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since /** Represents when a download has successfully completed. */
public object DownloadCompleted : DownloadStatus() |
||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe run a search on the code base for
vertexai,vertext_ai, and replace then all with agent platform