llm-gemini 0.18__py3-none-any.whl → 0.18.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.18
3
+ Version: 0.18.1
4
4
  Summary: LLM plugin to access Google's Gemini family of models
5
5
  Author: Simon Willison
6
6
  License: Apache-2.0
@@ -0,0 +1,7 @@
1
+ llm_gemini.py,sha256=mPnnJ5gWU1NS8cxmq2JDiKGq7tXaP1oz7lsMtRv3Ae4,18319
2
+ llm_gemini-0.18.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
+ llm_gemini-0.18.1.dist-info/METADATA,sha256=Y6sJT4JCMXtnk6zP6EaQ6mEEZYL7vwfwOg04IdTI6UU,8049
4
+ llm_gemini-0.18.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
5
+ llm_gemini-0.18.1.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
+ llm_gemini-0.18.1.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
+ llm_gemini-0.18.1.dist-info/RECORD,,
llm_gemini.py CHANGED
@@ -36,7 +36,21 @@ GOOGLE_SEARCH_MODELS = {
36
36
  "gemini-1.5-flash-002",
37
37
  "gemini-2.0-flash-exp",
38
38
  "gemini-2.0-flash",
39
+ "gemini-2.5-pro-preview-03-25",
40
+ "gemini-2.5-pro-exp-03-25",
39
41
  }
42
+
43
+ # Older Google models used google_search_retrieval instead of google_search
44
+ GOOGLE_SEARCH_MODELS_USING_SEARCH_RETRIEVAL = {
45
+ "gemini-1.5-pro-latest",
46
+ "gemini-1.5-flash-latest",
47
+ "gemini-1.5-pro-001",
48
+ "gemini-1.5-flash-001",
49
+ "gemini-1.5-pro-002",
50
+ "gemini-1.5-flash-002",
51
+ "gemini-2.0-flash-exp",
52
+ }
53
+
40
54
  THINKING_BUDGET_MODELS = {
41
55
  "gemini-2.5-flash-preview-04-17",
42
56
  }
@@ -285,7 +299,12 @@ class _SharedGemini:
285
299
  if prompt.options and prompt.options.code_execution:
286
300
  body["tools"] = [{"codeExecution": {}}]
287
301
  if prompt.options and self.can_google_search and prompt.options.google_search:
288
- body["tools"] = [{"google_search": {}}]
302
+ tool_name = (
303
+ "google_search_retrieval"
304
+ if self.model_id in GOOGLE_SEARCH_MODELS_USING_SEARCH_RETRIEVAL
305
+ else "google_search"
306
+ )
307
+ body["tools"] = [{tool_name: {}}]
289
308
  if prompt.system:
290
309
  body["systemInstruction"] = {"parts": [{"text": prompt.system}]}
291
310
 
@@ -490,9 +509,12 @@ def register_commands(cli):
490
509
  def models(key):
491
510
  "List of Gemini models pulled from their API"
492
511
  key = llm.get_key(key, "gemini", "LLM_GEMINI_KEY")
493
- response = httpx.get(
494
- f"https://generativelanguage.googleapis.com/v1beta/models?key={key}",
495
- )
512
+ if not key:
513
+ raise click.ClickException(
514
+ "You must set the LLM_GEMINI_KEY environment variable or use --key"
515
+ )
516
+ url = f"https://generativelanguage.googleapis.com/v1beta/models"
517
+ response = httpx.get(url, headers={"x-goog-api-key": key})
496
518
  response.raise_for_status()
497
519
  click.echo(json.dumps(response.json()["models"], indent=2))
498
520
 
@@ -1,7 +0,0 @@
1
- llm_gemini.py,sha256=eoMPxKnWgEN3Li1HDsKIgKnXT5AL4stDhWc1MU6uIRE,17558
2
- llm_gemini-0.18.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
- llm_gemini-0.18.dist-info/METADATA,sha256=X3NSwwbxo8TIAgyf3PA13WUzSWKTxXc38EhpD2VK_ds,8047
4
- llm_gemini-0.18.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
5
- llm_gemini-0.18.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
- llm_gemini-0.18.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
- llm_gemini-0.18.dist-info/RECORD,,