llm-gemini 0.10__py3-none-any.whl → 0.12__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.2
2
2
  Name: llm-gemini
3
- Version: 0.10
3
+ Version: 0.12
4
4
  Summary: LLM plugin to access Google's Gemini family of models
5
5
  Author: Simon Willison
6
6
  License: Apache-2.0
@@ -11,12 +11,13 @@ Project-URL: CI, https://github.com/simonw/llm-gemini/actions
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: llm>=0.19
14
+ Requires-Dist: llm>=0.22
15
15
  Requires-Dist: httpx
16
16
  Requires-Dist: ijson
17
17
  Provides-Extra: test
18
18
  Requires-Dist: pytest; extra == "test"
19
19
  Requires-Dist: pytest-recording; extra == "test"
20
+ Requires-Dist: nest-asyncio; extra == "test"
20
21
 
21
22
  # llm-gemini
22
23
 
@@ -68,7 +69,7 @@ Other models are:
68
69
  - `gemini-2.0-flash-thinking-exp-1219` - experimental "thinking" model from December 2024
69
70
  - `gemini-2.0-flash-thinking-exp-01-21` - experimental "thinking" model from January 2025
70
71
  - `gemini-2.0-flash` - Gemini 2.0 Flash
71
- - `gemini-2.0-flash-lite-preview-02-05` - Gemini 2.0 Flash-Lite
72
+ - `gemini-2.0-flash-lite` - Gemini 2.0 Flash-Lite
72
73
  - `gemini-2.0-pro-exp-02-05` - experimental release of Gemini 2.0 Pro
73
74
 
74
75
  ### Images, audio and video
@@ -0,0 +1,7 @@
1
+ llm_gemini.py,sha256=er-6W-CJEOZdC0O6iBYkWsAstlYhtYASkQUXfqhE7Wk,12916
2
+ llm_gemini-0.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
+ llm_gemini-0.12.dist-info/METADATA,sha256=CKh9OfBqO_Ep7NU2eyGMnkDyuqwnOaBA-geYJpCugac,7014
4
+ llm_gemini-0.12.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
5
+ llm_gemini-0.12.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
+ llm_gemini-0.12.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
+ llm_gemini-0.12.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
llm_gemini.py CHANGED
@@ -32,6 +32,7 @@ GOOGLE_SEARCH_MODELS = {
32
32
  "gemini-1.5-pro-002",
33
33
  "gemini-1.5-flash-002",
34
34
  "gemini-2.0-flash-exp",
35
+ "gemini-2.0-flash",
35
36
  }
36
37
 
37
38
 
@@ -57,8 +58,9 @@ def register_models(register):
57
58
  "gemini-2.0-flash-thinking-exp-01-21",
58
59
  # Released 5th Feb 2025:
59
60
  "gemini-2.0-flash",
60
- "gemini-2.0-flash-lite-preview-02-05",
61
61
  "gemini-2.0-pro-exp-02-05",
62
+ # Released 25th Feb 2025:
63
+ "gemini-2.0-flash-lite",
62
64
  ]:
63
65
  can_google_search = model_id in GOOGLE_SEARCH_MODELS
64
66
  register(
@@ -220,7 +222,7 @@ class _SharedGemini:
220
222
  if prompt.options and prompt.options.code_execution:
221
223
  body["tools"] = [{"codeExecution": {}}]
222
224
  if prompt.options and self.can_google_search and prompt.options.google_search:
223
- body["tools"] = [{"google_search_retrieval": {}}]
225
+ body["tools"] = [{"google_search": {}}]
224
226
  if prompt.system:
225
227
  body["systemInstruction"] = {"parts": [{"text": prompt.system}]}
226
228
 
@@ -268,9 +270,8 @@ class _SharedGemini:
268
270
  pass
269
271
 
270
272
 
271
- class GeminiPro(_SharedGemini, llm.Model):
272
- def execute(self, prompt, stream, response, conversation):
273
- key = self.get_key()
273
+ class GeminiPro(_SharedGemini, llm.KeyModel):
274
+ def execute(self, prompt, stream, response, conversation, key):
274
275
  url = f"https://generativelanguage.googleapis.com/v1beta/models/{self.model_id}:streamGenerateContent"
275
276
  gathered = []
276
277
  body = self.build_request_body(prompt, conversation)
@@ -279,7 +280,7 @@ class GeminiPro(_SharedGemini, llm.Model):
279
280
  "POST",
280
281
  url,
281
282
  timeout=None,
282
- headers={"x-goog-api-key": key},
283
+ headers={"x-goog-api-key": self.get_key(key)},
283
284
  json=body,
284
285
  ) as http_response:
285
286
  events = ijson.sendable_list()
@@ -301,9 +302,8 @@ class GeminiPro(_SharedGemini, llm.Model):
301
302
  self.set_usage(response)
302
303
 
303
304
 
304
- class AsyncGeminiPro(_SharedGemini, llm.AsyncModel):
305
- async def execute(self, prompt, stream, response, conversation):
306
- key = self.get_key()
305
+ class AsyncGeminiPro(_SharedGemini, llm.AsyncKeyModel):
306
+ async def execute(self, prompt, stream, response, conversation, key):
307
307
  url = f"https://generativelanguage.googleapis.com/v1beta/models/{self.model_id}:streamGenerateContent"
308
308
  gathered = []
309
309
  body = self.build_request_body(prompt, conversation)
@@ -313,7 +313,7 @@ class AsyncGeminiPro(_SharedGemini, llm.AsyncModel):
313
313
  "POST",
314
314
  url,
315
315
  timeout=None,
316
- headers={"x-goog-api-key": key},
316
+ headers={"x-goog-api-key": self.get_key(key)},
317
317
  json=body,
318
318
  ) as http_response:
319
319
  events = ijson.sendable_list()
@@ -1,7 +0,0 @@
1
- llm_gemini.py,sha256=JC7QoAvcH-JDCZDuFRtivqJ7aCXOLvWxST6zv6tG79E,12896
2
- llm_gemini-0.10.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
- llm_gemini-0.10.dist-info/METADATA,sha256=pQ3PVDQtW23dMmfUe24V0NZ7cPS9oDgmS21Ug9ncfuo,6983
4
- llm_gemini-0.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
5
- llm_gemini-0.10.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
- llm_gemini-0.10.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
- llm_gemini-0.10.dist-info/RECORD,,