llm-gemini 0.8__py3-none-any.whl → 0.10__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.
- {llm_gemini-0.8.dist-info → llm_gemini-0.10.dist-info}/METADATA +22 -2
- llm_gemini-0.10.dist-info/RECORD +7 -0
- {llm_gemini-0.8.dist-info → llm_gemini-0.10.dist-info}/WHEEL +1 -1
- llm_gemini.py +44 -4
- llm_gemini-0.8.dist-info/RECORD +0 -7
- {llm_gemini-0.8.dist-info → llm_gemini-0.10.dist-info}/LICENSE +0 -0
- {llm_gemini-0.8.dist-info → llm_gemini-0.10.dist-info}/entry_points.txt +0 -0
- {llm_gemini-0.8.dist-info → llm_gemini-0.10.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: llm-gemini
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10
|
4
4
|
Summary: LLM plugin to access Google's Gemini family of models
|
5
5
|
Author: Simon Willison
|
6
6
|
License: Apache-2.0
|
@@ -64,6 +64,12 @@ Other models are:
|
|
64
64
|
- `gemini-exp-1121` - recent experimental #2
|
65
65
|
- `gemini-exp-1206` - recent experimental #3
|
66
66
|
- `gemini-2.0-flash-exp` - [Gemini 2.0 Flash](https://blog.google/technology/google-deepmind/google-gemini-ai-update-december-2024/#gemini-2-0-flash)
|
67
|
+
- `learnlm-1.5-pro-experimental` - "an experimental task-specific model that has been trained to align with learning science principles" - [more details here](https://ai.google.dev/gemini-api/docs/learnlm).
|
68
|
+
- `gemini-2.0-flash-thinking-exp-1219` - experimental "thinking" model from December 2024
|
69
|
+
- `gemini-2.0-flash-thinking-exp-01-21` - experimental "thinking" model from January 2025
|
70
|
+
- `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-pro-exp-02-05` - experimental release of Gemini 2.0 Pro
|
67
73
|
|
68
74
|
### Images, audio and video
|
69
75
|
|
@@ -113,6 +119,20 @@ To enable this feature, use `-o code_execution 1`:
|
|
113
119
|
llm -m gemini-1.5-pro-latest -o code_execution 1 \
|
114
120
|
'use python to calculate (factorial of 13) * 3'
|
115
121
|
```
|
122
|
+
### Google search
|
123
|
+
|
124
|
+
Some Gemini models support [Grounding with Google Search](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-gemini#web-ground-gemini), where the model can run a Google search and use the results as part of answering a prompt.
|
125
|
+
|
126
|
+
Using this feature may incur additional requirements in terms of how you use the results. Consult [Google's documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-gemini#web-ground-gemini) for more details.
|
127
|
+
|
128
|
+
To run a prompt with Google search enabled, use `-o google_search 1`:
|
129
|
+
|
130
|
+
```bash
|
131
|
+
llm -m gemini-1.5-pro-latest -o google_search 1 \
|
132
|
+
'What happened in Ireland today?'
|
133
|
+
```
|
134
|
+
|
135
|
+
Use `llm logs -c --json` after running a prompt to see the full JSON response, which includes [additional information](https://github.com/simonw/llm-gemini/pull/29#issuecomment-2606201877) about grounded results.
|
116
136
|
|
117
137
|
### Chat
|
118
138
|
|
@@ -0,0 +1,7 @@
|
|
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,,
|
llm_gemini.py
CHANGED
@@ -23,6 +23,17 @@ SAFETY_SETTINGS = [
|
|
23
23
|
},
|
24
24
|
]
|
25
25
|
|
26
|
+
# https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-gemini#supported_models_2
|
27
|
+
GOOGLE_SEARCH_MODELS = {
|
28
|
+
"gemini-1.5-pro-latest",
|
29
|
+
"gemini-1.5-flash-latest",
|
30
|
+
"gemini-1.5-pro-001",
|
31
|
+
"gemini-1.5-flash-001",
|
32
|
+
"gemini-1.5-pro-002",
|
33
|
+
"gemini-1.5-flash-002",
|
34
|
+
"gemini-2.0-flash-exp",
|
35
|
+
}
|
36
|
+
|
26
37
|
|
27
38
|
@llm.hookimpl
|
28
39
|
def register_models(register):
|
@@ -41,9 +52,19 @@ def register_models(register):
|
|
41
52
|
"gemini-exp-1121",
|
42
53
|
"gemini-exp-1206",
|
43
54
|
"gemini-2.0-flash-exp",
|
55
|
+
"learnlm-1.5-pro-experimental",
|
44
56
|
"gemini-2.0-flash-thinking-exp-1219",
|
57
|
+
"gemini-2.0-flash-thinking-exp-01-21",
|
58
|
+
# Released 5th Feb 2025:
|
59
|
+
"gemini-2.0-flash",
|
60
|
+
"gemini-2.0-flash-lite-preview-02-05",
|
61
|
+
"gemini-2.0-pro-exp-02-05",
|
45
62
|
]:
|
46
|
-
|
63
|
+
can_google_search = model_id in GOOGLE_SEARCH_MODELS
|
64
|
+
register(
|
65
|
+
GeminiPro(model_id, can_google_search=can_google_search),
|
66
|
+
AsyncGeminiPro(model_id, can_google_search=can_google_search),
|
67
|
+
)
|
47
68
|
|
48
69
|
|
49
70
|
def resolve_type(attachment):
|
@@ -51,6 +72,8 @@ def resolve_type(attachment):
|
|
51
72
|
# https://github.com/simonw/llm/issues/587#issuecomment-2439785140
|
52
73
|
if mime_type == "audio/mpeg":
|
53
74
|
mime_type = "audio/mp3"
|
75
|
+
if mime_type == "application/ogg":
|
76
|
+
mime_type = "audio/ogg"
|
54
77
|
return mime_type
|
55
78
|
|
56
79
|
|
@@ -60,6 +83,9 @@ class _SharedGemini:
|
|
60
83
|
can_stream = True
|
61
84
|
|
62
85
|
attachment_types = (
|
86
|
+
# Text
|
87
|
+
"text/plain",
|
88
|
+
"text/csv",
|
63
89
|
# PDF
|
64
90
|
"application/pdf",
|
65
91
|
# Images
|
@@ -74,6 +100,7 @@ class _SharedGemini:
|
|
74
100
|
"audio/aiff",
|
75
101
|
"audio/aac",
|
76
102
|
"audio/ogg",
|
103
|
+
"application/ogg",
|
77
104
|
"audio/flac",
|
78
105
|
"audio/mpeg", # Treated as audio/mp3
|
79
106
|
# Video
|
@@ -134,8 +161,17 @@ class _SharedGemini:
|
|
134
161
|
default=None,
|
135
162
|
)
|
136
163
|
|
137
|
-
|
164
|
+
class OptionsWithGoogleSearch(Options):
|
165
|
+
google_search: Optional[bool] = Field(
|
166
|
+
description="Enables the model to use Google Search to improve the accuracy and recency of responses from the model",
|
167
|
+
default=None,
|
168
|
+
)
|
169
|
+
|
170
|
+
def __init__(self, model_id, can_google_search=False):
|
138
171
|
self.model_id = model_id
|
172
|
+
self.can_google_search = can_google_search
|
173
|
+
if can_google_search:
|
174
|
+
self.Options = self.OptionsWithGoogleSearch
|
139
175
|
|
140
176
|
def build_messages(self, prompt, conversation):
|
141
177
|
messages = []
|
@@ -155,7 +191,9 @@ class _SharedGemini:
|
|
155
191
|
if response.prompt.prompt:
|
156
192
|
parts.append({"text": response.prompt.prompt})
|
157
193
|
messages.append({"role": "user", "parts": parts})
|
158
|
-
messages.append(
|
194
|
+
messages.append(
|
195
|
+
{"role": "model", "parts": [{"text": response.text_or_raise()}]}
|
196
|
+
)
|
159
197
|
|
160
198
|
parts = []
|
161
199
|
if prompt.prompt:
|
@@ -181,6 +219,8 @@ class _SharedGemini:
|
|
181
219
|
}
|
182
220
|
if prompt.options and prompt.options.code_execution:
|
183
221
|
body["tools"] = [{"codeExecution": {}}]
|
222
|
+
if prompt.options and self.can_google_search and prompt.options.google_search:
|
223
|
+
body["tools"] = [{"google_search_retrieval": {}}]
|
184
224
|
if prompt.system:
|
185
225
|
body["systemInstruction"] = {"parts": [{"text": prompt.system}]}
|
186
226
|
|
@@ -335,4 +375,4 @@ class GeminiEmbeddingModel(llm.EmbeddingModel):
|
|
335
375
|
)
|
336
376
|
|
337
377
|
response.raise_for_status()
|
338
|
-
return [item["values"] for item in response.json()["embeddings"]]
|
378
|
+
return [item["values"] for item in response.json()["embeddings"]]
|
llm_gemini-0.8.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
llm_gemini.py,sha256=6xRF1uP64O-nYAGgKytFh1Wj0N-cRny4bs69GmTwJLU,11408
|
2
|
-
llm_gemini-0.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
3
|
-
llm_gemini-0.8.dist-info/METADATA,sha256=cCkBf00ebzzwl2wyUxOTuwTWfG_peiB7mtD-8bzHBkc,5530
|
4
|
-
llm_gemini-0.8.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
5
|
-
llm_gemini-0.8.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
|
6
|
-
llm_gemini-0.8.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
|
7
|
-
llm_gemini-0.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|