llm-gemini 0.26__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.26
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
@@ -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
@@ -207,6 +207,11 @@ def cleanup_schema(schema, in_properties=False):
207
207
  "Gemini supports only a subset of JSON schema"
208
208
  keys_to_remove = ("$schema", "additionalProperties", "title")
209
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
+
210
215
  if isinstance(schema, dict):
211
216
  # Only remove keys if we're not inside a 'properties' block.
212
217
  if not in_properties:
@@ -224,6 +229,26 @@ def cleanup_schema(schema, in_properties=False):
224
229
  return schema
225
230
 
226
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
+
227
252
  class _SharedGemini:
228
253
  needs_key = "gemini"
229
254
  key_env_var = "LLM_GEMINI_KEY"
@@ -1,7 +0,0 @@
1
- llm_gemini.py,sha256=KQX_Yb-YG5_-SK1Aq5wdvDHkKg8Mdz42JbtI5RFO9wA,24779
2
- llm_gemini-0.26.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
- llm_gemini-0.26.dist-info/METADATA,sha256=UcYMTtjFQhHeBhWyRW2RRAJMkcy_H1rz0tkXZqp4sCM,11947
4
- llm_gemini-0.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- llm_gemini-0.26.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
- llm_gemini-0.26.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
- llm_gemini-0.26.dist-info/RECORD,,