Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit of Google Gemini LLM service. #150

Merged
merged 7 commits into from
May 20, 2024
Merged

Initial commit of Google Gemini LLM service. #150

merged 7 commits into from
May 20, 2024

Conversation

kwindla
Copy link
Contributor

@kwindla kwindla commented May 17, 2024

Gemini text input works. We translate from OpenAILLMContext format on the fly in the GoogleLLMService implementation.

This commit also implements image input (vision) in both the GoogleLLMService and in the OpenAILLMService. Image input is a hack and needs to be revisited. OpenAI expects images to be uploaded as base64-encoded JPEGs. Google does not require the base64 encoding. Other than for images, we use the OpenAI format as our standard, but base64-encoding the images and then unencoding them in the GoogleLLMService feels wasteful.

#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
Copy link
Contributor

@aconchillo aconchillo May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I try to generate this with python 3.10 just to make sure it works there. on macos i do:

brew install [email protected]
python3.10 -m venv venv
...
...
pip-compile --all-extras pyproject.toml
mv requirements.txt macos-py3.10-requirements.txt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

del message["mime_type"]

# messages_for_log = json.dumps(messages)
# logger.debug(f"Generating chat: {messages_for_log}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove or re-add?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@chadbailey59 chadbailey59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

kwindla added 2 commits May 19, 2024 10:35
Gemini text input works. We translate from OpenAILLMContext format
on the fly in the GoogleLLMService implementation. This commit also
implements image input (vision) in both the GoogleLLMService and in
the OpenAILLMService. Image input is a hack and needs to be revisited.
OpenAI expects images to be uploaded as base64-encoded JPEGs. Google
does not require the base64 encoding. Other than for images, we use
the OpenAI format as our standard, but base64-encoding the images
and then unencoding them in the GoogleLLMService feels wasteful.
@aconchillo aconchillo marked this pull request as ready for review May 20, 2024 02:24
@aconchillo aconchillo merged commit bf036be into main May 20, 2024
2 of 3 checks passed
@aconchillo aconchillo deleted the khk-gemini branch October 23, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants