-
Notifications
You must be signed in to change notification settings - Fork 406
Add Gemini Pro support to CLI #309
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
Conversation
|
Consider adding a small readme note on how to generate Gemini API key. |
Added notes to README.md. |
|
@drewpayment great job, could you run |
|
Will do, I need to make a couple modifications to the prompt too because Gemini is hallucinating once in awhile. |
|
@drewpayment let me know when this is ready <3 |
|
I worked on it a little bit last night but I'm a bit perplexed because it keeps using the initial default prompt and writing commit details based on it. Trying to find the best way to undo that bit without impacting anything else. |
|
Hey @drewpayment, I actually work on Google's agent assist so I have some insight into your issue. The reason that's happening is because you need to give the model context, examples, and a message. The implementation I used is also different I had to use @google-cloud/aiplatform and used application creds for auth. My result being this: Try using this as your prompt and see if the issue resolves itself. If it does then structure the format like this going forward. The freeform paragraph is the context, the first pair of input/output is the example, the second one is the message. The code I wrote was quick and dirty, it works for me but it's not in state to open a PR. Let me know if this doesn't fix your issue and I'll take a day or so to clean it up and open a PR on your repo. Edit: I only had to make change in gemini.ts. Also it looks like you're using pnpm, did you mean to try to merge the pnpm lockfile? |
|
Thanks for the notes, @matt-degraffenreid ! I haven't been able to work on cleaning this up this week yet, but I was hoping I would be able to just make the prompt changes directly in |
|
let me know when i should take a look, merge and test it |
eceb170 to
0ac7211
Compare
|
@drewpayment please run |
|
This is still on my list! I will try to get it cleaned up and ready tonight. |
✨ (utils/engine.ts): add support for Gemini engine ♻️ (openAi.ts & utils/engine.ts): add support for OCO_API_KEY env variable to configure apiKey 📝 (README.md): update documentation to reflect the new changes and configuration options ⬆️ (package.json): add @google/generative-ai dependency 🔧 (src/commands/config.ts): add configuration options for the Gemini engine and update validation logic to support both OpenAI and Gemini API keys 🔧 (src/commands/prepare-commit-msg-hook.ts, src/server.ts): update to use OCO_API_KEY instead of OCO_OPENAI_API_KEY ✨ (src/engine/gemini.ts): implement the Gemini engine for generating commit messages ✨ Add support for Gemini and Ollama AI engines This commit introduces support for two new AI engine options: Gemini and Ollama. These engines can be used as alternatives to the existing OpenAI engine for generating commit messages. Additionally, this commit includes several improvements and bug fixes: - **(utils/engine.ts):** Adds support for Gemini and Ollama engines. - **(openAi.ts & utils/engine.ts):** Adds support for `OCO_API_KEY` environment variable to configure the API key for all engines. - **(generateCommitMessageFromGitDiff.ts):** Improves the logic for handling multiple commit messages by using `Promise.all`. - **(engine/index.ts):** Exports all available AI engines for easier access. - **(engine/ollama.ts):** Removes unnecessary export of `ollamaAi` instance. - **(engine/openAi.ts):** Makes the `OpenAi` class exportable and removes unnecessary exports.
…EY env variable Adds support for the `OCO_OPENAI_API_KEY` environment variable as an alternative to `OCO_API_KEY` to configure the API key for OpenAI and Gemini AI providers. Updates the default Gemini model to `gemini-1.5-pro-latest` and includes it in the list of valid models. Also, improves the type safety and structure of messages and chat history in the Gemini engine. Additionally, enhances the handling of diffs and commit message generation, including splitting large diffs and merging file diffs to optimize token usage.
- Update TypeScript target and libraries in tsconfig.json to ensure compatibility. - Remove unused TypeScript Node configuration and add missing dependencies for project setup.
…ev#304) * 3.0.11 * build * docs: update ollama usage readme (di-sukharev#301) Signed-off-by: Albert Simon <albert.simon.sge@mango.com> Co-authored-by: Albert Simon <albert.simon.sge@mango.com> * 🚨 BREAKING CHANGES 🚨 - feat(engine/ollama): add support for local models and change prompt format to improve AI performance + fix(engine/ollama): fix issue with local model not responding correctly to requests The commit message is now more concise, clear, and informative. It also includes a breaking changes section that highlights the significant changes made in this commit. --------- Signed-off-by: Albert Simon <albert.simon.sge@mango.com> Co-authored-by: di-sukharev <dim.sukharev@gmail.com> Co-authored-by: Albert Simon <47634918+willyw0nka@users.noreply.github.com> Co-authored-by: Albert Simon <albert.simon.sge@mango.com> Co-authored-by: Константин Шуткин <shutkin-kn@mosmetro.ru>
✨ (utils/engine.ts): add support for Gemini engine ♻️ (openAi.ts & utils/engine.ts): add support for OCO_API_KEY env variable to configure apiKey 📝 (README.md): update documentation to reflect the new changes and configuration options ⬆️ (package.json): add @google/generative-ai dependency 🔧 (src/commands/config.ts): add configuration options for the Gemini engine and update validation logic to support both OpenAI and Gemini API keys 🔧 (src/commands/prepare-commit-msg-hook.ts, src/server.ts): update to use OCO_API_KEY instead of OCO_OPENAI_API_KEY ✨ (src/engine/gemini.ts): implement the Gemini engine for generating commit messages ✨ Add support for Gemini and Ollama AI engines This commit introduces support for two new AI engine options: Gemini and Ollama. These engines can be used as alternatives to the existing OpenAI engine for generating commit messages. Additionally, this commit includes several improvements and bug fixes: - **(utils/engine.ts):** Adds support for Gemini and Ollama engines. - **(openAi.ts & utils/engine.ts):** Adds support for `OCO_API_KEY` environment variable to configure the API key for all engines. - **(generateCommitMessageFromGitDiff.ts):** Improves the logic for handling multiple commit messages by using `Promise.all`. - **(engine/index.ts):** Exports all available AI engines for easier access. - **(engine/ollama.ts):** Removes unnecessary export of `ollamaAi` instance. - **(engine/openAi.ts):** Makes the `OpenAi` class exportable and removes unnecessary exports.
…EY env variable Adds support for the `OCO_OPENAI_API_KEY` environment variable as an alternative to `OCO_API_KEY` to configure the API key for OpenAI and Gemini AI providers. Updates the default Gemini model to `gemini-1.5-pro-latest` and includes it in the list of valid models. Also, improves the type safety and structure of messages and chat history in the Gemini engine. Additionally, enhances the handling of diffs and commit message generation, including splitting large diffs and merging file diffs to optimize token usage.
|
Opened new PR #332 |





Added a new AI provider and enabled Google Gemini Pro support. Only added the Gemini Pro 1.0 model for now, but should be able to simply add to the models list if adopted.
Added this issue: #308