Skip to content

Commit

Permalink
Merge pull request #42 from darrenburns/gemini-builtin
Browse files Browse the repository at this point in the history
Add builtin models for Google Gemini
  • Loading branch information
darrenburns authored May 14, 2024
2 parents a5d1329 + 6f914b3 commit 6296132
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 2 deletions.
28 changes: 27 additions & 1 deletion elia_chat/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,34 @@ def get_builtin_anthropic_models() -> list[EliaChatModel]:
]


def get_builtin_google_models() -> list[EliaChatModel]:
return [
EliaChatModel(
id="elia-gemini/gemini-1.5-pro-latest",
name="gemini/gemini-1.5-pro-latest",
display_name="Gemini 1.5 Pro",
provider="Google",
product="Gemini",
description="Excels at reasoning tasks including code and text generation, "
"text editing, problem solving, data extraction and generation",
),
EliaChatModel(
id="elia-gemini/gemini-1.5-flash-latest",
name="gemini/gemini-1.5-flash-latest",
display_name="Gemini 1.5 Flash",
provider="Google",
product="Gemini",
description="Fast and versatile performance across a variety of tasks",
),
]


def get_builtin_models() -> list[EliaChatModel]:
return get_builtin_openai_models() + get_builtin_anthropic_models()
return (
get_builtin_openai_models()
+ get_builtin_anthropic_models()
+ get_builtin_google_models()
)


