Skip to content

Commit 6296132

Browse files
authored
Merge pull request #42 from darrenburns/gemini-builtin
Add builtin models for Google Gemini
2 parents a5d1329 + 6f914b3 commit 6296132

File tree

5 files changed

+143
-2
lines changed

5 files changed

+143
-2
lines changed

elia_chat/config.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,34 @@ def get_builtin_anthropic_models() -> list[EliaChatModel]:
108108
]
109109

110110

111+
def get_builtin_google_models() -> list[EliaChatModel]:
112+
return [
113+
EliaChatModel(
114+
id="elia-gemini/gemini-1.5-pro-latest",
115+
name="gemini/gemini-1.5-pro-latest",
116+
display_name="Gemini 1.5 Pro",
117+
provider="Google",
118+
product="Gemini",
119+
description="Excels at reasoning tasks including code and text generation, "
120+
"text editing, problem solving, data extraction and generation",
121+
),
122+
EliaChatModel(
123+
id="elia-gemini/gemini-1.5-flash-latest",
124+
name="gemini/gemini-1.5-flash-latest",
125+
display_name="Gemini 1.5 Flash",
126+
provider="Google",
127+
product="Gemini",
128+
description="Fast and versatile performance across a variety of tasks",
129+
),
130+
]
131+
132+
111133
def get_builtin_models() -> list[EliaChatModel]:
112-
return get_builtin_openai_models() + get_builtin_anthropic_models()
134+
return (
135+
get_builtin_openai_models()
136+
+ get_builtin_anthropic_models()
137+
+ get_builtin_google_models()
138+
)
113139

114140

115141
class LaunchConfig(BaseModel):

elia_chat/widgets/chatbox.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@ def action_next_code_block(self) -> None:
112112
)
113113
else:
114114
if query:
115-
self.visual_mode = True
116115
code_block_nodes = self.document.query_syntax_tree(query)
117116
locations: list[tuple[tuple[int, int], tuple[int, int]]] = [
118117
(node.start_point, node.end_point)
119118
for (node, _name) in code_block_nodes
120119
]
120+
if not locations:
121+
return
122+
self.visual_mode = True
121123
end_locations = [end for _start, end in locations]
122124
cursor_row, _cursor_column = self.cursor_location
123125
search_start_location = cursor_row + 1, 0

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies = [
1616
"click-default-group>=1.2.4",
1717
"litellm>=1.35.38",
1818
"greenlet>=3.0.3",
19+
"google-generativeai>=0.5.3",
1920
]
2021
readme = "README.md"
2122
requires-python = ">= 3.11"

requirements-dev.lock

+56
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ anyio==4.2.0
2323
attrs==23.2.0
2424
# via aiohttp
2525
black==24.1.1
26+
cachetools==5.3.3
27+
# via google-auth
2628
certifi==2024.2.2
2729
# via httpcore
2830
# via httpx
@@ -51,13 +53,42 @@ frozenlist==1.4.1
5153
# via aiosignal
5254
fsspec==2024.3.1
5355
# via huggingface-hub
56+
google-ai-generativelanguage==0.6.3
57+
# via google-generativeai
58+
google-api-core==2.19.0
59+
# via google-ai-generativelanguage
60+
# via google-api-python-client
61+
# via google-generativeai
62+
google-api-python-client==2.129.0
63+
# via google-generativeai
64+
google-auth==2.29.0
65+
# via google-ai-generativelanguage
66+
# via google-api-core
67+
# via google-api-python-client
68+
# via google-auth-httplib2
69+
# via google-generativeai
70+
google-auth-httplib2==0.2.0
71+
# via google-api-python-client
72+
google-generativeai==0.5.3
73+
# via elia-chat
74+
googleapis-common-protos==1.63.0
75+
# via google-api-core
76+
# via grpcio-status
5477
greenlet==3.0.3
5578
# via elia-chat
5679
# via sqlalchemy
80+
grpcio==1.63.0
81+
# via google-api-core
82+
# via grpcio-status
83+
grpcio-status==1.62.2
84+
# via google-api-core
5785
h11==0.14.0
5886
# via httpcore
5987
httpcore==1.0.2
6088
# via httpx
89+
httplib2==0.22.0
90+
# via google-api-python-client
91+
# via google-auth-httplib2
6192
httpx==0.26.0
6293
# via openai
6394
huggingface-hub==0.22.2
@@ -111,7 +142,23 @@ platformdirs==4.2.0
111142
# via black
112143
# via virtualenv
113144
pre-commit==3.5.0
145+
proto-plus==1.23.0
146+
# via google-ai-generativelanguage
147+
# via google-api-core
148+
protobuf==4.25.3
149+
# via google-ai-generativelanguage
150+
# via google-api-core
151+
# via google-generativeai
152+
# via googleapis-common-protos
153+
# via grpcio-status
154+
# via proto-plus
155+
pyasn1==0.6.0
156+
# via pyasn1-modules
157+
# via rsa
158+
pyasn1-modules==0.4.0
159+
# via google-auth
114160
pydantic==2.6.1
161+
# via google-generativeai
115162
# via openai
116163
# via pydantic-settings
117164
# via sqlmodel
@@ -122,6 +169,8 @@ pydantic-settings==2.2.1
122169
pygments==2.17.2
123170
# via rich
124171
pyinstrument==4.6.2
172+
pyparsing==3.1.2
173+
# via httplib2
125174
python-dotenv==1.0.1
126175
# via litellm
127176
# via pydantic-settings
@@ -131,11 +180,14 @@ pyyaml==6.0.1
131180
regex==2023.12.25
132181
# via tiktoken
133182
requests==2.31.0
183+
# via google-api-core
134184
# via huggingface-hub
135185
# via litellm
136186
# via tiktoken
137187
rich==13.7.0
138188
# via textual
189+
rsa==4.9
190+
# via google-auth
139191
setuptools==69.0.3
140192
# via nodeenv
141193
sniffio==1.3.0
@@ -155,6 +207,7 @@ tiktoken==0.5.2
155207
tokenizers==0.19.1
156208
# via litellm
157209
tqdm==4.66.2
210+
# via google-generativeai
158211
# via huggingface-hub
159212
# via openai
160213
tree-sitter==0.20.4
@@ -165,6 +218,7 @@ tree-sitter-languages==1.10.2
165218
types-peewee==3.17.0.20240207
166219
typing-extensions==4.9.0
167220
# via aiosqlite
221+
# via google-generativeai
168222
# via huggingface-hub
169223
# via mypy
170224
# via openai
@@ -175,6 +229,8 @@ typing-extensions==4.9.0
175229
# via textual-dev
176230
uc-micro-py==1.0.3
177231
# via linkify-it-py
232+
uritemplate==4.1.1
233+
# via google-api-python-client
178234
urllib3==2.2.0
179235
# via requests
180236
virtualenv==20.25.0

requirements.lock

+56
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ anyio==4.2.0
2121
# via openai
2222
attrs==23.2.0
2323
# via aiohttp
24+
cachetools==5.3.3
25+
# via google-auth
2426
certifi==2024.2.2
2527
# via httpcore
2628
# via httpx
@@ -42,13 +44,42 @@ frozenlist==1.4.1
4244
# via aiosignal
4345
fsspec==2024.3.1
4446
# via huggingface-hub
47+
google-ai-generativelanguage==0.6.3
48+
# via google-generativeai
49+
google-api-core==2.19.0
50+
# via google-ai-generativelanguage
51+
# via google-api-python-client
52+
# via google-generativeai
53+
google-api-python-client==2.129.0
54+
# via google-generativeai
55+
google-auth==2.29.0
56+
# via google-ai-generativelanguage
57+
# via google-api-core
58+
# via google-api-python-client
59+
# via google-auth-httplib2
60+
# via google-generativeai
61+
google-auth-httplib2==0.2.0
62+
# via google-api-python-client
63+
google-generativeai==0.5.3
64+
# via elia-chat
65+
googleapis-common-protos==1.63.0
66+
# via google-api-core
67+
# via grpcio-status
4568
greenlet==3.0.3
4669
# via elia-chat
4770
# via sqlalchemy
71+
grpcio==1.63.0
72+
# via google-api-core
73+
# via grpcio-status
74+
grpcio-status==1.62.2
75+
# via google-api-core
4876
h11==0.14.0
4977
# via httpcore
5078
httpcore==1.0.2
5179
# via httpx
80+
httplib2==0.22.0
81+
# via google-api-python-client
82+
# via google-auth-httplib2
5283
httpx==0.26.0
5384
# via openai
5485
huggingface-hub==0.22.2
@@ -85,7 +116,23 @@ openai==1.12.0
85116
# via litellm
86117
packaging==23.2
87118
# via huggingface-hub
119+
proto-plus==1.23.0
120+
# via google-ai-generativelanguage
121+
# via google-api-core
122+
protobuf==4.25.3
123+
# via google-ai-generativelanguage
124+
# via google-api-core
125+
# via google-generativeai
126+
# via googleapis-common-protos
127+
# via grpcio-status
128+
# via proto-plus
129+
pyasn1==0.6.0
130+
# via pyasn1-modules
131+
# via rsa
132+
pyasn1-modules==0.4.0
133+
# via google-auth
88134
pydantic==2.6.1
135+
# via google-generativeai
89136
# via openai
90137
# via pydantic-settings
91138
# via sqlmodel
@@ -95,6 +142,8 @@ pydantic-settings==2.2.1
95142
# via elia-chat
96143
pygments==2.17.2
97144
# via rich
145+
pyparsing==3.1.2
146+
# via httplib2
98147
python-dotenv==1.0.1
99148
# via litellm
100149
# via pydantic-settings
@@ -103,11 +152,14 @@ pyyaml==6.0.1
103152
regex==2023.12.25
104153
# via tiktoken
105154
requests==2.31.0
155+
# via google-api-core
106156
# via huggingface-hub
107157
# via litellm
108158
# via tiktoken
109159
rich==13.7.0
110160
# via textual
161+
rsa==4.9
162+
# via google-auth
111163
sniffio==1.3.0
112164
# via anyio
113165
# via httpx
@@ -123,6 +175,7 @@ tiktoken==0.5.2
123175
tokenizers==0.19.1
124176
# via litellm
125177
tqdm==4.66.2
178+
# via google-generativeai
126179
# via huggingface-hub
127180
# via openai
128181
tree-sitter==0.20.4
@@ -132,6 +185,7 @@ tree-sitter-languages==1.10.2
132185
# via textual
133186
typing-extensions==4.9.0
134187
# via aiosqlite
188+
# via google-generativeai
135189
# via huggingface-hub
136190
# via openai
137191
# via pydantic
@@ -140,6 +194,8 @@ typing-extensions==4.9.0
140194
# via textual
141195
uc-micro-py==1.0.3
142196
# via linkify-it-py
197+
uritemplate==4.1.1
198+
# via google-api-python-client
143199
urllib3==2.2.0
144200
# via requests
145201
xdg-base-dirs==6.0.1

0 commit comments

Comments
 (0)