Skip to content

Commit 4d3bbf5

Browse files
committed
Release v0.8.6: Update default models to Gemini 2.5 generation
Update all default model references from gemini-2.0 to gemini-2.5 generation throughout the codebase. This aligns the library with Google's current stable model recommendations while maintaining full backward compatibility with previous generation models. Core Configuration Changes: - Update default_universal from gemini-2.0-flash-lite to gemini-2.5-flash-lite in lib/gemini/config.ex - Update Vertex AI default model from gemini-2.0-flash-lite to gemini-2.5-flash-lite - Update default model alias in vertex_ai_models map Library Docstring Updates: - lib/gemini/apis/batches.ex: Update 5 example references - lib/gemini/apis/context_cache.ex: Update 2 example references - lib/gemini/live/session.ex: Update 4 example references - lib/gemini/live/message.ex: Update 1 example reference - lib/gemini/types/live.ex: Update 1 example reference - lib/gemini/types/batch.ex: Update 1 example reference - lib/gemini/config.ex: Update documentation examples Test File Updates: - test/gemini/live/session_test.exs: 23 occurrences updated - test/gemini/apis/system_instruction_live_test.exs: 14 occurrences - test/gemini/apis/coordinator_system_instruction_test.exs: 5 updates - test/gemini/tools/function_calling_live_test.exs: 8 occurrences - test/live_api/live_session_live_test.exs: 5 occurrences - test/live_api/files_live_test.exs: 1 occurrence - test/support/model_helpers.ex: Update defaults and helper functions Documentation Guide Updates: - docs/guides/live_api.md: 13 occurrences updated to gemini-2.5-flash - docs/guides/batches.md: 7 occurrences updated - docs/guides/adc.md: 1 occurrence updated README and Configuration: - README.md: Update 3 model references in examples - config/config.exs: Update Vertex AI default comment - examples/07_model_info.exs: Update model comparison list to use 2.5 and 3.x generation models Planning Documentation Added: - docs/20251220/01_MODEL_CLEANUP_PLAN.md: Comprehensive cleanup plan - docs/20251220/02_README_UPDATE_PLAN.md: README restructure proposal - docs/20251220/03_IMPLEMENTATION_SUMMARY.md: Implementation summary Backward Compatibility Notes: All gemini-2.0 model keys remain in the manifest and can be explicitly requested via model option. The get_model function continues to support :flash_2_0 and :flash_2_0_lite keys. Context caching remains fully supported for 2.0 models. No breaking changes for existing codebases using 2.0 models explicitly. Files Intentionally Unchanged: - lib/gemini/config.ex model definitions (lines 85-91) - lib/gemini/apis/context_cache.ex valid models list - test/gemini/apis/interactions_test.exs (mock test data) - test/gemini/apis/batches_test.exs (mock test data) - CHANGELOG.md (historical record) - docs/20251218/docs_models.md (official Google reference) Statistics: 21 files modified, 107 model reference occurrences updated
1 parent 3df6965 commit 4d3bbf5

23 files changed

+1186
-109
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ alias Gemini.Live.Session
212212

