-
Notifications
You must be signed in to change notification settings - Fork 588
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
Migrate VertexAI serialization to be localized #6631
Conversation
Release note changesNo release note changes were detected. If you made changes that should be |
Vertex AI Mock Responses Check
|
Generated by 🚫 Danger |
Coverage Report 1Affected ProductsNo changes between base commit (f2d05d6) and merge commit (3f27cf8).Test Logs |
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.
This doesn't currently compile, as there's some imports and usages that need to be updated. Like:
- private fun InternalGenerateContentResponse.validate()
+ private fun GenerateContentResponse.InternalGenerateContentResponse.validate()
Also, (and this probably a convo for @rlazo too), any reason we want the fully qualified names over something like Internal
?
Current:
public class FunctionDeclaration(
internal val name: String,
internal val description: String,
internal val parameters: Map<String, Schema>,
internal val optionalParameters: List<String> = emptyList(),
) {
internal val schema: Schema =
Schema.obj(properties = parameters, optionalProperties = optionalParameters, nullable = false)
internal fun toInternal() =
InternalFunctionDeclaration(name, "", schema.toInternal())
@Serializable
internal data class InternalFunctionDeclaration(
val name: String,
val description: String,
val parameters: Schema.InternalSchema
)
}
With internal
naming:
public class FunctionDeclaration(
internal val name: String,
internal val description: String,
internal val parameters: Map<String, Schema>,
internal val optionalParameters: List<String> = emptyList(),
) {
internal val schema: Schema =
Schema.obj(properties = parameters, optionalProperties = optionalParameters, nullable = false)
internal fun toInternal() =
Internal(name, "", schema.toInternal())
@Serializable
internal data class Internal(
val name: String,
val description: String,
val parameters: Schema.InternalSchema
)
}
So its usage would be like this:
- FunctionDeclaration.InternalFunctionDeclaration(...)
+ FunctionDeclaration.Internal(...)
+1 to Call inner classes |
firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Candidate.kt
Show resolved
Hide resolved
Size Report 1Affected Products
Test Logs |
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.
+1
Besides the test failures, LGTM. I defer to @rlazo for the final approval.
firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/common/APIController.kt
Show resolved
Hide resolved
firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt
Outdated
Show resolved
Hide resolved
firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt
Outdated
Show resolved
Hide resolved
firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt
Outdated
Show resolved
Hide resolved
firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Candidate.kt
Show resolved
Hide resolved
firebase-vertexai/src/test/java/com/google/firebase/vertexai/InternalTests.kt
Outdated
Show resolved
Hide resolved
This reverts commit c75b68e.
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.
LGTM so long as the tests pass
There are some considerations to how this should be finalized. Current implementation details that I've decided on which we can change:
Foo
have been renamedInternalFoo
toPublic
andtoInternal
methods on API and serialization classes have been moved inside of those classes andconversions.kt
has been mostly emptied.Types.kt
filePossible changes:
InternalFoo
classes to have the same name, referenced asFoo.Internal
rather thanFoo.InternalFoo
. This will probably make the codebase feel cleaner, but I'll wait for opinions on itInternalFooSerializer
toSerializer
for exampleFoo.InternalFoo.Serializer
orFoo.Internal.Serializer
instead ofFoo.InternalFoo.InternalFooSerializer
orFoo.Internal.InternalFooSerializer