llm-gemini 0.25__py3-none-any.whl → 0.26.1__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llm-gemini
3
- Version: 0.25
3
+ Version: 0.26.1
4
4
  Summary: LLM plugin to access Google's Gemini family of models
5
5
  Author: Simon Willison
6
6
  License-Expression: Apache-2.0
@@ -10,7 +10,7 @@ Project-URL: Issues, https://github.com/simonw/llm-gemini/issues
10
10
  Project-URL: CI, https://github.com/simonw/llm-gemini/actions
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: llm>=0.26
13
+ Requires-Dist: llm>=0.27
14
14
  Requires-Dist: httpx
15
15
  Requires-Dist: ijson
16
16
  Provides-Extra: test
@@ -75,6 +75,9 @@ result = runner.invoke(cli.cli, ["models", "-q", "gemini/"])
75
75
  lines = reversed(result.output.strip().split("\n"))
76
76
  to_output = []
77
77
  NOTES = {
78
+ "gemini/gemini-flash-latest": "Latest Gemini Flash",
79
+ "gemini/gemini-flash-lite-latest": "Latest Gemini Flash Lite",
80
+ "gemini/gemini-2.5-flash": "Gemini 2.5 Flash",
78
81
  "gemini/gemini-2.5-pro": "Gemini 2.5 Pro",
79
82
  "gemini/gemini-2.5-flash": "Gemini 2.5 Flash",
80
83
  "gemini/gemini-2.5-flash-lite": "Gemini 2.5 Flash Lite",
@@ -93,6 +96,10 @@ for line in lines:
93
96
  )
94
97
  cog.out("\n".join(to_output))
95
98
  ]]] -->
99
+ - `gemini/gemini-2.5-flash-lite-preview-09-2025`
100
+ - `gemini/gemini-2.5-flash-preview-09-2025`
101
+ - `gemini/gemini-flash-lite-latest`: Latest Gemini Flash Lite
102
+ - `gemini/gemini-flash-latest`: Latest Gemini Flash
96
103
  - `gemini/gemini-2.5-flash-lite`: Gemini 2.5 Flash Lite
97
104
  - `gemini/gemini-2.5-pro`: Gemini 2.5 Pro
98
105
  - `gemini/gemini-2.5-flash`: Gemini 2.5 Flash
@@ -0,0 +1,7 @@
1
+ llm_gemini.py,sha256=Vfc-zIRxYL81JDGtbu-GNLDlCmbcHUXZT84w2adrRjw,25748
2
+ llm_gemini-0.26.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
+ llm_gemini-0.26.1.dist-info/METADATA,sha256=YtjWlmRIImrzbxjghVYMYcUw8OBCkpu3toXo59oGvZg,11949
4
+ llm_gemini-0.26.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ llm_gemini-0.26.1.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
+ llm_gemini-0.26.1.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
+ llm_gemini-0.26.1.dist-info/RECORD,,
llm_gemini.py CHANGED
@@ -45,6 +45,10 @@ GOOGLE_SEARCH_MODELS = {
45
45
  "gemini-2.5-pro",
46
46
  "gemini-2.5-flash",
47
47
  "gemini-2.5-flash-lite",
48
+ "gemini-flash-latest",
49
+ "gemini-flash-lite-latest",
50
+ "gemini-2.5-flash-preview-09-2025",
51
+ "gemini-2.5-flash-lite-preview-09-2025",
48
52
  }
49
53
 
50
54
  # Older Google models used google_search_retrieval instead of google_search
@@ -70,6 +74,10 @@ THINKING_BUDGET_MODELS = {
70
74
  "gemini-2.5-pro",
71
75
  "gemini-2.5-flash",
72
76
  "gemini-2.5-flash-lite",
77
+ "gemini-flash-latest",
78
+ "gemini-flash-lite-latest",
79
+ "gemini-2.5-flash-preview-09-2025",
80
+ "gemini-2.5-flash-lite-preview-09-2025",
73
81
  }
74
82
 
75
83
  NO_VISION_MODELS = {"gemma-3-1b-it", "gemma-3n-e4b-it"}
@@ -156,6 +164,11 @@ def register_models(register):
156
164
  "gemini-2.5-pro",
157
165
  # 22nd July 2025:
158
166
  "gemini-2.5-flash-lite",
167
+ # 25th Spetember 2025:
168
+ "gemini-flash-latest",
169
+ "gemini-flash-lite-latest",
170
+ "gemini-2.5-flash-preview-09-2025",
171
+ "gemini-2.5-flash-lite-preview-09-2025",
159
172
  ):
160
173
  can_google_search = model_id in GOOGLE_SEARCH_MODELS
161
174
  can_thinking_budget = model_id in THINKING_BUDGET_MODELS
@@ -194,6 +207,11 @@ def cleanup_schema(schema, in_properties=False):
194
207
  "Gemini supports only a subset of JSON schema"
195
208
  keys_to_remove = ("$schema", "additionalProperties", "title")
196
209
 
210
+ # First pass: resolve $ref references using $defs
211
+ if isinstance(schema, dict) and "$defs" in schema:
212
+ defs = schema.pop("$defs")
213
+ _resolve_refs(schema, defs)
214
+
197
215
  if isinstance(schema, dict):
198
216
  # Only remove keys if we're not inside a 'properties' block.
199
217
  if not in_properties:
@@ -211,6 +229,26 @@ def cleanup_schema(schema, in_properties=False):
211
229
  return schema
212
230
 
213
231
 
232
+ def _resolve_refs(schema, defs):
233
+ """Recursively resolve $ref references in schema using definitions."""
234
+ if isinstance(schema, dict):
235
+ if "$ref" in schema:
236
+ # Extract the reference path (e.g., "#/$defs/Dog" -> "Dog")
237
+ ref_path = schema.pop("$ref")
238
+ if ref_path.startswith("#/$defs/"):
239
+ def_name = ref_path.split("/")[-1]
240
+ if def_name in defs:
241
+ # Replace the $ref with the actual definition
242
+ schema.update(copy.deepcopy(defs[def_name]))
243
+
244
+ # Recursively resolve refs in nested structures
245
+ for value in schema.values():
246
+ _resolve_refs(value, defs)
247
+ elif isinstance(schema, list):
248
+ for item in schema:
249
+ _resolve_refs(item, defs)
250
+
251
+
214
252
  class _SharedGemini:
215
253
  needs_key = "gemini"
216
254
  key_env_var = "LLM_GEMINI_KEY"
@@ -543,6 +581,8 @@ class GeminiPro(_SharedGemini, llm.KeyModel):
543
581
  gathered.append(event)
544
582
  events.clear()
545
583
  response.response_json = gathered[-1]
584
+ resolved_model = gathered[-1]["modelVersion"]
585
+ response.set_resolved_model(resolved_model)
546
586
  self.set_usage(response)
547
587
 
548
588
 
@@ -1,7 +0,0 @@
1
- llm_gemini.py,sha256=uItceU020Z6RMurfvvBCnQ25dfxfr-V_dW1h0YsLBOM,24194
2
- llm_gemini-0.25.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
- llm_gemini-0.25.dist-info/METADATA,sha256=sFpTVF87sHt8ldPlmTteoZ-Yg1KDIDmVgztjAshWKGA,11565
4
- llm_gemini-0.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- llm_gemini-0.25.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
- llm_gemini-0.25.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
- llm_gemini-0.25.dist-info/RECORD,,