213213
{:ok, pid} =
214214
Session.start_link(
215-
model: "gemini-2.0-flash-exp",
215+
model: "gemini-2.5-flash",
216216
auth: :vertex_ai,
217217
on_message: fn msg -> IO.inspect(msg, label: "live message") end,
218218
on_error: fn err -> IO.inspect(err, label: "live error") end
@@ -488,7 +488,7 @@ alias Gemini.Types.BatchJob
488488
{:ok, input} = Files.upload("requests.jsonl")
489489

490490
# 2. Create batch job
491-
{:ok, batch} = Batches.create("gemini-2.0-flash",
491+
{:ok, batch} = Batches.create("gemini-2.5-flash",
492492
file_name: input.name,
493493
display_name: "My Batch"
494494
)
@@ -1262,7 +1262,7 @@ Gemini.Config.default_model() #=> "gemini-flash-lite-latest"
12621262
Gemini.Config.default_embedding_model() #=> "gemini-embedding-001"
12631263

12641264
# With VERTEX_PROJECT_ID set (no GEMINI_API_KEY):
1265-
Gemini.Config.default_model() #=> "gemini-2.0-flash-lite"
1265+
Gemini.Config.default_model() #=> "gemini-2.5-flash-lite"
12661266
Gemini.Config.default_embedding_model() #=> "embeddinggemma"
12671267
```
12681268

config/config.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Config
44
config :gemini_ex,
55
# Default model is auto-detected based on authentication:
66
# - Gemini API (GEMINI_API_KEY): "gemini-flash-lite-latest"
7-
# - Vertex AI (VERTEX_PROJECT_ID): "gemini-2.0-flash-lite"
7+
# - Vertex AI (VERTEX_PROJECT_ID): "gemini-2.5-flash-lite"
88
# Uncomment to override: default_model: "your-model-name",
99

1010
# HTTP timeout in milliseconds
Lines changed: 336 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
# Model Reference Cleanup Plan
2+
3+
**Date**: 2025-12-20
4+
**Status**: Ready for Implementation
5+
**Estimated Effort**: 4-5 hours total
6+
7+
## Executive Summary
8+
9+
This document outlines a comprehensive plan to update obsolete `gemini-2.0` model references throughout the codebase. While Gemini 2.0 models remain valid and supported as "Previous Generation" models, the defaults and examples should be updated to use current-generation Gemini 2.5 and Gemini 3 models.
10+
11+
## Current State Analysis
12+
13+
### Model Generations (from Google's official documentation)
14+
15+
| Generation | Models | Status | Recommended Use |
16+
|------------|--------|--------|-----------------|
17+
| **Gemini 3** | `gemini-3-pro-preview`, `gemini-3-flash-preview`, `gemini-3-pro-image-preview` | Preview | Cutting-edge, latest capabilities |
18+
| **Gemini 2.5** | `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite` | **Stable (GA)** | **Production recommended** |
19+
| **Gemini 2.0** | `gemini-2.0-flash`, `gemini-2.0-flash-lite` | Previous Gen | Backward compatibility only |
20+
21+
### Current Manifest Status (`lib/gemini/config.ex`)
22+
23+
The manifest **already includes** all current models correctly:
24+
25+
```elixir
26+
# Gemini 3 models (preview) - ✓ Present
27+
pro_3_preview: "gemini-3-pro-preview",
28+
flash_3_preview: "gemini-3-flash-preview",
29+
30+
# Gemini 2.5 models (GA) - ✓ Present
31+
pro_2_5: "gemini-2.5-pro",
32+
flash_2_5: "gemini-2.5-flash",
33+
flash_2_5_lite: "gemini-2.5-flash-lite",
34+
35+
# Aliases - ✓ Correct
36+
latest: "gemini-3-pro-preview",
37+
stable: "gemini-2.5-pro"
38+
```
39+
40+
**Problem**: Default models still point to 2.0 generation:
41+
```elixir
42+
# NEEDS UPDATE - Line 143
43+
@default_generation_models %{
44+
gemini: "gemini-flash-lite-latest", # OK - Uses -latest alias
45+
vertex_ai: "gemini-2.0-flash-lite" # OUTDATED
46+
}
47+
48+
# NEEDS UPDATE - Line 97
49+
default_universal: "gemini-2.0-flash-lite" # OUTDATED
50+
```
51+
52+
---
53+
54+
## Reference Inventory
55+
56+
### Category 1: Core Library Code (lib/)
57+
58+
| File | Line(s) | Current Value | Action |
59+
|------|---------|---------------|--------|
60+
| `lib/gemini/config.ex` | 143 | `vertex_ai: "gemini-2.0-flash-lite"` | **UPDATE** to `"gemini-2.5-flash-lite"` |
61+
| `lib/gemini/config.ex` | 97 | `default_universal: "gemini-2.0-flash-lite"` | **UPDATE** to `"gemini-2.5-flash-lite"` |
62+
| `lib/gemini/config.ex` | 85-91 | Gemini 2.0 model definitions | **KEEP** - Valid for backward compat |
63+
| `lib/gemini/apis/context_cache.ex` | 530-531 | 2.0 models in valid list | **KEEP** - Still cacheable |
64+
| `lib/gemini/apis/batches.ex` | Multiple | Examples in docstrings | **UPDATE** examples |
65+
| `lib/gemini/live/session.ex` | Multiple | `"gemini-2.0-flash-exp"` in docs | **UPDATE** examples |
66+
| `lib/gemini/live/message.ex` | 21 | Example with 2.0 | **UPDATE** example |
67+
| `lib/gemini/types/batch.ex` | 26 | Example with 2.0 | **UPDATE** example |
68+
| `lib/gemini/types/live.ex` | 19 | Example with 2.0 | **UPDATE** example |
69+
| `lib/gemini/client/http.ex` | 339, 348 | Comment references | **KEEP** - Just documentation |
70+
71+
### Category 2: Test Files (test/)
72+
73+
| File | Occurrences | Current Model | Action |
74+
|------|-------------|---------------|--------|
75+
| `test/gemini/live/session_test.exs` | 23 | `"gemini-2.0-flash-exp"` | **UPDATE** to use helper or `"gemini-2.5-flash"` |
76+
| `test/gemini/apis/system_instruction_live_test.exs` | 8 | `"gemini-2.0-flash"` | **UPDATE** to use helper |
77+
| `test/gemini/tools/function_calling_live_test.exs` | 6 | `"gemini-2.0-flash"` | **UPDATE** to use helper |
78+
| `test/gemini/apis/interactions_test.exs` | 9 | `"models/gemini-2.0-flash"` | **KEEP** - Mock tests with known format |
79+
| `test/gemini/apis/batches_test.exs` | 2 | Mock test data | **KEEP** - Mock data |
80+
| `test/live_api/live_session_live_test.exs` | 5 | `"gemini-2.0-flash-exp"` | **UPDATE** |
81+
| `test/live_api/files_live_test.exs` | 1 | `"gemini-2.0-flash-lite"` | **UPDATE** |
82+
| `test/support/model_helpers.ex` | Multiple | Documentation refs | **UPDATE** docs |
83+
84+
### Category 3: Documentation (docs/)
85+
86+
| File | Status | Action |
87+
|------|--------|--------|
88+
| `docs/guides/live_api.md` | 13 occurrences | **UPDATE** all examples |
89+
| `docs/guides/batches.md` | 5 occurrences | **UPDATE** examples |
90+
| `docs/guides/adc.md` | 1 occurrence | **UPDATE** example |
91+
| `docs/20251218/docs_models.md` | Full 2.0 section | **KEEP** - Official Google docs |
92+
| `docs/20251204/...` | Implementation plans | **KEEP** - Historical |
93+
| `docs/20251205/...` | Gap analysis | **KEEP** - Historical |
94+
| `docs/20251206/...` | Gap analysis | **KEEP** - Historical |
95+
96+
### Category 4: Configuration & Root Files
97+
98+
| File | Location | Action |
99+
|------|----------|--------|
100+
| `config/config.exs` | Line 7 (comment) | **UPDATE** comment |
101+
| `README.md` | Lines 215, 386-387, 491, 1265 | **UPDATE** in README rewrite |
102+
| `CHANGELOG.md` | Multiple | **KEEP** - Historical record |
103+
104+
---
105+
106+
## Implementation Plan
107+
108+
### Phase 1: Critical Default Updates (15 minutes)
109+
110+
**File: `lib/gemini/config.ex`**
111+
112+
#### Change 1: Update Vertex AI Default (Line 143)
113+
```elixir
114+
# Before
115+
@default_generation_models %{
116+
gemini: "gemini-flash-lite-latest",
117+
vertex_ai: "gemini-2.0-flash-lite"
118+
}
119+
120+
# After
121+
@default_generation_models %{
122+
gemini: "gemini-flash-lite-latest",
123+
vertex_ai: "gemini-2.5-flash-lite"
124+
}
125+
```
126+
127+
#### Change 2: Update Default Universal (Line 97)
128+
```elixir
129+
# Before
130+
default_universal: "gemini-2.0-flash-lite",
131+
132+
# After
133+
default_universal: "gemini-2.5-flash-lite",
134+
```
135+
136+
#### Change 3: Add Clarifying Comment (Line 84)
137+
```elixir
138+
# Gemini 2.0 models (Previous Generation - still valid, retained for backward compatibility)
139+
flash_2_0: "gemini-2.0-flash",
140+
...
141+
```
142+
143+
### Phase 2: Update Model Helpers (30 minutes)
144+
145+
**File: `test/support/model_helpers.ex`**
146+
147+
Add new helper functions:
148+
149+
```elixir
150+
@doc """
151+
Returns the recommended model for Live API tests.
152+
Uses gemini-2.5-flash for stable real-time capabilities.
153+
"""
154+
@spec live_test_model() :: String.t()
155+
def live_test_model, do: "gemini-2.5-flash"
156+
157+
@doc """
158+
Returns the recommended model for function calling tests.
159+
"""
160+
@spec function_calling_model() :: String.t()
161+
def function_calling_model, do: "gemini-2.5-flash"
162+
163+
@doc """
164+
Returns the recommended lite model for cost-sensitive tests.
165+
"""
166+
@spec lite_test_model() :: String.t()
167+
def lite_test_model, do: "gemini-2.5-flash-lite"
168+
```
169+
170+
Update documentation to reference 2.5 as current:
171+
```elixir
172+
@moduledoc """
173+
...
174+
## Model Recommendations
175+
176+
For new tests, prefer these current-generation models:
177+
- **Standard**: `gemini-2.5-flash` - Best balance of capability and speed
178+
- **Lite**: `gemini-2.5-flash-lite` - Cost-efficient, high throughput
179+
- **Pro**: `gemini-2.5-pro` - Advanced reasoning
180+
181+
Previous generation models (gemini-2.0-*) remain available for backward compatibility.
182+
"""
183+
```
184+
185+
### Phase 3: Update Test Files (2 hours)
186+
187+
#### Priority 1: Live Session Tests
188+
**File: `test/gemini/live/session_test.exs`**
189+
190+
Replace 23 occurrences of `"gemini-2.0-flash-exp"` with:
191+
- Direct: `"gemini-2.5-flash"`
192+
- Or: `ModelHelpers.live_test_model()`
193+
194+
Example transformation:
195+
```elixir
196+
# Before
197+
assert {:ok, pid} = Session.start_link(model: "gemini-2.0-flash-exp")
198+
199+
# After
200+
assert {:ok, pid} = Session.start_link(model: "gemini-2.5-flash")
201+
```
202+
203+
#### Priority 2: System Instruction Tests
204+
**File: `test/gemini/apis/system_instruction_live_test.exs`**
205+
206+
Replace 8 occurrences:
207+
```elixir
208+
# Before
209+
opts = [model: "gemini-2.0-flash"]
210+
211+
# After
212+
opts = [model: "gemini-2.5-flash"]
213+
```
214+
215+
#### Priority 3: Function Calling Tests
216+
**File: `test/gemini/tools/function_calling_live_test.exs`**
217+
218+
Replace 6 occurrences similarly.
219+
220+
#### Priority 4: Live API Tests
221+
**File: `test/live_api/live_session_live_test.exs`** (5 occurrences)
222+
**File: `test/live_api/files_live_test.exs`** (1 occurrence)
223+
224+
### Phase 4: Update Documentation Examples (1.5 hours)
225+
226+
#### High Priority: Live API Guide
227+
**File: `docs/guides/live_api.md`** (13 occurrences)
228+
229+
```elixir
230+
# Before (throughout file)
231+
model: "gemini-2.0-flash-exp",
232+
233+
# After
234+
model: "gemini-2.5-flash",
235+
```
236+
237+
#### Medium Priority: Batches Guide
238+
**File: `docs/guides/batches.md`** (5 occurrences)
239+
240+
```elixir
241+
# Before
242+
{:ok, batch} = Batches.create("gemini-2.0-flash", ...)
243+
244+
# After
245+
{:ok, batch} = Batches.create("gemini-2.5-flash", ...)
246+
```
247+
248+
#### Low Priority: ADC Guide
249+
**File: `docs/guides/adc.md`** (1 occurrence)
250+
251+
### Phase 5: Update Library Docstrings (45 minutes)
252+
253+
Update examples in:
254+
- `lib/gemini/live/session.ex` - Replace `"gemini-2.0-flash-exp"` with `"gemini-2.5-flash"`
255+
- `lib/gemini/live/message.ex` - Same
256+
- `lib/gemini/apis/batches.ex` - Replace `"gemini-2.0-flash"` with `"gemini-2.5-flash"`
257+
- `lib/gemini/types/batch.ex` - Same
258+
- `lib/gemini/types/live.ex` - Same
259+
260+
### Phase 6: Update Config Comment (5 minutes)
261+
262+
**File: `config/config.exs`**
263+
264+
```elixir
265+
# Before (Line 7)
266+
# - Vertex AI (VERTEX_PROJECT_ID): "gemini-2.0-flash-lite"
267+
268+
# After
269+
# - Vertex AI (VERTEX_PROJECT_ID): "gemini-2.5-flash-lite"
270+
```
271+
272+
---
273+
274+
## Files to NOT Modify
275+
276+
1. **`docs/20251218/docs_models.md`** - Contains official Google documentation including "Previous Gemini models" section
277+
2. **`CHANGELOG.md`** - Historical record of changes
278+
3. **`lib/gemini/config.ex` lines 85-91** - Gemini 2.0 model definitions (still valid, needed for backward compatibility)
279+
4. **`lib/gemini/apis/context_cache.ex` valid models list** - 2.0 models are still cacheable
280+
5. **`test/gemini/apis/interactions_test.exs`** - Mock tests with stable test data
281+
6. **`test/gemini/apis/batches_test.exs`** - Mock tests with stable test data
282+
7. **Historical docs in `docs/202511**/` - Implementation history
283+
284+
---
285+
286+
## Verification Checklist
287+
288+
After implementation, verify:
289+
290+
- [ ] `mix compile` - No warnings related to models
291+
- [ ] `mix test` - All tests pass
292+
- [ ] `mix test --only live` - Live API tests work with new models
293+
- [ ] Default model check:
294+
```elixir
295+
iex> Gemini.Config.default_model()
296+
# Should show gemini-2.5-flash-lite or gemini-flash-lite-latest
297+
298+
iex> Gemini.Config.default_model_for(:vertex_ai)
299+
"gemini-2.5-flash-lite"
300+
```
301+
- [ ] Existing 2.0 models still work:
302+
```elixir
303+
iex> Gemini.generate("Hi", model: "gemini-2.0-flash")
304+
{:ok, ...} # Should still work
305+
```
306+
307+
---
308+
309+
## Summary Table
310+
311+
| Phase | Description | Files | Effort | Priority |
312+
|-------|-------------|-------|--------|----------|
313+
| 1 | Critical Defaults | `lib/gemini/config.ex` | 15 min | **CRITICAL** |
314+
| 2 | Model Helpers | `test/support/model_helpers.ex` | 30 min | HIGH |
315+
| 3 | Test Files | 6 test files | 2 hrs | HIGH |
316+
| 4 | Documentation | 3 guide files | 1.5 hrs | MEDIUM |
317+
| 5 | Library Docstrings | 5 lib files | 45 min | MEDIUM |
318+
| 6 | Config Comment | `config/config.exs` | 5 min | LOW |
319+
320+
**Total Estimated Effort**: 4.5 - 5 hours
321+
322+
---
323+
324+
## Backward Compatibility Notes
325+
326+
- All `gemini-2.0-*` model keys remain in the manifest
327+
- Users can still explicitly request 2.0 models via `model: "gemini-2.0-flash"`
328+
- The `get_model(:flash_2_0)` function continues to work
329+
- Context caching supports 2.0 models
330+
- No breaking changes for existing codebases using 2.0 models explicitly
331+
332+
## References
333+
334+
- Google Gemini Models Documentation: `docs/20251218/docs_models.md`
335+
- Model Manifest: `lib/gemini/config.ex` lines 59-126
336+
- Test Helpers: `test/support/model_helpers.ex`

0 commit comments

Comments
 (0)