WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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
2 changes: 2 additions & 0 deletions firebase-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- [changed] Added `equals()` function to `GenerativeBackend`.

# 17.7.0

- [changed] Added `LiveAudioConversationConfig` to control different aspects of the conversation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.google.firebase.ai.type

import java.util.Objects

/** Represents a reference to a backend for generative AI. */
public class GenerativeBackend
internal constructor(internal val location: String, internal val backend: GenerativeBackendEnum) {
Expand All @@ -40,6 +42,22 @@ internal constructor(internal val location: String, internal val backend: Genera
return GenerativeBackend(location, GenerativeBackendEnum.VERTEX_AI)
}
}

override fun equals(other: Any?): Boolean {
if (other is GenerativeBackend) {
return when (other.backend) {
GenerativeBackendEnum.GOOGLE_AI -> {
other.backend == this.backend
}
GenerativeBackendEnum.VERTEX_AI -> {
other.backend == this.backend && other.location == this.location
}
}
}
return false
}

override fun hashCode(): Int = Objects.hash(this.backend, this.location)
}

internal enum class GenerativeBackendEnum {
Expand Down