class LaunchConfig(BaseModel):
Expand Down
4 changes: 3 additions & 1 deletion elia_chat/widgets/chatbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ def action_next_code_block(self) -> None:
)
else:
if query:
self.visual_mode = True
code_block_nodes = self.document.query_syntax_tree(query)
locations: list[tuple[tuple[int, int], tuple[int, int]]] = [
(node.start_point, node.end_point)
for (node, _name) in code_block_nodes
]
if not locations:
return
self.visual_mode = True
end_locations = [end for _start, end in locations]
cursor_row, _cursor_column = self.cursor_location
search_start_location = cursor_row + 1, 0
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"click-default-group>=1.2.4",
"litellm>=1.35.38",
"greenlet>=3.0.3",
"google-generativeai>=0.5.3",
]
readme = "README.md"
requires-python = ">= 3.11"
Expand Down
56 changes: 56 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ anyio==4.2.0
attrs==23.2.0
# via aiohttp
black==24.1.1
cachetools==5.3.3
# via google-auth
certifi==2024.2.2
# via httpcore
# via httpx
Expand Down Expand Up @@ -51,13 +53,42 @@ frozenlist==1.4.1
# via aiosignal
fsspec==2024.3.1
# via huggingface-hub
google-ai-generativelanguage==0.6.3
# via google-generativeai
google-api-core==2.19.0
# via google-ai-generativelanguage
# via google-api-python-client
# via google-generativeai
google-api-python-client==2.129.0
# via google-generativeai
google-auth==2.29.0
# via google-ai-generativelanguage
# via google-api-core
# via google-api-python-client
# via google-auth-httplib2
# via google-generativeai
google-auth-httplib2==0.2.0
# via google-api-python-client
google-generativeai==0.5.3
# via elia-chat
googleapis-common-protos==1.63.0
# via google-api-core
# via grpcio-status
greenlet==3.0.3
# via elia-chat
# via sqlalchemy
grpcio==1.63.0
# via google-api-core
# via grpcio-status
grpcio-status==1.62.2
# via google-api-core
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httplib2==0.22.0
# via google-api-python-client
# via google-auth-httplib2
httpx==0.26.0
# via openai
huggingface-hub==0.22.2
Expand Down Expand Up @@ -111,7 +142,23 @@ platformdirs==4.2.0
# via black
# via virtualenv
pre-commit==3.5.0
proto-plus==1.23.0
# via google-ai-generativelanguage
# via google-api-core
protobuf==4.25.3
# via google-ai-generativelanguage
# via google-api-core
# via google-generativeai
# via googleapis-common-protos
# via grpcio-status
# via proto-plus
pyasn1==0.6.0
# via pyasn1-modules
# via rsa
pyasn1-modules==0.4.0
# via google-auth
pydantic==2.6.1
# via google-generativeai
# via openai
# via pydantic-settings
# via sqlmodel
Expand All @@ -122,6 +169,8 @@ pydantic-settings==2.2.1
pygments==2.17.2
# via rich
pyinstrument==4.6.2
pyparsing==3.1.2
# via httplib2
python-dotenv==1.0.1
# via litellm
# via pydantic-settings
Expand All @@ -131,11 +180,14 @@ pyyaml==6.0.1
regex==2023.12.25
# via tiktoken
requests==2.31.0
# via google-api-core
# via huggingface-hub
# via litellm
# via tiktoken
rich==13.7.0
# via textual
rsa==4.9
# via google-auth
setuptools==69.0.3
# via nodeenv
sniffio==1.3.0
Expand All @@ -155,6 +207,7 @@ tiktoken==0.5.2
tokenizers==0.19.1
# via litellm
tqdm==4.66.2
# via google-generativeai
# via huggingface-hub
# via openai
tree-sitter==0.20.4
Expand All @@ -165,6 +218,7 @@ tree-sitter-languages==1.10.2
types-peewee==3.17.0.20240207
typing-extensions==4.9.0
# via aiosqlite
# via google-generativeai
# via huggingface-hub
# via mypy
# via openai
Expand All @@ -175,6 +229,8 @@ typing-extensions==4.9.0
# via textual-dev
uc-micro-py==1.0.3
# via linkify-it-py
uritemplate==4.1.1
# via google-api-python-client
urllib3==2.2.0
# via requests
virtualenv==20.25.0
Expand Down
56 changes: 56 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ anyio==4.2.0
# via openai
attrs==23.2.0
# via aiohttp
cachetools==5.3.3
# via google-auth
certifi==2024.2.2
# via httpcore
# via httpx
Expand All @@ -42,13 +44,42 @@ frozenlist==1.4.1
# via aiosignal
fsspec==2024.3.1
# via huggingface-hub
google-ai-generativelanguage==0.6.3
# via google-generativeai
google-api-core==2.19.0
# via google-ai-generativelanguage
# via google-api-python-client
# via google-generativeai
google-api-python-client==2.129.0
# via google-generativeai
google-auth==2.29.0
# via google-ai-generativelanguage
# via google-api-core
# via google-api-python-client
# via google-auth-httplib2
# via google-generativeai
google-auth-httplib2==0.2.0
# via google-api-python-client
google-generativeai==0.5.3
# via elia-chat
googleapis-common-protos==1.63.0
# via google-api-core
# via grpcio-status
greenlet==3.0.3
# via elia-chat
# via sqlalchemy
grpcio==1.63.0
# via google-api-core
# via grpcio-status
grpcio-status==1.62.2
# via google-api-core
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httplib2==0.22.0
# via google-api-python-client
# via google-auth-httplib2
httpx==0.26.0
# via openai
huggingface-hub==0.22.2
Expand Down Expand Up @@ -85,7 +116,23 @@ openai==1.12.0
# via litellm
packaging==23.2
# via huggingface-hub
proto-plus==1.23.0
# via google-ai-generativelanguage
# via google-api-core
protobuf==4.25.3
# via google-ai-generativelanguage
# via google-api-core
# via google-generativeai
# via googleapis-common-protos
# via grpcio-status
# via proto-plus
pyasn1==0.6.0
# via pyasn1-modules
# via rsa
pyasn1-modules==0.4.0
# via google-auth
pydantic==2.6.1
# via google-generativeai
# via openai
# via pydantic-settings
# via sqlmodel
Expand All @@ -95,6 +142,8 @@ pydantic-settings==2.2.1
# via elia-chat
pygments==2.17.2
# via rich
pyparsing==3.1.2
# via httplib2
python-dotenv==1.0.1
# via litellm
# via pydantic-settings
Expand All @@ -103,11 +152,14 @@ pyyaml==6.0.1
regex==2023.12.25
# via tiktoken
requests==2.31.0
# via google-api-core
# via huggingface-hub
# via litellm
# via tiktoken
rich==13.7.0
# via textual
rsa==4.9
# via google-auth
sniffio==1.3.0
# via anyio
# via httpx
Expand All @@ -123,6 +175,7 @@ tiktoken==0.5.2
tokenizers==0.19.1
# via litellm
tqdm==4.66.2
# via google-generativeai
# via huggingface-hub
# via openai
tree-sitter==0.20.4
Expand All @@ -132,6 +185,7 @@ tree-sitter-languages==1.10.2
# via textual
typing-extensions==4.9.0
# via aiosqlite
# via google-generativeai
# via huggingface-hub
# via openai
# via pydantic
Expand All @@ -140,6 +194,8 @@ typing-extensions==4.9.0
# via textual
uc-micro-py==1.0.3
# via linkify-it-py
uritemplate==4.1.1
# via google-api-python-client
urllib3==2.2.0
# via requests
xdg-base-dirs==6.0.1
Expand Down

0 comments on commit 6296132

Please sign in to comment.