-
Notifications
You must be signed in to change notification settings - Fork 586
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
base: main
Are you sure you want to change the base?
Conversation
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
Vertex AI Mock Responses Check
|
Generated by 🚫 Danger |
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(...)
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