@aeye/google 0.11.0 → 0.11.1
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/README.md +119 -119
- package/aeye-google.md +123 -123
- package/dist/convert.d.ts +1 -1
- package/dist/convert.d.ts.map +1 -1
- package/dist/convert.js +1 -1
- package/dist/convert.js.map +1 -1
- package/dist/google.d.ts +2 -2
- package/dist/google.d.ts.map +1 -1
- package/dist/google.js +6 -6
- package/dist/google.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/retry.d.ts +1 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +5 -2
- package/dist/retry.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -7
package/README.md
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
# @aeye/google
|
|
2
|
-
|
|
3
|
-
Google Gemini provider for [@aeye](https://github.com/ClickerMonkey/aeye): the Gemini API (`generativelanguage.googleapis.com`) through the official [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK, and Vertex AI through the same SDK.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @aeye/google @aeye/ai @aeye/core
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Requires Node 22 or later.
|
|
12
|
-
|
|
13
|
-
## Quick start
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { AI } from '@aeye/ai';
|
|
17
|
-
import { GoogleProvider } from '@aeye/google';
|
|
18
|
-
import { googleModels } from '@aeye/models';
|
|
19
|
-
|
|
20
|
-
const google = new GoogleProvider({ apiKey: process.env.GEMINI_API_KEY }); // or GOOGLE_API_KEY, read when apiKey is left out
|
|
21
|
-
const ai = AI.with().providers({ google }).create({ models: googleModels });
|
|
22
|
-
|
|
23
|
-
const response = await ai.chat.get(
|
|
24
|
-
{ messages: [{ role: 'user', content: 'Hello!' }] },
|
|
25
|
-
{ metadata: { model: 'gemini-3.8-flash' } },
|
|
26
|
-
);
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`googleModels` (from `@aeye/models`) carries prices, capabilities, thinking levels, the parameters each model accepts and what the provider reads about it (`providerOptions.google`). Pass it as `modelInfo` too: the provider reads each model from it, and `listModels()` merges it into the live model list (offering only the models it has data for):
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
const google = new GoogleProvider({ modelInfo: googleModels });
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Vertex AI
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
const google = new GoogleProvider({ vertexai: true, project: 'my-project', location: 'global' });
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Credentials come from Application Default Credentials, or `googleAuthOptions`.
|
|
42
|
-
|
|
43
|
-
## What it supports
|
|
44
|
-
|
|
45
|
-
| Request | Gemini |
|
|
46
|
-
| --- | --- |
|
|
47
|
-
| Chat and streaming | `generateContent` / `streamGenerateContent` |
|
|
48
|
-
| System instructions | System messages become `systemInstruction` |
|
|
49
|
-
| Function calling | Function declarations in Gemini's JSON Schema dialect (`parametersJsonSchema`); parallel calls; tool choice as `AUTO`, `ANY`, `NONE`, or `VALIDATED` (strict tools, and `{ allowed }`) |
|
|
50
|
-
| Structured output | `responseJsonSchema` with `application/json`; `responseFormat: 'json'` for JSON mode |
|
|
51
|
-
| Thinking | `reason.effort` as `thinkingLevel` (Gemini 3 and 4), or `thinkingBudget` (Gemini 2.5, from `reason.maxTokens` or the effort); thought summaries as `reasoning`; thought signatures replayed on later turns |
|
|
52
|
-
| Media input | Images, audio, video and documents (PDF, text, Office), inline, by URL (Files API, Cloud Storage, YouTube, http), or uploaded through the Files API above `uploadThreshold`; `detail` as per-part media resolution |
|
|
53
|
-
| Hosted tools | `web_search` (Google Search grounding, with citations), `web_fetch` (URL context), `code_interpreter` (code execution), `file_search` (File Search stores), `mcp` |
|
|
54
|
-
| Context caching | Implicit by default; `explicitCaching` caches the prefix a `cacheBreakpoint` ends; `createCache` / `deleteCache`; `extra.cachedContent` |
|
|
55
|
-
| Token counting | `countTokens(request)` |
|
|
56
|
-
| Image output | `modalities: ['image']` on image models; `ai.image.generate` / `edit` (and streaming) with Gemini image models; Imagen on Vertex AI |
|
|
57
|
-
| Speech | `ai.speech` with Gemini TTS models (WAV or PCM; `instructions` and `speed` as the speaking style) |
|
|
58
|
-
| Transcription | `ai.transcribe` with Gemini 3.5 Transcribe (languages, custom vocabulary, diarization, word timestamps, SRT/WebVTT), or any Gemini model |
|
|
59
|
-
| Embeddings | `ai.embed` with `gemini-embedding-2` (text and images, one space) and `gemini-embedding-001`; `dimensions`; `extra.taskType` |
|
|
60
|
-
| Decisions | `ai.decide` with Gemini Decision 1 |
|
|
61
|
-
| Batches | `ai.batch` (inlined requests, half price) |
|
|
62
|
-
| Service tiers | `serviceTier: 'flex' \| 'fast' \| 'default'` as Flex, Priority and Standard inference |
|
|
63
|
-
| Safety | `safetySettings` in the config (or `extra.safetySettings`); blocked prompts and filtered answers end as `content_filter` with a `refusal` |
|
|
64
|
-
|
|
65
|
-
Rerank isn't offered by Gemini, so the provider has no `rerank`.
|
|
66
|
-
|
|
67
|
-
## Configuration
|
|
68
|
-
|
|
69
|
-
| Option | Purpose |
|
|
70
|
-
| --- | --- |
|
|
71
|
-
| `apiKey` | Gemini API key (default `GEMINI_API_KEY`, then `GOOGLE_API_KEY`) |
|
|
72
|
-
| `vertexai`, `project`, `location`, `googleAuthOptions` | Vertex AI |
|
|
73
|
-
| `apiVersion` | API version (default `v1beta` on the Gemini API) |
|
|
74
|
-
| `baseURL`, `headers`, `timeout`, `fetch` | HTTP |
|
|
75
|
-
| `retry`, `retryEvents` | Retries with backoff; `retryDelay` from the API is honored |
|
|
76
|
-
| `hooks` | `beforeRequest` / `afterRequest` / `onError` per operation |
|
|
77
|
-
| `safetySettings` | Sent with every request |
|
|
78
|
-
| `uploadThreshold` | Bytes above which a part goes through the Files API (default 20 MB) |
|
|
79
|
-
| `explicitCaching` | `true` or `{ ttl }` to cache breakpoint prefixes explicitly |
|
|
80
|
-
| `modelInfo` | The models' data (`googleModels`): what the provider reads per model, merged into `listModels` |
|
|
81
|
-
| `defaultModels` | Models per operation |
|
|
82
|
-
|
|
83
|
-
Anything in `request.extra` goes into the request's `GenerateContentConfig` (for example `topK`, `mediaResolution`, `safetySettings`, `cachedContent`, `speechConfig`).
|
|
84
|
-
|
|
85
|
-
## Where the model rules live
|
|
86
|
-
|
|
87
|
-
The provider keeps no per-model rules, tables or id patterns. Everything it decides per model it reads from the model's `ModelInfo`:
|
|
88
|
-
|
|
89
|
-
- `supportedParameters`: sampling, penalties, seed, stop sequences, thinking (`reason`) and `serviceTier` are sent only when listed (`supportedRequest` from `@aeye/ai`, applied on the wire as well as by the ai layer);
|
|
90
|
-
- `reasoningEfforts`: the thinking levels a level model takes;
|
|
91
|
-
- `providerOptions.google` (`GoogleModelOptions`): `kind` (chat, image, imagen, tts, transcribe, embedding, decision), `thinking` (`level`, `budget` with its range and whether 0 turns it off, or `none`), `explicitCaching`, the Gemini 3 request features (`partMediaResolution`, `functionResponseParts`, `thoughtSignatures`, `serverToolInvocations`, `toolsWithOutput`), `image` (aspect ratios and sizes), `speech` (voices and style), `embedding` (sizes, multimodal) and `aliasOf`;
|
|
92
|
-
- `schema`: the schema rules (`{ base: 'google' }`).
|
|
93
|
-
|
|
94
|
-
That data is `@aeye/models`' `googleModels`: what models.list and the docs pages say (`packages/models/scraped/google.json`) with `packages/models/overrides/google.ts` merged in (family defaults, a few documented per-generation rules, corrections, and the live matrix's results in its `measured` block). Give it to the provider as `modelInfo`. A model the provider has no data for gets `defaultGoogleModel`: a current Gemini chat model that thinks by level and is sent nothing it isn't known to take (no sampling, penalties, service tier, explicit caching or Gemini 3 request features). To change one model, override its data (`modelOverrides`, or your own `modelInfo`):
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
const ai = AI.with().providers({ google }).create({
|
|
98
|
-
models: googleModels,
|
|
99
|
-
modelOverrides: [{ provider: 'google', modelId: 'gemini-3.8-flash', overrides: { providerOptions: { google: { explicitCaching: false } } } }],
|
|
100
|
-
});
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Errors
|
|
104
|
-
|
|
105
|
-
`GoogleAuthError`, `GoogleRateLimitError` (with `retryAfter`), `GoogleQuotaError` (daily limits, depleted credits), `GoogleContextWindowError`, `GoogleSafetyError`, and `GoogleError` for the rest, each with the HTTP `status` and error `body`. A request over the context window ends with `finishReason: 'length'` instead of throwing, so prompts can trim and retry; a rejected schema becomes a `SchemaRejectedError` naming the tool or output.
|
|
106
|
-
|
|
107
|
-
## Testing
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
npm test # unit tests (mocked HTTP)
|
|
111
|
-
npm run test:integration # live tests; needs GEMINI_API_KEY or GOOGLE_API_KEY
|
|
112
|
-
npm run matrix # live support matrix (parameters, thinking, tools, caching, schemas)
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
See `docs/measured/` for the measured support matrix.
|
|
116
|
-
|
|
117
|
-
## License
|
|
118
|
-
|
|
119
|
-
GPL-3.0
|
|
1
|
+
# @aeye/google
|
|
2
|
+
|
|
3
|
+
Google Gemini provider for [@aeye](https://github.com/ClickerMonkey/aeye): the Gemini API (`generativelanguage.googleapis.com`) through the official [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK, and Vertex AI through the same SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @aeye/google @aeye/ai @aeye/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Node 22 or later.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { AI } from '@aeye/ai';
|
|
17
|
+
import { GoogleProvider } from '@aeye/google';
|
|
18
|
+
import { googleModels } from '@aeye/models';
|
|
19
|
+
|
|
20
|
+
const google = new GoogleProvider({ apiKey: process.env.GEMINI_API_KEY }); // or GOOGLE_API_KEY, read when apiKey is left out
|
|
21
|
+
const ai = AI.with().providers({ google }).create({ models: googleModels });
|
|
22
|
+
|
|
23
|
+
const response = await ai.chat.get(
|
|
24
|
+
{ messages: [{ role: 'user', content: 'Hello!' }] },
|
|
25
|
+
{ metadata: { model: 'gemini-3.8-flash' } },
|
|
26
|
+
);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`googleModels` (from `@aeye/models`) carries prices, capabilities, thinking levels, the parameters each model accepts and what the provider reads about it (`providerOptions.google`). Pass it as `modelInfo` too: the provider reads each model from it, and `listModels()` merges it into the live model list (offering only the models it has data for):
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
const google = new GoogleProvider({ modelInfo: googleModels });
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Vertex AI
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const google = new GoogleProvider({ vertexai: true, project: 'my-project', location: 'global' });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Credentials come from Application Default Credentials, or `googleAuthOptions`.
|
|
42
|
+
|
|
43
|
+
## What it supports
|
|
44
|
+
|
|
45
|
+
| Request | Gemini |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| Chat and streaming | `generateContent` / `streamGenerateContent` |
|
|
48
|
+
| System instructions | System messages become `systemInstruction` |
|
|
49
|
+
| Function calling | Function declarations in Gemini's JSON Schema dialect (`parametersJsonSchema`); parallel calls; tool choice as `AUTO`, `ANY`, `NONE`, or `VALIDATED` (strict tools, and `{ allowed }`) |
|
|
50
|
+
| Structured output | `responseJsonSchema` with `application/json`; `responseFormat: 'json'` for JSON mode |
|
|
51
|
+
| Thinking | `reason.effort` as `thinkingLevel` (Gemini 3 and 4), or `thinkingBudget` (Gemini 2.5, from `reason.maxTokens` or the effort); thought summaries as `reasoning`; thought signatures replayed on later turns |
|
|
52
|
+
| Media input | Images, audio, video and documents (PDF, text, Office), inline, by URL (Files API, Cloud Storage, YouTube, http), or uploaded through the Files API above `uploadThreshold`; `detail` as per-part media resolution |
|
|
53
|
+
| Hosted tools | `web_search` (Google Search grounding, with citations), `web_fetch` (URL context), `code_interpreter` (code execution), `file_search` (File Search stores), `mcp` |
|
|
54
|
+
| Context caching | Implicit by default; `explicitCaching` caches the prefix a `cacheBreakpoint` ends; `createCache` / `deleteCache`; `extra.cachedContent` |
|
|
55
|
+
| Token counting | `countTokens(request)` |
|
|
56
|
+
| Image output | `modalities: ['image']` on image models; `ai.image.generate` / `edit` (and streaming) with Gemini image models; Imagen on Vertex AI |
|
|
57
|
+
| Speech | `ai.speech` with Gemini TTS models (WAV or PCM; `instructions` and `speed` as the speaking style) |
|
|
58
|
+
| Transcription | `ai.transcribe` with Gemini 3.5 Transcribe (languages, custom vocabulary, diarization, word timestamps, SRT/WebVTT), or any Gemini model |
|
|
59
|
+
| Embeddings | `ai.embed` with `gemini-embedding-2` (text and images, one space) and `gemini-embedding-001`; `dimensions`; `extra.taskType` |
|
|
60
|
+
| Decisions | `ai.decide` with Gemini Decision 1 |
|
|
61
|
+
| Batches | `ai.batch` (inlined requests, half price) |
|
|
62
|
+
| Service tiers | `serviceTier: 'flex' \| 'fast' \| 'default'` as Flex, Priority and Standard inference |
|
|
63
|
+
| Safety | `safetySettings` in the config (or `extra.safetySettings`); blocked prompts and filtered answers end as `content_filter` with a `refusal` |
|
|
64
|
+
|
|
65
|
+
Rerank isn't offered by Gemini, so the provider has no `rerank`.
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
| Option | Purpose |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `apiKey` | Gemini API key (default `GEMINI_API_KEY`, then `GOOGLE_API_KEY`) |
|
|
72
|
+
| `vertexai`, `project`, `location`, `googleAuthOptions` | Vertex AI |
|
|
73
|
+
| `apiVersion` | API version (default `v1beta` on the Gemini API) |
|
|
74
|
+
| `baseURL`, `headers`, `timeout`, `fetch` | HTTP |
|
|
75
|
+
| `retry`, `retryEvents` | Retries with backoff; `retryDelay` from the API is honored |
|
|
76
|
+
| `hooks` | `beforeRequest` / `afterRequest` / `onError` per operation |
|
|
77
|
+
| `safetySettings` | Sent with every request |
|
|
78
|
+
| `uploadThreshold` | Bytes above which a part goes through the Files API (default 20 MB) |
|
|
79
|
+
| `explicitCaching` | `true` or `{ ttl }` to cache breakpoint prefixes explicitly |
|
|
80
|
+
| `modelInfo` | The models' data (`googleModels`): what the provider reads per model, merged into `listModels` |
|
|
81
|
+
| `defaultModels` | Models per operation |
|
|
82
|
+
|
|
83
|
+
Anything in `request.extra` goes into the request's `GenerateContentConfig` (for example `topK`, `mediaResolution`, `safetySettings`, `cachedContent`, `speechConfig`).
|
|
84
|
+
|
|
85
|
+
## Where the model rules live
|
|
86
|
+
|
|
87
|
+
The provider keeps no per-model rules, tables or id patterns. Everything it decides per model it reads from the model's `ModelInfo`:
|
|
88
|
+
|
|
89
|
+
- `supportedParameters`: sampling, penalties, seed, stop sequences, thinking (`reason`) and `serviceTier` are sent only when listed (`supportedRequest` from `@aeye/ai`, applied on the wire as well as by the ai layer);
|
|
90
|
+
- `reasoningEfforts`: the thinking levels a level model takes;
|
|
91
|
+
- `providerOptions.google` (`GoogleModelOptions`): `kind` (chat, image, imagen, tts, transcribe, embedding, decision), `thinking` (`level`, `budget` with its range and whether 0 turns it off, or `none`), `explicitCaching`, the Gemini 3 request features (`partMediaResolution`, `functionResponseParts`, `thoughtSignatures`, `serverToolInvocations`, `toolsWithOutput`), `image` (aspect ratios and sizes), `speech` (voices and style), `embedding` (sizes, multimodal) and `aliasOf`;
|
|
92
|
+
- `schema`: the schema rules (`{ base: 'google' }`).
|
|
93
|
+
|
|
94
|
+
That data is `@aeye/models`' `googleModels`: what models.list and the docs pages say (`packages/models/scraped/google.json`) with `packages/models/overrides/google.ts` merged in (family defaults, a few documented per-generation rules, corrections, and the live matrix's results in its `measured` block). Give it to the provider as `modelInfo`. A model the provider has no data for gets `defaultGoogleModel`: a current Gemini chat model that thinks by level and is sent nothing it isn't known to take (no sampling, penalties, service tier, explicit caching or Gemini 3 request features). To change one model, override its data (`modelOverrides`, or your own `modelInfo`):
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const ai = AI.with().providers({ google }).create({
|
|
98
|
+
models: googleModels,
|
|
99
|
+
modelOverrides: [{ provider: 'google', modelId: 'gemini-3.8-flash', overrides: { providerOptions: { google: { explicitCaching: false } } } }],
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Errors
|
|
104
|
+
|
|
105
|
+
`GoogleAuthError`, `GoogleRateLimitError` (with `retryAfter`), `GoogleQuotaError` (daily limits, depleted credits), `GoogleContextWindowError`, `GoogleSafetyError`, and `GoogleError` for the rest, each with the HTTP `status` and error `body`. A request over the context window ends with `finishReason: 'length'` instead of throwing, so prompts can trim and retry; a rejected schema becomes a `SchemaRejectedError` naming the tool or output.
|
|
106
|
+
|
|
107
|
+
## Testing
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm test # unit tests (mocked HTTP)
|
|
111
|
+
npm run test:integration # live tests; needs GEMINI_API_KEY or GOOGLE_API_KEY
|
|
112
|
+
npm run matrix # live support matrix (parameters, thinking, tools, caching, schemas)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
See `docs/measured/` for the measured support matrix.
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
GPL-3.0
|
package/aeye-google.md
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
# @aeye/google
|
|
2
|
-
|
|
3
|
-
One-line purpose: Google Gemini provider for the `@aeye/ai` framework: the Gemini API (`generativelanguage.googleapis.com`, and Vertex AI) through the official `@google/genai` SDK, covering chat, streaming, function calling, structured output, thinking, multimodal input, Google's hosted tools, context caching, token counting, image generation and editing, speech, transcription, embeddings, decisions and batches.
|
|
4
|
-
|
|
5
|
-
## When to use
|
|
6
|
-
|
|
7
|
-
- You want Gemini models (Gemini 4, 3.x, 2.5; Nano Banana image models; Gemini TTS; Gemini 3.5 Transcribe; Gemini Embedding; Gemini Decision 1) through `@aeye/ai`.
|
|
8
|
-
- You want Gemini on Vertex AI (`vertexai: true`), including Imagen there.
|
|
9
|
-
|
|
10
|
-
## Install / import
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install @aeye/google
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
import {
|
|
18
|
-
GoogleProvider,
|
|
19
|
-
type GoogleConfig,
|
|
20
|
-
type GoogleHooks,
|
|
21
|
-
GoogleError, GoogleAuthError, GoogleRateLimitError, GoogleQuotaError, GoogleContextWindowError, GoogleSafetyError,
|
|
22
|
-
// model data: what the provider reads (ModelInfo.providerOptions.google), and the default for a model with none
|
|
23
|
-
type GoogleModelOptions, googleOptions, defaultGoogleModel, toModelInfo, bareModelId,
|
|
24
|
-
} from '@aeye/google';
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Node >= 22. `@google/genai` (v3) is a dependency.
|
|
28
|
-
|
|
29
|
-
## Register with `@aeye/ai`
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { AI } from '@aeye/ai';
|
|
33
|
-
import { GoogleProvider } from '@aeye/google';
|
|
34
|
-
import { googleModels } from '@aeye/models';
|
|
35
|
-
|
|
36
|
-
const google = new GoogleProvider({ modelInfo: googleModels }); // apiKey defaults to GEMINI_API_KEY, then GOOGLE_API_KEY
|
|
37
|
-
const ai = AI.with().providers({ google }).create({ models: googleModels });
|
|
38
|
-
|
|
39
|
-
await ai.chat.get({ messages: [{ role: 'user', content: 'Hi' }] }, { metadata: { model: 'gemini-3.8-flash' } });
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`googleModels` carries prices (Standard tier on the scrape date), capabilities, thinking levels and each model's `supportedParameters`, so the ai layer leaves out sampling settings a model ignores or refuses.
|
|
43
|
-
|
|
44
|
-
## Configuration (`GoogleConfig`)
|
|
45
|
-
|
|
46
|
-
| Field | Notes |
|
|
47
|
-
| --- | --- |
|
|
48
|
-
| `apiKey` | Gemini API key; default `GEMINI_API_KEY`, then `GOOGLE_API_KEY` |
|
|
49
|
-
| `vertexai`, `project`, `location`, `googleAuthOptions` | Vertex AI (Application Default Credentials by default) |
|
|
50
|
-
| `apiVersion` | Default `v1beta` on the Gemini API (the SDK defaults to `v1`; caching, Files and the Decisions API are beta) |
|
|
51
|
-
| `baseURL`, `headers`, `timeout`, `fetch` | HTTP options passed to the SDK (`fetch` for proxies and tests) |
|
|
52
|
-
| `retry`, `retryEvents` | `withRetry` backoff with jitter; retries 0 (network), 429, 500, 502, 503, 504; honors `RetryInfo.retryDelay`; never retries daily quotas, `limit: 0`, auth, or context overflows. The SDK's own retries stay off |
|
|
53
|
-
| `hooks` | `beforeRequest` / `afterRequest` / `onError` for `chat`, `imageGenerate`, `imageEdit`, `transcribe`, `speech`, `embed`, `decide`; `params` is the SDK's request |
|
|
54
|
-
| `safetySettings` | Sent with every request |
|
|
55
|
-
| `uploadThreshold` | Parts above this many bytes go through the Files API (default 20 MB) |
|
|
56
|
-
| `explicitCaching` | `true` or `{ ttl }`: cache the prefix the last `cacheBreakpoint` ends |
|
|
57
|
-
| `modelInfo` | The models' data by id (`googleModels`): read per call, merged into `listModels` |
|
|
58
|
-
| `defaultModels` | Defaults: `gemini-nano-banana-2.1` (images), `gemini-3.5-flash-lite` (image analysis), `gemini-3.5-transcribe`, `gemini-3.8-flash-lite-tts`, `gemini-embedding-2`, `gemini-decision-1`; no chat default |
|
|
59
|
-
|
|
60
|
-
`request.extra` is spread into the `GenerateContentConfig` (`topK`, `mediaResolution`, `safetySettings`, `cachedContent`, `speechConfig`, `thinkingConfig`, ...), except `retry` / `retryEvents`.
|
|
61
|
-
|
|
62
|
-
## Request mapping
|
|
63
|
-
|
|
64
|
-
| @aeye | Gemini |
|
|
65
|
-
| --- | --- |
|
|
66
|
-
| system messages | `systemInstruction` |
|
|
67
|
-
| assistant / tool messages | `model` contents with `functionCall` parts; `functionResponse` parts (named after their call, `{ error }` for failures; images and files inside the response on Gemini 3+); consecutive same-role contents merged so parallel calls are answered in one turn |
|
|
68
|
-
| `tools` | `functionDeclarations` with `parametersJsonSchema` rendered by `@aeye/schema` (`google` family; strict tools `GOOGLE_STRICT`) |
|
|
69
|
-
| `toolChoice` | `auto` → AUTO (VALIDATED when a tool is strict), `required` → ANY, `{ tool }` → ANY + allowed, `{ allowed }` → VALIDATED (ANY when required) + allowed, `none` → NONE |
|
|
70
|
-
| `responseFormat` | schema → `responseJsonSchema` + `application/json`; `'json'` → JSON MIME type. Gemini 2.5 can't combine functions with a schema, so there it goes in the prompt |
|
|
71
|
-
| `reason` | Gemini 3/4: `thinkingLevel` from `effort` (clamped to `reasoningEfforts`; `none` → the lowest level; a lone `maxTokens` → the nearest level). Gemini 2.5: `thinkingBudget` from `maxTokens` or the effort, within the model's range (`none` → 0 where allowed). `includeThoughts` unless `exclude` |
|
|
72
|
-
| `temperature`, `topP`, `maxTokens`, `stop` (≤5), `seed`, penalties | `generationConfig` |
|
|
73
|
-
| `serviceTier` | `flex` → Flex, `fast` → Priority, `default` → Standard |
|
|
74
|
-
| `modalities` | `['image']` → TEXT+IMAGE; `['audio']` → AUDIO with `audio.voice` |
|
|
75
|
-
| `hostedTools` | `web_search` → `googleSearch` (`blockedDomains` → `excludeDomains` on Vertex only; `allowedDomains` refused), `web_fetch` → `urlContext`, `code_interpreter` → `codeExecution`, `file_search` → `fileSearch`, `mcp` → `mcpServers`; `image_generation` refused. With functions on Gemini 3+, `includeServerSideToolInvocations` |
|
|
76
|
-
| content parts | text; image/audio/video/file inline, by `fileData` (Files API, `gs://`, YouTube, http URLs of known type), or uploaded; `detail` → per-part `mediaResolution` on Gemini 3+; `cacheBreakpoint` → explicit cache when on |
|
|
77
|
-
| `metadata` | `labels` (Vertex AI only) |
|
|
78
|
-
|
|
79
|
-
## Response mapping
|
|
80
|
-
|
|
81
|
-
- Text, thought summaries (`reasoning.content`), tool calls (Gemini sends each whole; ids generated when missing), images, audio.
|
|
82
|
-
- Thought signatures are kept as `google-gemini-v1` reasoning details (`fc:<call id>`, `text:<n>`) and replayed on later turns, only for reasoning whose `provider` is `google` (or unset). A Gemini 3+ function call without a signature (history from another model) is sent with `skip_thought_signature_validator`. Server-side tool parts (search calls, code runs) are kept as `google.part` details and replayed.
|
|
83
|
-
- `finishReason`: STOP → stop (tool_calls when calls were made), MAX_TOKENS/CONTINUATION → length, SAFETY/RECITATION/BLOCKLIST/PROHIBITED_CONTENT/SPII/IMAGE_* /LANGUAGE → content_filter with a `refusal`; a blocked prompt → content_filter with the block reason.
|
|
84
|
-
- `usage`: prompt tokens by modality (text incl. video and documents, image, audio), server-side tool prompt tokens as input, cache reads as `text.cached` (out of the input), candidate tokens by modality (image tokens as `image.tokens`, audio as `audio.output`), thoughts as `reasoning.output`, and hosted tool calls (`web_search` per query, `web_fetch`, `code_interpreter`).
|
|
85
|
-
- `citations` from grounding chunks and supports, byte offsets turned into character offsets.
|
|
86
|
-
- A context window overflow ends as `finishReason: 'length'`; a 400 naming a function declaration or the response schema becomes a `SchemaRejectedError`.
|
|
87
|
-
|
|
88
|
-
## Other operations
|
|
89
|
-
|
|
90
|
-
- `generateImage` / `editImage` (and streams): Gemini image models via `generateContent`, `n` calls for `n` images, `size` → nearest `aspectRatio` + `imageSize` (512/1K/2K/4K), `quality` → size; edits send image, references and a described mask before the prompt. Imagen on Vertex AI only.
|
|
91
|
-
- `speech`: Gemini TTS; WAV (default) or PCM out; `instructions`/`speed` → `speechMetadata.style` (3.8 TTS) or a spoken direction; voice ids (`voice_...`, `voicekey_...`) on 3.8.
|
|
92
|
-
- `transcribe` / `transcribeStream`: Gemini 3.5 Transcribe with `audioTranscriptionConfig` (`language` → `languageCodes`, `prompt` → custom vocabulary, `diarized_json` → diarization, `srt`/`vtt`/`verbose_json` → word timestamps and captions); other models are prompted to transcribe.
|
|
93
|
-
- `embed`: one content per input so each gets a vector; `dimensions` → `outputDimensionality`; `extra.taskType` (and `title`) on `gemini-embedding-001`, a task prefix on `gemini-embedding-2`; images on `gemini-embedding-2` only.
|
|
94
|
-
- `decide`: Gemini Decision 1 (`noul`/`choice`/`score`); conversations are serialized as text; a blocked input answers every question with `refusal`.
|
|
95
|
-
- `submitBatch` / `getBatch`: inlined requests.
|
|
96
|
-
- `countTokens(request)`, `createCache` / `deleteCache`, `uploadFile` / `deleteFile`, `listModels`, `checkHealth`.
|
|
97
|
-
- No `rerank` (Gemini has none).
|
|
98
|
-
|
|
99
|
-
## Gotchas
|
|
100
|
-
|
|
101
|
-
- Gemini 3.5 Flash-Lite, 3.6 Flash and later, and Gemini 4 silently ignore `temperature`/`topP`/`topK`; their `supportedParameters` leave them out. Gemini 3 models refuse penalties, `logprobs` and `candidateCount` (measured).
|
|
102
|
-
- Gemini 3.8 Flash and Gemini 4 have no `minimal` level; only Gemini 4 Neon and Hydrogen take `xhigh`.
|
|
103
|
-
- Gemini 4 has no explicit caching; implicit caching applies from 4,096 tokens.
|
|
104
|
-
- The 2.5 models answer 404 to new users; `gemini-2.5-pro`/`-flash` route to 3.8 Flash / 3.5 Flash-Lite from December 1, 2026.
|
|
105
|
-
- Measured support: `docs/measured/` in this package (`npm run matrix` re-runs it).
|
|
106
|
-
|
|
107
|
-
## Where the model rules live
|
|
108
|
-
|
|
109
|
-
The provider keeps no per-model rules, tables or id patterns. Everything it decides per model it reads from the model's `ModelInfo`:
|
|
110
|
-
|
|
111
|
-
- `supportedParameters`: sampling, penalties, seed, stop sequences, thinking (`reason`) and `serviceTier` are sent only when listed (`supportedRequest` from `@aeye/ai`, applied on the wire as well as by the ai layer);
|
|
112
|
-
- `reasoningEfforts`: the thinking levels a level model takes;
|
|
113
|
-
- `providerOptions.google` (`GoogleModelOptions`): `kind` (chat, image, imagen, tts, transcribe, embedding, decision), `thinking` (`level`, `budget` with its range and whether 0 turns it off, or `none`), `explicitCaching`, the Gemini 3 request features (`partMediaResolution`, `functionResponseParts`, `thoughtSignatures`, `serverToolInvocations`, `toolsWithOutput`), `image` (aspect ratios and sizes), `speech` (voices and style), `embedding` (sizes, multimodal) and `aliasOf`;
|
|
114
|
-
- `schema`: the schema rules (`{ base: 'google' }`).
|
|
115
|
-
|
|
116
|
-
That data is `@aeye/models`' `googleModels`: what models.list and the docs pages say (`packages/models/scraped/google.json`) with `packages/models/overrides/google.ts` merged in (family defaults, a few documented per-generation rules, corrections, and the live matrix's results in its `measured` block). Give it to the provider as `modelInfo`. A model the provider has no data for gets `defaultGoogleModel`: a current Gemini chat model that thinks by level and is sent nothing it isn't known to take (no sampling, penalties, service tier, explicit caching or Gemini 3 request features). To change one model, override its data (`modelOverrides`, or your own `modelInfo`):
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
const ai = AI.with().providers({ google }).create({
|
|
120
|
-
models: googleModels,
|
|
121
|
-
modelOverrides: [{ provider: 'google', modelId: 'gemini-3.8-flash', overrides: { providerOptions: { google: { explicitCaching: false } } } }],
|
|
122
|
-
});
|
|
123
|
-
```
|
|
1
|
+
# @aeye/google
|
|
2
|
+
|
|
3
|
+
One-line purpose: Google Gemini provider for the `@aeye/ai` framework: the Gemini API (`generativelanguage.googleapis.com`, and Vertex AI) through the official `@google/genai` SDK, covering chat, streaming, function calling, structured output, thinking, multimodal input, Google's hosted tools, context caching, token counting, image generation and editing, speech, transcription, embeddings, decisions and batches.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- You want Gemini models (Gemini 4, 3.x, 2.5; Nano Banana image models; Gemini TTS; Gemini 3.5 Transcribe; Gemini Embedding; Gemini Decision 1) through `@aeye/ai`.
|
|
8
|
+
- You want Gemini on Vertex AI (`vertexai: true`), including Imagen there.
|
|
9
|
+
|
|
10
|
+
## Install / import
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @aeye/google
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import {
|
|
18
|
+
GoogleProvider,
|
|
19
|
+
type GoogleConfig,
|
|
20
|
+
type GoogleHooks,
|
|
21
|
+
GoogleError, GoogleAuthError, GoogleRateLimitError, GoogleQuotaError, GoogleContextWindowError, GoogleSafetyError,
|
|
22
|
+
// model data: what the provider reads (ModelInfo.providerOptions.google), and the default for a model with none
|
|
23
|
+
type GoogleModelOptions, googleOptions, defaultGoogleModel, toModelInfo, bareModelId,
|
|
24
|
+
} from '@aeye/google';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Node >= 22. `@google/genai` (v3) is a dependency.
|
|
28
|
+
|
|
29
|
+
## Register with `@aeye/ai`
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { AI } from '@aeye/ai';
|
|
33
|
+
import { GoogleProvider } from '@aeye/google';
|
|
34
|
+
import { googleModels } from '@aeye/models';
|
|
35
|
+
|
|
36
|
+
const google = new GoogleProvider({ modelInfo: googleModels }); // apiKey defaults to GEMINI_API_KEY, then GOOGLE_API_KEY
|
|
37
|
+
const ai = AI.with().providers({ google }).create({ models: googleModels });
|
|
38
|
+
|
|
39
|
+
await ai.chat.get({ messages: [{ role: 'user', content: 'Hi' }] }, { metadata: { model: 'gemini-3.8-flash' } });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`googleModels` carries prices (Standard tier on the scrape date), capabilities, thinking levels and each model's `supportedParameters`, so the ai layer leaves out sampling settings a model ignores or refuses.
|
|
43
|
+
|
|
44
|
+
## Configuration (`GoogleConfig`)
|
|
45
|
+
|
|
46
|
+
| Field | Notes |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `apiKey` | Gemini API key; default `GEMINI_API_KEY`, then `GOOGLE_API_KEY` |
|
|
49
|
+
| `vertexai`, `project`, `location`, `googleAuthOptions` | Vertex AI (Application Default Credentials by default) |
|
|
50
|
+
| `apiVersion` | Default `v1beta` on the Gemini API (the SDK defaults to `v1`; caching, Files and the Decisions API are beta) |
|
|
51
|
+
| `baseURL`, `headers`, `timeout`, `fetch` | HTTP options passed to the SDK (`fetch` for proxies and tests) |
|
|
52
|
+
| `retry`, `retryEvents` | `withRetry` backoff with jitter; retries 0 (network), 429, 500, 502, 503, 504; honors `RetryInfo.retryDelay`; never retries daily quotas, `limit: 0`, auth, or context overflows. The SDK's own retries stay off |
|
|
53
|
+
| `hooks` | `beforeRequest` / `afterRequest` / `onError` for `chat`, `imageGenerate`, `imageEdit`, `transcribe`, `speech`, `embed`, `decide`; `params` is the SDK's request |
|
|
54
|
+
| `safetySettings` | Sent with every request |
|
|
55
|
+
| `uploadThreshold` | Parts above this many bytes go through the Files API (default 20 MB) |
|
|
56
|
+
| `explicitCaching` | `true` or `{ ttl }`: cache the prefix the last `cacheBreakpoint` ends |
|
|
57
|
+
| `modelInfo` | The models' data by id (`googleModels`): read per call, merged into `listModels` |
|
|
58
|
+
| `defaultModels` | Defaults: `gemini-nano-banana-2.1` (images), `gemini-3.5-flash-lite` (image analysis), `gemini-3.5-transcribe`, `gemini-3.8-flash-lite-tts`, `gemini-embedding-2`, `gemini-decision-1`; no chat default |
|
|
59
|
+
|
|
60
|
+
`request.extra` is spread into the `GenerateContentConfig` (`topK`, `mediaResolution`, `safetySettings`, `cachedContent`, `speechConfig`, `thinkingConfig`, ...), except `retry` / `retryEvents`.
|
|
61
|
+
|
|
62
|
+
## Request mapping
|
|
63
|
+
|
|
64
|
+
| @aeye | Gemini |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| system messages | `systemInstruction` |
|
|
67
|
+
| assistant / tool messages | `model` contents with `functionCall` parts; `functionResponse` parts (named after their call, `{ error }` for failures; images and files inside the response on Gemini 3+); consecutive same-role contents merged so parallel calls are answered in one turn |
|
|
68
|
+
| `tools` | `functionDeclarations` with `parametersJsonSchema` rendered by `@aeye/schema` (`google` family; strict tools `GOOGLE_STRICT`) |
|
|
69
|
+
| `toolChoice` | `auto` → AUTO (VALIDATED when a tool is strict), `required` → ANY, `{ tool }` → ANY + allowed, `{ allowed }` → VALIDATED (ANY when required) + allowed, `none` → NONE |
|
|
70
|
+
| `responseFormat` | schema → `responseJsonSchema` + `application/json`; `'json'` → JSON MIME type. Gemini 2.5 can't combine functions with a schema, so there it goes in the prompt |
|
|
71
|
+
| `reason` | Gemini 3/4: `thinkingLevel` from `effort` (clamped to `reasoningEfforts`; `none` → the lowest level; a lone `maxTokens` → the nearest level). Gemini 2.5: `thinkingBudget` from `maxTokens` or the effort, within the model's range (`none` → 0 where allowed). `includeThoughts` unless `exclude` |
|
|
72
|
+
| `temperature`, `topP`, `maxTokens`, `stop` (≤5), `seed`, penalties | `generationConfig` |
|
|
73
|
+
| `serviceTier` | `flex` → Flex, `fast` → Priority, `default` → Standard |
|
|
74
|
+
| `modalities` | `['image']` → TEXT+IMAGE; `['audio']` → AUDIO with `audio.voice` |
|
|
75
|
+
| `hostedTools` | `web_search` → `googleSearch` (`blockedDomains` → `excludeDomains` on Vertex only; `allowedDomains` refused), `web_fetch` → `urlContext`, `code_interpreter` → `codeExecution`, `file_search` → `fileSearch`, `mcp` → `mcpServers`; `image_generation` refused. With functions on Gemini 3+, `includeServerSideToolInvocations` |
|
|
76
|
+
| content parts | text; image/audio/video/file inline, by `fileData` (Files API, `gs://`, YouTube, http URLs of known type), or uploaded; `detail` → per-part `mediaResolution` on Gemini 3+; `cacheBreakpoint` → explicit cache when on |
|
|
77
|
+
| `metadata` | `labels` (Vertex AI only) |
|
|
78
|
+
|
|
79
|
+
## Response mapping
|
|
80
|
+
|
|
81
|
+
- Text, thought summaries (`reasoning.content`), tool calls (Gemini sends each whole; ids generated when missing), images, audio.
|
|
82
|
+
- Thought signatures are kept as `google-gemini-v1` reasoning details (`fc:<call id>`, `text:<n>`) and replayed on later turns, only for reasoning whose `provider` is `google` (or unset). A Gemini 3+ function call without a signature (history from another model) is sent with `skip_thought_signature_validator`. Server-side tool parts (search calls, code runs) are kept as `google.part` details and replayed.
|
|
83
|
+
- `finishReason`: STOP → stop (tool_calls when calls were made), MAX_TOKENS/CONTINUATION → length, SAFETY/RECITATION/BLOCKLIST/PROHIBITED_CONTENT/SPII/IMAGE_* /LANGUAGE → content_filter with a `refusal`; a blocked prompt → content_filter with the block reason.
|
|
84
|
+
- `usage`: prompt tokens by modality (text incl. video and documents, image, audio), server-side tool prompt tokens as input, cache reads as `text.cached` (out of the input), candidate tokens by modality (image tokens as `image.tokens`, audio as `audio.output`), thoughts as `reasoning.output`, and hosted tool calls (`web_search` per query, `web_fetch`, `code_interpreter`).
|
|
85
|
+
- `citations` from grounding chunks and supports, byte offsets turned into character offsets.
|
|
86
|
+
- A context window overflow ends as `finishReason: 'length'`; a 400 naming a function declaration or the response schema becomes a `SchemaRejectedError`.
|
|
87
|
+
|
|
88
|
+
## Other operations
|
|
89
|
+
|
|
90
|
+
- `generateImage` / `editImage` (and streams): Gemini image models via `generateContent`, `n` calls for `n` images, `size` → nearest `aspectRatio` + `imageSize` (512/1K/2K/4K), `quality` → size; edits send image, references and a described mask before the prompt. Imagen on Vertex AI only.
|
|
91
|
+
- `speech`: Gemini TTS; WAV (default) or PCM out; `instructions`/`speed` → `speechMetadata.style` (3.8 TTS) or a spoken direction; voice ids (`voice_...`, `voicekey_...`) on 3.8.
|
|
92
|
+
- `transcribe` / `transcribeStream`: Gemini 3.5 Transcribe with `audioTranscriptionConfig` (`language` → `languageCodes`, `prompt` → custom vocabulary, `diarized_json` → diarization, `srt`/`vtt`/`verbose_json` → word timestamps and captions); other models are prompted to transcribe.
|
|
93
|
+
- `embed`: one content per input so each gets a vector; `dimensions` → `outputDimensionality`; `extra.taskType` (and `title`) on `gemini-embedding-001`, a task prefix on `gemini-embedding-2`; images on `gemini-embedding-2` only.
|
|
94
|
+
- `decide`: Gemini Decision 1 (`noul`/`choice`/`score`); conversations are serialized as text; a blocked input answers every question with `refusal`.
|
|
95
|
+
- `submitBatch` / `getBatch`: inlined requests.
|
|
96
|
+
- `countTokens(request)`, `createCache` / `deleteCache`, `uploadFile` / `deleteFile`, `listModels`, `checkHealth`.
|
|
97
|
+
- No `rerank` (Gemini has none).
|
|
98
|
+
|
|
99
|
+
## Gotchas
|
|
100
|
+
|
|
101
|
+
- Gemini 3.5 Flash-Lite, 3.6 Flash and later, and Gemini 4 silently ignore `temperature`/`topP`/`topK`; their `supportedParameters` leave them out. Gemini 3 models refuse penalties, `logprobs` and `candidateCount` (measured).
|
|
102
|
+
- Gemini 3.8 Flash and Gemini 4 have no `minimal` level; only Gemini 4 Neon and Hydrogen take `xhigh`.
|
|
103
|
+
- Gemini 4 has no explicit caching; implicit caching applies from 4,096 tokens.
|
|
104
|
+
- The 2.5 models answer 404 to new users; `gemini-2.5-pro`/`-flash` route to 3.8 Flash / 3.5 Flash-Lite from December 1, 2026.
|
|
105
|
+
- Measured support: `docs/measured/` in this package (`npm run matrix` re-runs it).
|
|
106
|
+
|
|
107
|
+
## Where the model rules live
|
|
108
|
+
|
|
109
|
+
The provider keeps no per-model rules, tables or id patterns. Everything it decides per model it reads from the model's `ModelInfo`:
|
|
110
|
+
|
|
111
|
+
- `supportedParameters`: sampling, penalties, seed, stop sequences, thinking (`reason`) and `serviceTier` are sent only when listed (`supportedRequest` from `@aeye/ai`, applied on the wire as well as by the ai layer);
|
|
112
|
+
- `reasoningEfforts`: the thinking levels a level model takes;
|
|
113
|
+
- `providerOptions.google` (`GoogleModelOptions`): `kind` (chat, image, imagen, tts, transcribe, embedding, decision), `thinking` (`level`, `budget` with its range and whether 0 turns it off, or `none`), `explicitCaching`, the Gemini 3 request features (`partMediaResolution`, `functionResponseParts`, `thoughtSignatures`, `serverToolInvocations`, `toolsWithOutput`), `image` (aspect ratios and sizes), `speech` (voices and style), `embedding` (sizes, multimodal) and `aliasOf`;
|
|
114
|
+
- `schema`: the schema rules (`{ base: 'google' }`).
|
|
115
|
+
|
|
116
|
+
That data is `@aeye/models`' `googleModels`: what models.list and the docs pages say (`packages/models/scraped/google.json`) with `packages/models/overrides/google.ts` merged in (family defaults, a few documented per-generation rules, corrections, and the live matrix's results in its `measured` block). Give it to the provider as `modelInfo`. A model the provider has no data for gets `defaultGoogleModel`: a current Gemini chat model that thinks by level and is sent nothing it isn't known to take (no sampling, penalties, service tier, explicit caching or Gemini 3 request features). To change one model, override its data (`modelOverrides`, or your own `modelInfo`):
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
const ai = AI.with().providers({ google }).create({
|
|
120
|
+
models: googleModels,
|
|
121
|
+
modelOverrides: [{ provider: 'google', modelId: 'gemini-3.8-flash', overrides: { providerOptions: { google: { explicitCaching: false } } } }],
|
|
122
|
+
});
|
|
123
|
+
```
|
package/dist/convert.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type AudioFormat, type Chunk, type Citation, type FinishReason, type HostedTool, type HostedToolType, type Reason, type ReasoningDetail, type ReasoningEffort, type ServiceTier, type Usage } from '@aeye/core';
|
|
9
9
|
import type { Candidate, GenerateContentResponse, GenerateContentResponseUsageMetadata, GroundingMetadata, Part, ThinkingConfig, Tool } from '@google/genai';
|
|
10
|
-
import type { GoogleModelOptions } from './models';
|
|
10
|
+
import type { GoogleModelOptions } from './models.js';
|
|
11
11
|
/**
|
|
12
12
|
* The provider name, which marks the reasoning (thought signatures) Gemini
|
|
13
13
|
* produces so other providers don't replay it.
|
package/dist/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,MAAM,EAEX,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,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AAe,EAAE,GAAG,SAAS,GAAG,iBAAiB,CAiBzF"}
|
package/dist/convert.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* stream reuses the same mapping.
|
|
7
7
|
*/
|
|
8
8
|
import { clampReasoningEffort } from '@aeye/ai';
|
|
9
|
-
import { GoogleError } from './types';
|
|
9
|
+
import { GoogleError } from './types.js';
|
|
10
10
|
/**
|
|
11
11
|
* The provider name, which marks the reasoning (thought signatures) Gemini
|
|
12
12
|
* produces so other providers don't replay it.
|