Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(vertexai): Split into separate libraries (#12794)
* Split into separate libraries The current approach uses `part` files which cannot be imported separately. One drawback of this approach is that any members which need to be referenced by test code must be public to the library. Using `src/` libraries, as opposed to `src/` part files, allows making APIs that are "package private" by convention - they are public to the library, but only exported through the `src/` import. One potential downside (alternatively seen as a benefit) of using separate libraries is that private members are truly private to their library, and we cannot make a member of a class private to the package. The convention for package imports only allows top level declarations to be considered non-public implementation details. - Remove imports from the top level library. Replace `part` lines with `export` of the same files. - Add explicit `show` clauses to the exports. This is what allows an API to be public when imported from the `src/` library, but not exposed through the package public library. - Change some private `_toGoogleAI<TypeName>` methods to extension methods. Use the name `toGoogleAI` since the specific type names are clear from context. - Change some private `_fromGoogleAI<TypeName>` factory constructors to extension methods on the google AI SDk types. Name `toVertex()`. - Remove some unused private methods that were filled in for consistency. More extension members can be added as needed. - Add an extension to expose the private field `_gooleAiModel` from `GenerativeModel`. - Add a top level method to forward to the private `GenerativeModel` constructor. - Add TODO comments to stop exporting some methods that don't need to be public. These could have been private in the `part` pattern. For now they are exported for backwards compatibility, and we can remove them when we are ready for a major version bump. * Fix typo * Add (redundant) docs * dart format * Add missing auth argument forwarding * Bad merge? * More bad merge * Unnecessary change * Update packages/firebase_vertexai/firebase_vertexai/lib/src/vertex_api.dart Co-authored-by: Russell Wheatley <russellwheatley85@gmail.com> --------- Co-authored-by: Cynthia J <cynthiajoan@users.noreply.github.com> Co-authored-by: Russell Wheatley <russellwheatley85@gmail.com>
- Loading branch information