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

✨ Add support for google gemini model. #307

Merged
merged 4 commits into from
Aug 29, 2024

Conversation

Myrausman
Copy link
Contributor

Fixes #304

@jwmatthews
Copy link
Member

@Myrausman thank you!

Quick look at the PR and looked great. I'll help run through a manual test, but I don't expect to have time to help until Wednesday.

@fabianvf
Copy link
Contributor

@Myrausman Would you be able to start the server in demo mode (DEMO_MODE=true), which should dump a bunch of cached responses into kai/data/vcr/{app}/{model}, then commit those files? That will let us run some verification on our end without needing to have a valid API key

@Myrausman
Copy link
Contributor Author

I started server in demo mode but I'm not getting any cache new response for that particular model (pro-gemini).

@jwmatthews
Copy link
Member

I started server in demo mode but I'm not getting any cache new response for that particular model (pro-gemini).

@Myrausman did you run:
https://github.com/konveyor/kai/blob/main/example/run_demo.py

To get cached responses you need to send requests to the API, so that it can cache the response.
To send requests, easiest way is to use the run_demo.py against coolstore.

You can read this to learn more of how to run:
https://github.com/konveyor/kai/blob/main/example/README.md

Copy link
Member

@jwmatthews jwmatthews left a comment

Choose a reason for hiding this comment

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

Code changes look good...
Waiting on:

  1. Update of cached responses
  2. A maintainer to run a manual test to confirm working with Gemini

I am willing to test with a Gemini API key, I won't have time to help with that today, will try for helping tomorrow.

@jwmatthews
Copy link
Member

@Myrausman this will help to give more context of updating cached responses

https://github.com/konveyor/kai/blob/main/docs/contrib/Demo_Mode.md#demo_mode-updating-cached-responses

@Myrausman
Copy link
Contributor Author

followin this file Contributing.md, when I'm running make load-data I am getting these error:

(.venv) myra@myra-ThinkPad-T14-Gen-2i:~/extra/lfx/kai$ make load-data
PYTHONPATH="/home/myra/extra/lfx/kai/kai:" python ./kai/service/incident_store/psql.py  --config_filepath ./kai/config.toml --drop_tables False
Console logging for 'kai' is set to level 'INFO'
File logging for 'kai' is set to level 'DEBUG' writing to file: '/home/myra/extra/lfx/kai/kai/service/incident_store/../../../logs/kai_psql.log'
INFO - 2024-08-22 02:58:32,264 - kai.service.kai_application.kai_application - [  kai_application.py:54   -             __init__()] - Tracing enabled.
modelid ############################### gemini-pro
INFO - 2024-08-22 02:58:32,281 - kai.service.kai_application.kai_application - [  kai_application.py:63   -             __init__()] - Selected provider: ChatGoogleGenerativeAI
INFO - 2024-08-22 02:58:32,282 - kai.service.kai_application.kai_application - [  kai_application.py:64   -             __init__()] - Selected model: gemini-pro
INFO - 2024-08-22 02:58:32,389 - kai.service.kai_application.kai_application - [  kai_application.py:84   -             __init__()] - Selected incident store: postgresql
INFO - 2024-08-22 02:58:32,460 - kai.service.incident_store.incident_store - [   incident_store.py:91   - load_reports_from_directory()] - Loading incident store with applications: ['ejb-security', 'ejb-remote', 'kitchensink', 'bmt', 'helloworld-mdb', 'cmt', 'greeter', 'tasks-qute', 'ticket-monster']

INFO - 2024-08-22 02:58:32,461 - kai.service.incident_store.incident_store - [   incident_store.py:95   - load_reports_from_directory()] - Loading application ejb-security

Traceback (most recent call last):
  File "/home/myra/extra/lfx/kai/./kai/service/incident_store/psql.py", line 4, in <module>
    cmd("postgresql")
  File "/home/myra/extra/lfx/kai/kai/service/incident_store/incident_store.py", line 475, in cmd
    load_reports_from_directory(incident_store, args.analysis_dir_path)
  File "/home/myra/extra/lfx/kai/kai/service/incident_store/incident_store.py", line 114, in load_reports_from_directory
    repo = Repo(repo_path)
           ^^^^^^^^^^^^^^^
  File "/home/myra/extra/lfx/kai/.venv/lib/python3.11/site-packages/git/repo/base.py", line 236, in __init__
    raise NoSuchPathError(epath)
git.exc.NoSuchPathError: /home/myra/extra/lfx/kai/samples/sample_repos/ejb-security
make: *** [Makefile:22: load-data] Error 1

@jwmatthews
Copy link
Member

I think you just need to clone a few sample repos paths

Look at this link and run the fetch_apps.py it mentions:

https://github.com/konveyor/kai/blob/main/docs/contrib/Dev_Environment.md#steps

@Myrausman
Copy link
Contributor Author

After running python3 run_demo.py, I am getting the following output: https://gist.github.com/Myrausman/3b9112e1342baa5a9accb8cb31d913d6.
I also don't see any new files from the model in this location: kai/data/vcr/{app}/{model}.

Copy link
Member

@jwmatthews jwmatthews left a comment

Choose a reason for hiding this comment

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

The requirements.txt update looks incorrect.

@Myrausman did you run pip-compile, you should have more dependencies added to requirements.txt to account for the langchain-google-genai package and it's dependencies.

Let's update requirements.txt and then I think we'll be in shape to merge this.

I confirmed that when I ran pip-compile to update requirements.txt I had success running run_example.py.

I also confirmed that cached data is NOT being captured. I am less sure of why that is happening.

My thought is we move forward to merge this PR after the requirements.txt update is made, we accept we do not have cached data for gemini and work that as a separate issue, tracked as #315

@jwmatthews jwmatthews changed the title Added support for gemini model. ✨ Add support for gemini model. Aug 22, 2024
@jwmatthews jwmatthews changed the title ✨ Add support for gemini model. ✨ Add support for google gemini model. Aug 22, 2024
@fabianvf
Copy link
Contributor

interesting, I wonder if the google library is using a different library that isn't intercepted by VCR for managing the requests

@jwmatthews
Copy link
Member

@Myrausman please take look at the merge conflicts we will need to resolve before we can merge. We merged another PR yesterday that altered the requirements a little, so you will need to reexamine requirements.in, add your changes in, rerun pip-compile and test, then update this PR with the changes.

Signed-off-by: Myrausman <maira.usman5703@gmail.com>
Signed-off-by: Myrausman <maira.usman5703@gmail.com>
Signed-off-by: Myrausman <maira.usman5703@gmail.com>
Signed-off-by: Myrausman <maira.usman5703@gmail.com>
Copy link
Member

@jwmatthews jwmatthews left a comment

Choose a reason for hiding this comment

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

LGTM

Ran and verified functional on Mac with arm64

@JonahSussman JonahSussman merged commit 4e230b3 into konveyor:main Aug 29, 2024
5 checks passed
@JonahSussman
Copy link
Contributor

@Myrausman Thank you for your contribution!

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.

Add support for Google Gemini models
4 participants