Commit 85a517f
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>1 parent 76b4a54 commit 85a517f
File tree
7 files changed
+365
-297
lines changed- packages/firebase_vertexai/firebase_vertexai/lib
- src
7 files changed
+365
-297
lines changedLines changed: 55 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
16 | 25 | | |
17 | 26 | | |
18 | 27 | | |
| |||
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
108 | | - | |
| 117 | + | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
| |||
0 commit comments