Skip to content

Support all popular LLM providers#33

Merged
ATechAdventurer merged 8 commits intomainfrom
cameron/eng-722
Aug 6, 2025
Merged

Support all popular LLM providers#33
ATechAdventurer merged 8 commits intomainfrom
cameron/eng-722

Conversation

@ATechAdventurer
Copy link
Copy Markdown
Member

This pull request introduces significant updates to the handling of environment variables and LLM (Large Language Model) provider configuration. The changes aim to improve type safety, modularize environment handling, and remove redundant code. Below is a summary of the most important changes:

Environment Variable Management Enhancements:

  • Introduced a centralized env object for managing environment variables, replacing direct usage of process.env across the codebase. This ensures type safety and consistency. (app/env/server.ts, app/env/server.tsR4-L28)
  • Added conditional Zod schemas for provider API keys, making keys mandatory only for the selected provider. (app/env/server.ts, app/env/server.tsR4-L28)
  • Updated .env.example to include optional configuration for OpenRouter and Ollama providers.

Refactoring LLMManager:

  • Refactored LLMManager to use the centralized env.server object instead of process.env or its own _env property. This simplifies initialization and ensures consistency. (app/lib/modules/llm/manager.ts, [1] [2]
  • Removed redundant LLMManager references from constants, moving related logic to app/utils/constants/server.ts. (app/utils/constants.ts, [1] [2]; app/utils/constants/server.ts, [3]

Updates to LLM Base Provider:

  • Modified BaseProvider to use the centralized env object for retrieving API keys and base URLs, removing dependency on LLMManager. (app/lib/modules/llm/base-provider.ts, [1] [2] [3]

API Endpoint Improvements:

Miscellaneous:

These changes collectively improve code maintainability, enhance type safety, and streamline the configuration of LLM providers.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @ATechAdventurer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the application's LLM provider configuration by centralizing and type-safing environment variable management. It refactors core LLM modules to depend on this new system, improving code maintainability, consistency, and robustness, while also expanding support for additional LLM providers.

Highlights

  • Centralized Environment Variable Management: I've introduced a new, type-safe env object (app/env/server.ts) to centralize environment variable handling, replacing direct process.env usage across the codebase. This includes conditional Zod schemas that make API keys mandatory only for the currently selected LLM provider.
  • LLM Provider Configuration Refactoring: I've refactored LLMManager and BaseProvider to leverage the new centralized env object for retrieving API keys and base URLs, removing redundant environment variable access logic and improving consistency.
  • Enhanced API Key Validation: I've updated the check-env-key API route (app/api/check-env-key/[provider]/route.ts) to validate environment variables using the new env object, enhancing error handling and type safety for API key checks.
  • Improved Code Structure and Maintainability: I've separated server-specific constants into a new file (app/utils/constants/server.ts) and updated imports accordingly, contributing to a cleaner and more modular codebase.
  • Expanded LLM Provider Support: I've updated .env.example to include optional configuration for OpenRouter and Ollama, indicating broader support for popular LLM providers.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances environment variable handling and LLM provider configuration. The review focuses on ensuring consistent and correct usage of the new env object, particularly in check-env-key and base-provider files, to maximize type safety and maintainability.

Comment thread app/api/check-env-key/[provider]/route.ts Outdated
Comment thread app/lib/modules/llm/base-provider.ts Outdated
Comment thread app/lib/modules/llm/base-provider.ts Outdated
Comment thread app/api/check-env-key/[provider]/route.ts Outdated
@ATechAdventurer ATechAdventurer requested a review from kapicic August 4, 2025 21:19
ATechAdventurer and others added 3 commits August 5, 2025 15:38
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ATechAdventurer ATechAdventurer requested review from bears4barrett and kapicic and removed request for kapicic August 6, 2025 16:53
Comment thread app/env/server.ts Outdated
@ATechAdventurer ATechAdventurer merged commit 3adb7ce into main Aug 6, 2025
4 checks passed
@ATechAdventurer ATechAdventurer deleted the cameron/eng-722 branch August 6, 2025 21:39
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.

2 participants