llm-gemini 0.7__py3-none-any.whl → 0.9__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.7.dist-info → llm_gemini-0.9.dist-info}/METADATA +19 -2
- llm_gemini-0.9.dist-info/RECORD +7 -0
- {llm_gemini-0.7.dist-info → llm_gemini-0.9.dist-info}/WHEEL +1 -1
- llm_gemini.py +40 -3
- llm_gemini-0.7.dist-info/RECORD +0 -7
- {llm_gemini-0.7.dist-info → llm_gemini-0.9.dist-info}/LICENSE +0 -0
- {llm_gemini-0.7.dist-info → llm_gemini-0.9.dist-info}/entry_points.txt +0 -0
- {llm_gemini-0.7.dist-info → llm_gemini-0.9.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.9
|
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,9 @@ 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
|
67
70
|
|
68
71
|
### Images, audio and video
|
69
72
|
|
@@ -113,6 +116,20 @@ To enable this feature, use `-o code_execution 1`:
|
|
113
116
|
llm -m gemini-1.5-pro-latest -o code_execution 1 \
|
114
117
|
'use python to calculate (factorial of 13) * 3'
|
115
118
|
```
|
119
|
+
### Google search
|
120
|
+
|
121
|
+
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.
|
122
|
+
|
123
|
+
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.
|
124
|
+
|
125
|
+
To run a prompt with Google search enabled, use `-o google_search 1`:
|
126
|
+
|
127
|
+
```bash
|
128
|
+
llm -m gemini-1.5-pro-latest -o google_search 1 \
|
129
|
+
'What happened in Ireland today?'
|
130
|
+
```
|
131
|
+
|
132
|
+
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
133
|
|
117
134
|
### Chat
|
118
135
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
llm_gemini.py,sha256=sCouoSbzOe4GoTsskAKJZjhDTxRYqSxgNuODwi2O1z0,12752
|
2
|
+
llm_gemini-0.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
3
|
+
llm_gemini-0.9.dist-info/METADATA,sha256=UEr_dRMMSev9YY9U34QMQHnhuyRPM7E7sHT1o8uA0qg,6808
|
4
|
+
llm_gemini-0.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
5
|
+
llm_gemini-0.9.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
|
6
|
+
llm_gemini-0.9.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
|
7
|
+
llm_gemini-0.9.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,8 +52,15 @@ 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",
|
56
|
+
"gemini-2.0-flash-thinking-exp-1219",
|
57
|
+
"gemini-2.0-flash-thinking-exp-01-21",
|
44
58
|
]:
|
45
|
-
|
59
|
+
can_google_search = model_id in GOOGLE_SEARCH_MODELS
|
60
|
+
register(
|
61
|
+
GeminiPro(model_id, can_google_search=can_google_search),
|
62
|
+
AsyncGeminiPro(model_id, can_google_search=can_google_search),
|
63
|
+
)
|
46
64
|
|
47
65
|
|
48
66
|
def resolve_type(attachment):
|
@@ -50,6 +68,8 @@ def resolve_type(attachment):
|
|
50
68
|
# https://github.com/simonw/llm/issues/587#issuecomment-2439785140
|
51
69
|
if mime_type == "audio/mpeg":
|
52
70
|
mime_type = "audio/mp3"
|
71
|
+
if mime_type == "application/ogg":
|
72
|
+
mime_type = "audio/ogg"
|
53
73
|
return mime_type
|
54
74
|
|
55
75
|
|
@@ -59,6 +79,9 @@ class _SharedGemini:
|
|
59
79
|
can_stream = True
|
60
80
|
|
61
81
|
attachment_types = (
|
82
|
+
# Text
|
83
|
+
"text/plain",
|
84
|
+
"text/csv",
|
62
85
|
# PDF
|
63
86
|
"application/pdf",
|
64
87
|
# Images
|
@@ -73,6 +96,7 @@ class _SharedGemini:
|
|
73
96
|
"audio/aiff",
|
74
97
|
"audio/aac",
|
75
98
|
"audio/ogg",
|
99
|
+
"application/ogg",
|
76
100
|
"audio/flac",
|
77
101
|
"audio/mpeg", # Treated as audio/mp3
|
78
102
|
# Video
|
@@ -133,8 +157,17 @@ class _SharedGemini:
|
|
133
157
|
default=None,
|
134
158
|
)
|
135
159
|
|
136
|
-
|
160
|
+
class OptionsWithGoogleSearch(Options):
|
161
|
+
google_search: Optional[bool] = Field(
|
162
|
+
description="Enables the model to use Google Search to improve the accuracy and recency of responses from the model",
|
163
|
+
default=None,
|
164
|
+
)
|
165
|
+
|
166
|
+
def __init__(self, model_id, can_google_search=False):
|
137
167
|
self.model_id = model_id
|
168
|
+
self.can_google_search = can_google_search
|
169
|
+
if can_google_search:
|
170
|
+
self.Options = self.OptionsWithGoogleSearch
|
138
171
|
|
139
172
|
def build_messages(self, prompt, conversation):
|
140
173
|
messages = []
|
@@ -154,7 +187,9 @@ class _SharedGemini:
|
|
154
187
|
if response.prompt.prompt:
|
155
188
|
parts.append({"text": response.prompt.prompt})
|
156
189
|
messages.append({"role": "user", "parts": parts})
|
157
|
-
messages.append(
|
190
|
+
messages.append(
|
191
|
+
{"role": "model", "parts": [{"text": response.text_or_raise()}]}
|
192
|
+
)
|
158
193
|
|
159
194
|
parts = []
|
160
195
|
if prompt.prompt:
|
@@ -180,6 +215,8 @@ class _SharedGemini:
|
|
180
215
|
}
|
181
216
|
if prompt.options and prompt.options.code_execution:
|
182
217
|
body["tools"] = [{"codeExecution": {}}]
|
218
|
+
if prompt.options and self.can_google_search and prompt.options.google_search:
|
219
|
+
body["tools"] = [{"google_search_retrieval": {}}]
|
183
220
|
if prompt.system:
|
184
221
|
body["systemInstruction"] = {"parts": [{"text": prompt.system}]}
|
185
222
|
|
llm_gemini-0.7.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
llm_gemini.py,sha256=bRHLsvRJxHxggQfNIglYLy0ynCPSc9i830OkD_bNFsU,11354
|
2
|
-
llm_gemini-0.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
3
|
-
llm_gemini-0.7.dist-info/METADATA,sha256=-J-F1wbQEP-okp97nZjLcfze4mBjFjkxNpfgGtWos-k,5530
|
4
|
-
llm_gemini-0.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
5
|
-
llm_gemini-0.7.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
|
6
|
-
llm_gemini-0.7.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
|
7
|
-
llm_gemini-0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|