-
Notifications
You must be signed in to change notification settings - Fork 11
Add Gemini API Client #2
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,14 @@ def create_inference_server(api_type: str): | |
| if not api_key and not auth_token: | ||
| _require_env(["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"], api_type) | ||
| return anthropic.Anthropic(api_key=api_key, auth_token=auth_token) | ||
| elif api_type in ("gemini", "google"): | ||
| api_key = os.environ.get("GEMINI_API_KEY") | ||
| if not api_key: | ||
| _require_env(["GEMINI_API_KEY"], api_type) | ||
| return openai.OpenAI( | ||
| api_key=_require_env(["GEMINI_API_KEY"], api_type), | ||
| base_url=os.environ.get("GEMINI_BASE_URL", "https://generativelanguage.googleapis.com/v1beta/openai/"), | ||
| ) | ||
|
Comment on lines
+38
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gemini branch is not reachable from the current CLI flow.
Suggested follow-up patch (outside this file)--- a/agent/main.py
+++ b/agent/main.py
@@
parser.add_argument(
- "--api_type", type=str, default="openai", choices=["openai", "claude"]
+ "--api_type",
+ type=str,
+ default="openai",
+ choices=["openai", "claude", "anthropic", "gemini", "google"],
)🤖 Prompt for AI Agents |
||
| else: | ||
| raise ValueError(f"Unsupported api_type: {api_type}") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for checking and retrieving
GEMINI_API_KEYis redundant. The_require_envfunction already handles checking for the environment variable and raising aRuntimeErrorif it's missing, while returning the value if it exists. The current implementation performs manual checks and calls the helper twice unnecessarily.