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 Google Gemini LLM support #332

Merged
merged 6 commits into from
May 25, 2024
Merged

Conversation

drewpayment
Copy link

OK, this has been long time coming. I also included a few other changes I hope you will consider:

  • tsconfig.json changes for better TypeScript support during development
  • engine.ts updated openai, ollama and gemini classes to be exported instead of instantiating instances of the classes. This will ensure that only the intended model is instantiated
  • OCO_API_KEY added this environment variable with continued support for OCO_OPENAI_API_KEY so users are not confused when setting api key
  • gemini.ts model support includes ability to use Gemini Pro 1.5 model, and will use better model completions from Gemini if the advanced model is chosen

@drewpayment drewpayment marked this pull request as draft May 4, 2024 19:32
@drewpayment drewpayment marked this pull request as ready for review May 4, 2024 19:32
@drewpayment
Copy link
Author

@di-sukharev sorry for such a big delay but cleaned up the gemini output, added some extra features around Gemini Pro 1.5 and a few other small convenience things in project I hope you'll consider.

@di-sukharev di-sukharev changed the base branch from master to dev May 5, 2024 15:44
@di-sukharev
Copy link
Owner

pls target your PRs to dev

i've changed the base to dev from master, please solve the confilicts

di-sukharev and others added 6 commits May 5, 2024 19:07
* test: ✅ add the first E2E test and configuration to CI (di-sukharev#316)

* add tests

* Add push config (di-sukharev#220)

* feat: add instructions and support for configuring gpt-4-turbo (di-sukharev#320)

* 3.0.12

* build

* feat: add 'gpt-4-turbo' to supported models in README and config validation

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>

* ✅ fix the broken E2E tests due to the addition of OCO_GITPUSH (di-sukharev#321)

* test(oneFile.test.ts): update test expectations to match new push prompt text

* build

* Feat: Add Claude 3 support (di-sukharev#318)

* 3.0.12

* build

* feat: anthropic claude 3 support

* fix: add system prompt

* fix: type check

* fix: package version

* fix: update anthropic for dependency bug fix

* feat: update build files

* feat: update version number

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>

* 🐛bug fix: enable to use the new format of OpenAI's project API Key (di-sukharev#328)

* fix(config.ts): remove validation for OCO_OPENAI_API_KEY length to accommodate variable key lengths

* build

* ♻️ refactor(config.ts): Addition of UnitTest environment and unittest for commands/config.ts#getConfig (di-sukharev#330)

* feat(jest.config.ts): update jest preset for TS ESM support and ignore patterns
feat(package.json): add test:unit script with NODE_OPTIONS for ESM
refactor(src/commands/config.ts): improve dotenv usage with dynamic paths
feat(src/commands/config.ts): allow custom config and env paths in getConfig
refactor(src/commands/config.ts): streamline environment variable access

feat(test/unit): add unit tests for config handling and utility functions

- Implement unit tests for `getConfig` function to ensure correct behavior
  in various scenarios including default values, global config, and local
  env file precedence.
- Add utility function `prepareFile` for creating temporary files during
  tests, facilitating testing of file-based configurations.

* feat(e2e.yml): add unit-test job to GitHub Actions for running unit tests on pull requests

* ci(test.yml): add GitHub Actions workflow for unit and e2e tests on pull requests

* refactor(config.ts): streamline environment variable access using process.env directly
test(config.test.ts): add setup and teardown for environment variables in tests to ensure test isolation

* feat(package.json): add `test:all` script to run all tests in Docker
refactor(package.json): consolidate Docker build steps into `test:docker-build` script for DRY principle
fix(package.json): ensure `test:unit:docker` and `test:e2e:docker` scripts use the same Docker image and remove container after run
chore(test/Dockerfile): remove default CMD to allow dynamic test script execution in Docker

* refactor(config.test.ts): anonymize API keys in tests for better security practices

* feat(config.test.ts): add tests for OCO_ANTHROPIC_API_KEY configuration

* refactor(config.ts): streamline path imports and remove unused DotenvParseOutput

- Simplify path module imports by removing default import and using named imports for `pathJoin` and `pathResolve`.
- Remove unused `DotenvParseOutput` import to clean up the code.

* refactor(config.test.ts): simplify API key mock values for clarity in tests

* test(config.test.ts): remove tests for default config values and redundant cases

- Removed tests that checked for default config values when no config or env files are present, as these scenarios are now handled differently.
- Eliminated tests for empty global config and local env files to streamline testing focus on actual config loading logic.
- Removed test for prioritizing local env over global config due to changes in config loading strategy, simplifying the configuration management.

* new version

---------

Co-authored-by: Takanori Matsumoto <matscube@gmail.com>
Co-authored-by: Moret84 <aurelienrivet@hotmail.fr>
Co-authored-by: yowatari <4982161+YOwatari@users.noreply.github.com>
Co-authored-by: metavind <94786679+metavind@users.noreply.github.com>
… MODEL]` validator to allow for dynamic model selection based on configuration (di-sukharev#337)

feat(engine/ollama.ts): integrate with config command to load OCO_MODEL from configuration and use it as the default AI engine model
…v#340)

* feat(config.ts): add 'gpt-4o' to supported model list for enhanced model options
docs(config.ts): update error message to include 'gpt-4o' in the list of supported models

* docs(README.md): update OCO_MODEL options to include 'gpt-4o' model
@di-sukharev di-sukharev changed the base branch from dev to master May 23, 2024 07:58
@di-sukharev di-sukharev changed the base branch from master to dev May 23, 2024 07:58
@di-sukharev
Copy link
Owner

@drewpayment hi, pls let me know when i can merge it

@di-sukharev di-sukharev merged commit c5ee5cd into di-sukharev:dev May 25, 2024
2 checks passed
@km-tr
Copy link
Contributor

km-tr commented May 25, 2024

@drewpayment @di-sukharev When you did the force push last time, didn't the changes to Gemini disappear?

@drewpayment
Copy link
Author

I took too long and there were a lot of conflicts. My fork is almost ready, started working on it last night to bring support to all the Google models. Just trying to finish the tests up before I resubmit the PR.

@drewpayment
Copy link
Author

I added the new PR that merged to dev with tests included.

#349

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.

None yet

6 participants