@gullabs/google 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +84 -73
- package/README.md +38 -6
- package/dist/index.cjs +826 -331
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -41
- package/dist/index.d.ts +41 -41
- package/dist/index.js +825 -331
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
Apache License
|
|
2
3
|
Version 2.0, January 2004
|
|
3
4
|
http://www.apache.org/licenses/
|
|
@@ -32,33 +33,36 @@
|
|
|
32
33
|
not limited to compiled object code, generated documentation,
|
|
33
34
|
and conversions to other media types.
|
|
34
35
|
|
|
35
|
-
"Work" shall mean the work of authorship
|
|
36
|
-
the License, as indicated by a
|
|
37
|
-
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
38
40
|
|
|
39
41
|
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
42
|
form, that is based on (or derived from) the Work and for which the
|
|
41
|
-
editorial revisions, annotations, elaborations, or other
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"Contribution" shall mean
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
or
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
62
66
|
|
|
63
67
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
68
|
this License, each Contributor hereby grants to You a perpetual,
|
|
@@ -74,22 +78,22 @@
|
|
|
74
78
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
79
|
where such license applies only to those patent claims licensable
|
|
76
80
|
by such Contributor that are necessarily infringed by their
|
|
77
|
-
Contribution(s) alone or by
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
78
82
|
with the Work to which such Contribution(s) was submitted. If You
|
|
79
|
-
institute patent litigation against any entity (including a
|
|
80
|
-
or counterclaim in a lawsuit) alleging that the Work
|
|
81
|
-
|
|
82
|
-
infringement, then any patent licenses
|
|
83
|
-
License for that Work shall terminate
|
|
84
|
-
is filed.
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
85
89
|
|
|
86
90
|
4. Redistribution. You may reproduce and distribute copies of the
|
|
87
91
|
Work or Derivative Works thereof in any medium, with or without
|
|
88
92
|
modifications, and in Source or Object form, provided that You
|
|
89
93
|
meet the following conditions:
|
|
90
94
|
|
|
91
|
-
(a) You must give any other recipients of the Work or
|
|
92
|
-
Works a copy of this License; and
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
93
97
|
|
|
94
98
|
(b) You must cause any modified files to carry prominent notices
|
|
95
99
|
stating that You changed the files; and
|
|
@@ -101,25 +105,28 @@
|
|
|
101
105
|
the Derivative Works; and
|
|
102
106
|
|
|
103
107
|
(d) If the Work includes a "NOTICE" text file as part of its
|
|
104
|
-
distribution,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
the
|
|
109
|
-
Derivative Works;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
may
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
123
130
|
|
|
124
131
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
125
132
|
any Contribution intentionally submitted for inclusion in the Work
|
|
@@ -141,7 +148,7 @@
|
|
|
141
148
|
implied, including, without limitation, any warranties or conditions
|
|
142
149
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
143
150
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
144
|
-
appropriateness of using or
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
145
152
|
risks associated with Your exercise of permissions under this License.
|
|
146
153
|
|
|
147
154
|
8. Limitation of Liability. In no event and under no legal theory,
|
|
@@ -149,21 +156,23 @@
|
|
|
149
156
|
unless required by applicable law (such as deliberate and grossly
|
|
150
157
|
negligent acts) or agreed to in writing, shall any Contributor be
|
|
151
158
|
liable to You for damages, including any direct, indirect, special,
|
|
152
|
-
incidental, or
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
153
160
|
result of this License or out of the use or inability to use the
|
|
154
161
|
Work (including but not limited to damages for loss of goodwill,
|
|
155
|
-
work stoppage, computer failure or malfunction, or all
|
|
156
|
-
commercial damages or losses), even if such Contributor
|
|
157
|
-
advised of the possibility of such damages.
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
158
165
|
|
|
159
166
|
9. Accepting Warranty or Additional Liability. While redistributing
|
|
160
167
|
the Work or Derivative Works thereof, You may choose to offer,
|
|
161
168
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
162
169
|
or other liability obligations and/or rights consistent with this
|
|
163
|
-
License. However, in accepting such obligations, You may
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
167
176
|
|
|
168
177
|
END OF TERMS AND CONDITIONS
|
|
169
178
|
|
|
@@ -173,19 +182,21 @@
|
|
|
173
182
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
174
183
|
replaced with your own identifying information. (Don't include
|
|
175
184
|
the brackets!) The text should be enclosed in the appropriate
|
|
176
|
-
comment syntax for the file format
|
|
177
|
-
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
178
189
|
|
|
179
|
-
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
180
191
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
184
195
|
|
|
185
|
-
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
197
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ pnpm add @gullabs/google @gullabs/core @google/genai
|
|
|
21
21
|
| `buildGoogleClient(auth)` | Builds the real `@google/genai` client from `AuthMaterial` |
|
|
22
22
|
| `isGeminiCapacityError(err)` | Detects Gemini Flex shared-capacity errors for built-in fallback |
|
|
23
23
|
| `geminiModelDescriptors`, `gemmaModelDescriptors`, `defaultGeminiRegistry` | Built-in model descriptors + pre-built registry |
|
|
24
|
-
| `geminiPricingSource()`, `GEMINI_PRICING`, `
|
|
24
|
+
| `geminiPricingSource()`, `GEMINI_PRICING`, `resolveGeminiRates` | Built-in Gemini pricing snapshot (concrete standard / flex / batch rates) |
|
|
25
25
|
| `GoogleFileStore` | Files API: upload + poll ACTIVE + delete |
|
|
26
26
|
| `FileDeleteOptions` | `{ failClosed?, signal? }` — opt-in fail-closed delete (parity with `@gullabs/xai`) |
|
|
27
27
|
|
|
@@ -65,7 +65,7 @@ const result = await client.generate(
|
|
|
65
65
|
- `output.jsonSchema` → `responseMimeType: 'application/json'` + verbatim `responseSchema` when native structured output is enabled; the engine returns parsed output and `outputParsed` without validating shape
|
|
66
66
|
- `providerOptions.google.*` → typed provider-extension lane for admitted keys such as `cachedContent`, `safetySettings`, and exact tool declarations
|
|
67
67
|
- Usage: `promptTokenCount`→`inputTokens`, `candidatesTokenCount`+`thoughtsTokenCount`→`outputTokens` (GROSS)
|
|
68
|
-
- Errors: `401` and a bare `403` default to `invalid_auth`; `429`→`rate_limited`; `5xx`→`server`; timeouts; Gemini safety blocks are a 200-path `content_filter`
|
|
68
|
+
- Errors: `401` and a bare `403` default to `invalid_auth`; `429`→`rate_limited`; `5xx`→`server`; timeouts; Gemini safety blocks are a 200-path `content_filter` when `promptFeedback.blockReason` is set. A candidate-less 200 without a block reason is retryable `server`.
|
|
69
69
|
|
|
70
70
|
## Strict model-config expectations
|
|
71
71
|
|
|
@@ -80,10 +80,42 @@ descriptor boundary:
|
|
|
80
80
|
library has not yet shipped the matching schema, pricing, served-tier
|
|
81
81
|
recording, and tests.
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
The Developer API accepted structured JSON plus `googleSearch` on all registered
|
|
84
|
+
Gemini 3.x models in the 2026-09-26 live probes. The structured responses did
|
|
85
|
+
not include `groundingMetadata`, even when asked to search; callers must not
|
|
86
|
+
assume that an accepted tool means Search ran or that citations are available.
|
|
87
|
+
|
|
88
|
+
## Registered models
|
|
89
|
+
|
|
90
|
+
| id | Efforts | SO + search | caching.minTokens | Tiers |
|
|
91
|
+
| ------------------------ | ------------------------------- | ----------- | ----------------- | -------------- |
|
|
92
|
+
| `gemini-2.5-pro` | `low`, `medium`, `high` | no | 2048 | flex, standard |
|
|
93
|
+
| `gemini-2.5-flash` | `none`, `low`, `medium`, `high` | no | 2048 | flex, standard |
|
|
94
|
+
| `gemini-2.5-flash-lite` | `none`, `low`, `medium`, `high` | no | 2048 | flex, standard |
|
|
95
|
+
| `gemini-3.1-pro-preview` | `low`, `medium`, `high` | yes | 1024 | flex, standard |
|
|
96
|
+
| `gemini-3.1-flash-lite` | `none`, `low`, `medium`, `high` | yes | 1024 | flex, standard |
|
|
97
|
+
| `gemini-3.5-flash-lite` | `none`, `low`, `medium`, `high` | yes | 1024 | flex, standard |
|
|
98
|
+
| `gemini-3.6-flash` | `none`, `low`, `medium`, `high` | yes | 1024 | flex, standard |
|
|
99
|
+
| `gemini-3.7-flash` | `low`, `medium`, `high` | yes | 1024 | flex, standard |
|
|
100
|
+
| `gemini-3.8-flash` | `low`, `medium`, `high` | yes | 1024 | flex, standard |
|
|
101
|
+
| `gemma-4-31b-it` | `none`, `high` | no | n/a | none |
|
|
102
|
+
| `gemma-4-26b-a4b-it` | `none`, `high` | no | n/a | none |
|
|
103
|
+
|
|
104
|
+
All six Gemini 3.x cache-create minimums above were live checked: 103 tokens
|
|
105
|
+
returned `min_total_token_count=1024`; exactly 1024 tokens succeeded.
|
|
106
|
+
Google's 4096-token table in the caching guide describes **implicit** caching;
|
|
107
|
+
this column is the **explicit cache-create** floor.
|
|
108
|
+
|
|
109
|
+
`gemini-3.7-flash` and `gemini-3.8-flash` never emit `thinkingLevel` MINIMAL.
|
|
110
|
+
`gemini-3-flash-preview` and `gemini-3.5-flash` are deleted and are not aliased.
|
|
111
|
+
Migrate both to `gemini-3.6-flash`. `servedServiceTier` reads the provider's
|
|
112
|
+
`usageMetadata.serviceTier` echo when present, then falls back to the tier
|
|
113
|
+
actually dispatched when the echo is absent.
|
|
114
|
+
An echo that differs from the requested tier emits a warning so callers can
|
|
115
|
+
see a provider-side remap. `flexFallback: false` disables the adapter's retry
|
|
116
|
+
at standard tier; it cannot prevent a provider-side remap after dispatch.
|
|
117
|
+
A candidate-less HTTP 200 without a safety block is a retryable provider error;
|
|
118
|
+
its reported usage and snapshot cost are saved on that failed attempt.
|
|
87
119
|
|
|
88
120
|
## Gemma 4
|
|
89
121
|
|