Skip to content

Commit 4beacbf

Browse files
Merge pull request #5 from bishalprasad321/groq-llm-support
Groq llm support
2 parents 7161d73 + 8e9e309 commit 4beacbf

12 files changed

Lines changed: 856 additions & 231 deletions

File tree

.github/workflows/action-test.yml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
# ============================================================================
3838
# First, generate an AI-powered PR description using prpilot-summary.
3939
# This provides context for the multi-model consensus review.
40-
# Requires secrets: GEMINI_API_KEY
40+
# Requires secrets: GROQ_API_KEY
4141
# ============================================================================
4242
generate-description:
4343
name: "Step 1: Generate PR Description"
@@ -52,10 +52,10 @@ jobs:
5252
- name: Checkout code
5353
uses: actions/checkout@v4
5454

55-
- name: Check if GEMINI_API_KEY exists
55+
- name: Check if LLM API key exists
5656
id: check_secrets
5757
run: |
58-
if [ -z "${{ secrets.GEMINI_API_KEY }}" ]; then
58+
if [ -z "${{ secrets.GROQ_API_KEY }}" ]; then
5959
echo "has_key=false" >> $GITHUB_OUTPUT
6060
else
6161
echo "has_key=true" >> $GITHUB_OUTPUT
@@ -67,9 +67,9 @@ jobs:
6767
uses: bishalprasad321/prpilot-summary@v1
6868
with:
6969
github_token: ${{ secrets.GITHUB_TOKEN }}
70-
llm_api_key: ${{ secrets.GEMINI_API_KEY }}
71-
llm_provider: gemini
72-
ai_model: gemini-2.5-flash
70+
llm_api_key: ${{ secrets.GROQ_API_KEY }}
71+
llm_provider: groq
72+
ai_model: groq-1.5-mini
7373
max_diff_lines: "5000"
7474
enable_incremental_diff_processing: "true"
7575
debug: ${{ inputs.debug_enabled || 'false' }}
@@ -89,7 +89,7 @@ jobs:
8989
else
9090
echo "⚠️ Description generation encountered an error"
9191
echo "This may be expected if:"
92-
echo " - Secrets are not configured (GEMINI_API_KEY missing)"
92+
echo " - Secrets are not configured (GROQ_API_KEY missing)"
9393
echo " - No meaningful changes in the PR"
9494
echo " - LLM API is temporarily unavailable"
9595
fi
@@ -100,7 +100,7 @@ jobs:
100100
# ============================================================================
101101
# Run multi-model consensus review after description is generated.
102102
# This calls 3 independent reviewer models + 1 judge model for consensus.
103-
# Requires secrets: GEMINI_API_KEY
103+
# Requires secrets: GROQ_API_KEY
104104
# Outputs: Decision (APPROVE/REQUEST_CHANGES/COMMENT), findings, round count
105105
# ============================================================================
106106
consensus-review:
@@ -123,31 +123,31 @@ jobs:
123123
PRESET="${{ inputs.model_preset || 'default' }}"
124124
case $PRESET in
125125
high-capability)
126-
echo "reviewer_models=gemini-2.5-pro,gemini-2.5-flash,gemini-2.5-flash-lite" >> $GITHUB_OUTPUT
127-
echo "judge_model=gemini-2.5-pro" >> $GITHUB_OUTPUT
128-
echo "preset_name=High Capability (Best Quality)" >> $GITHUB_OUTPUT
126+
echo "reviewer_models=llama-3.3-70b-versatile,openai/gpt-oss-120b,openai/gpt-oss-20b" >> $GITHUB_OUTPUT
127+
echo "judge_model=openai/gpt-oss-120b" >> $GITHUB_OUTPUT
128+
echo "preset_name=Groq Maximum Quality" >> $GITHUB_OUTPUT
129129
;;
130130
cost-optimized)
131-
echo "reviewer_models=gemini-2.5-flash,gemini-2.5-flash-lite,gemini-2.5-flash-lite" >> $GITHUB_OUTPUT
132-
echo "judge_model=gemini-2.5-flash" >> $GITHUB_OUTPUT
133-
echo "preset_name=Cost Optimized (Lower Cost)" >> $GITHUB_OUTPUT
131+
echo "reviewer_models=llama-3.1-8b-instant,openai/gpt-oss-20b,openai/gpt-oss-20b" >> $GITHUB_OUTPUT
132+
echo "judge_model=openai/gpt-oss-120b" >> $GITHUB_OUTPUT
133+
echo "preset_name=Groq Maximum Speed" >> $GITHUB_OUTPUT
134134
;;
135135
quality-optimized)
136-
echo "reviewer_models=gemini-2.5-pro,gemini-2.5-flash,gemini-2.5-flash-lite" >> $GITHUB_OUTPUT
137-
echo "judge_model=gemini-2.5-pro" >> $GITHUB_OUTPUT
138-
echo "preset_name=Quality Optimized (Best Findings)" >> $GITHUB_OUTPUT
136+
echo "reviewer_models=llama-3.3-70b-versatile,openai/gpt-oss-120b,openai/gpt-oss-20b" >> $GITHUB_OUTPUT
137+
echo "judge_model=openai/gpt-oss-120b" >> $GITHUB_OUTPUT
138+
echo "preset_name=Groq Maximum Quality" >> $GITHUB_OUTPUT
139139
;;
140140
*)
141-
echo "reviewer_models=gemini-2.5-flash,gemini-2.5-flash-lite,gemini-2.5-pro" >> $GITHUB_OUTPUT
142-
echo "judge_model=gemini-2.5-pro" >> $GITHUB_OUTPUT
143-
echo "preset_name=Default (Balanced)" >> $GITHUB_OUTPUT
141+
echo "reviewer_models=llama-3.1-8b-instant,openai/gpt-oss-20b,llama-3.3-70b-versatile" >> $GITHUB_OUTPUT
142+
echo "judge_model=openai/gpt-oss-120b" >> $GITHUB_OUTPUT
143+
echo "preset_name=Groq Default Production" >> $GITHUB_OUTPUT
144144
;;
145145
esac
146146
147-
- name: Check if GEMINI_API_KEY exists
147+
- name: Check if LLM API key exists
148148
id: check_secrets
149149
run: |
150-
if [ -z "${{ secrets.GEMINI_API_KEY }}" ]; then
150+
if [ -z "${{ secrets.GROQ_API_KEY }}" ]; then
151151
echo "has_key=false" >> $GITHUB_OUTPUT
152152
else
153153
echo "has_key=true" >> $GITHUB_OUTPUT
@@ -159,7 +159,9 @@ jobs:
159159
uses: ./
160160
with:
161161
github_token: ${{ secrets.GITHUB_TOKEN }}
162-
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
162+
llm_provider: groq
163+
llm_api_key: ${{ secrets.GROQ_API_KEY }}
164+
llm_provider_url: https://api.groq.com/openai/v1
163165
reviewer_models: ${{ steps.model_config.outputs.reviewer_models }}
164166
judge_model: ${{ steps.model_config.outputs.judge_model }}
165167
max_consensus_rounds: "3"
@@ -198,8 +200,8 @@ jobs:
198200
else
199201
echo "⚠️ Consensus review encountered an error"
200202
echo "This may be expected if:"
201-
echo " - Secrets are not configured (GEMINI_API_KEY missing)"
202-
echo " - Selected models are not valid Gemini v1beta model codes"
203+
echo " - Secrets are not configured (GROQ_API_KEY missing)"
204+
echo " - Selected models are not valid for the current provider"
203205
echo " - API quota exceeded (check API key billing settings)"
204206
echo " - Reviewer/judge models not available"
205207
echo " - LLM API is temporarily unavailable"

README.md

Lines changed: 72 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# PR Pilot Review
22

3-
> **Intelligent Multi-Model Consensus AI PR Reviewer** — Automated code reviews with consensus from multiple Gemini AI models.
3+
> **Intelligent Multi-Model Consensus AI PR Reviewer** — Automated code reviews with consensus from configurable LLM providers like Gemini and Groq.
44
55
[![Build Status](https://github.com/bishalprasad321/prpilot-review/actions/workflows/ci.yml/badge.svg)](https://github.com/bishalprasad321/prpilot-review/actions)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
77

88
## Overview
99

10-
PR Pilot Review is a GitHub Action that performs intelligent, consensus-based code reviews on pull requests using Google's Gemini AI models. Unlike single-model reviewers, it runs **3 independent AI reviewers in parallel** and uses a **judge model to reach consensus**, ensuring more thorough and balanced code quality feedback.
10+
PR Pilot Review is a GitHub Action that performs intelligent, consensus-based code reviews on pull requests using configurable LLM providers such as Gemini or Groq. Unlike single-model reviewers, it runs **3 independent AI reviewers in parallel** and uses a **judge model to reach consensus**, ensuring more thorough and balanced code quality feedback.
1111

1212
### Key Features
1313

@@ -22,20 +22,28 @@ PR Pilot Review is a GitHub Action that performs intelligent, consensus-based co
2222

2323
## Quick Start
2424

25-
### 1. Get a Gemini API Key
25+
### 1. Choose your LLM provider
2626

27-
1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
28-
2. Click "Create API Key"
29-
3. Copy the key
27+
This action supports multiple providers today, including `gemini` and `groq`.
3028

31-
### 2. Add to GitHub Secrets
29+
### 2. Add the API key to GitHub Secrets
3230

3331
Go to your repository:
3432

3533
- **Settings****Secrets and variables****Actions**
36-
- Add secret: `GEMINI_API_KEY` (paste your key)
34+
- Add a provider-specific secret, e.g. `GROQ_API_KEY`
3735

38-
### 3. Use the Action
36+
### 3. Optional base URL for Groq OpenAI-compatible API
37+
38+
If you are using Groq's OpenAI-compatible models, set `llm_provider_url` to:
39+
40+
```yaml
41+
llm_provider_url: https://api.groq.com/openai/v1
42+
```
43+
44+
This will route requests to `https://api.groq.com/openai/v1/chat/completions` for chat-based model inference.
45+
46+
### 4. Use the Action
3947

4048
Create `.github/workflows/ai-review.yml`:
4149

@@ -61,7 +69,9 @@ jobs:
6169
- uses: bishalprasad321/prpilot-review@v1
6270
with:
6371
github_token: ${{ secrets.GITHUB_TOKEN }}
64-
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
72+
llm_provider: groq
73+
llm_api_key: ${{ secrets.GROQ_API_KEY }}
74+
llm_provider_url: https://api.groq.com/openai/v1
6575
# Optional: customize model configuration
6676
# reviewer_models: "gemini-2.5-flash,gemini-2.5-flash-lite,gemini-2.5-pro"
6777
# judge_model: "gemini-2.5-pro"
@@ -79,7 +89,9 @@ All inputs are optional (sensible defaults provided):
7989
with:
8090
# Required
8191
github_token: ${{ secrets.GITHUB_TOKEN }}
82-
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
92+
llm_provider: groq
93+
llm_api_key: ${{ secrets.GROQ_API_KEY }}
94+
llm_provider_url: https://api.groq.com/openai/v1
8395
8496
# Optional: Model Configuration
8597
reviewer_models: "gemini-2.5-flash,gemini-2.5-flash-lite,gemini-2.5-pro" # 3 models
@@ -93,47 +105,51 @@ with:
93105
debug: "false" # Verbose logging
94106
```
95107

96-
Use stable Gemini `v1beta` model codes. If you still pass legacy aliases such as `gemini-3.0-flash` or `gemini-3.1-pro`, the action will try to remap them to supported 2.x models before calling the API.
108+
Use stable provider-specific model IDs. For Gemini, use `v1beta` model codes. For Groq, use models like `llama-3.1-8b-instant`, `openai/gpt-oss-20b`, or `llama-3.3-70b-versatile` (check [Groq console](https://console.groq.com/keys) for available models).
97109

98-
### Model Presets
99-
100-
Choose models based on your needs:
101-
102-
#### Default (Recommended) ✅
110+
### Groq Example
103111

104112
```yaml
105-
reviewer_models: "gemini-2.5-flash,gemini-2.5-flash-lite,gemini-2.5-pro"
106-
judge_model: "gemini-2.5-pro"
113+
with:
114+
github_token: ${{ secrets.GITHUB_TOKEN }}
115+
llm_provider: groq
116+
llm_api_key: ${{ secrets.GROQ_API_KEY }}
117+
reviewer_models: "llama-3.1-8b-instant,openai/gpt-oss-20b,llama-3.3-70b-versatile"
118+
judge_model: "openai/gpt-oss-120b"
119+
max_consensus_rounds: "3"
120+
inline_comments_enabled: "true"
107121
```
108122

109-
Best balance of speed, quality, and cost.
123+
### Model Presets
124+
125+
Choose models based on your needs:
110126

111-
#### High Capability (Best Quality)
127+
#### Groq Default Production ✅
112128

113129
```yaml
114-
reviewer_models: "gemini-2.5-pro,gemini-2.5-flash,gemini-2.5-flash-lite"
115-
judge_model: "gemini-2.5-pro"
130+
reviewer_models: "llama-3.1-8b-instant,openai/gpt-oss-20b,llama-3.3-70b-versatile"
131+
judge_model: "openai/gpt-oss-120b"
116132
```
117133

118-
Uses most capable models. Higher cost but best findings.
134+
Best balance of production reliability and coverage.
119135

120-
#### Cost Optimized (Lowest Cost)
136+
#### Groq Maximum Speed ✅
121137

122138
```yaml
123-
reviewer_models: "gemini-2.5-flash,gemini-2.5-flash-lite,gemini-2.5-flash-lite"
124-
judge_model: "gemini-2.5-flash"
139+
reviewer_models: "llama-3.1-8b-instant,openai/gpt-oss-20b,openai/gpt-oss-20b"
140+
judge_model: "openai/gpt-oss-120b"
125141
```
126142

127-
Uses lighter models. Lower cost but lighter analysis.
143+
Optimized for faster review cycles with lighter reviewer models.
128144

129-
#### Quality Optimized (Most Findings)
145+
#### Groq Maximum Quality ✅
130146

131147
```yaml
132-
reviewer_models: "gemini-2.5-pro,gemini-2.5-flash,gemini-2.5-flash-lite"
133-
judge_model: "gemini-2.5-pro"
148+
reviewer_models: "llama-3.3-70b-versatile,openai/gpt-oss-120b,openai/gpt-oss-20b"
149+
judge_model: "openai/gpt-oss-120b"
134150
```
135151

136-
Maximum detection power. Highest cost, most comprehensive reviews.
152+
Highest quality review configuration for the deepest analysis.
137153

138154
## How It Works
139155

@@ -194,7 +210,7 @@ The action posts a GitHub review with:
194210
See detailed architecture in [docs/adr/](./docs/adr/):
195211
196212
- **ADR-001** — Multi-Model Consensus Architecture
197-
- **ADR-002** — Gemini API Integration & Model Selection
213+
- **ADR-002** — LLM Provider Integration & Model Selection
198214
- **ADR-003** — Inline Comment Mapping
199215
- **ADR-004** — Idempotency & State Management
200216
@@ -205,7 +221,7 @@ prpilot-review/
205221
├── src/
206222
│ ├── index.ts # Main orchestrator (13-step pipeline)
207223
│ ├── llm/
208-
│ │ └── llm-client.ts # Gemini API abstraction
224+
│ │ └── llm-client.ts # LLM provider abstraction
209225
│ ├── review/
210226
│ │ ├── review-orchestrator.ts # Consensus logic
211227
│ │ └── inline-comment-builder.ts # Line mapping
@@ -285,12 +301,11 @@ npm run all # Run all checks
285301

286302
## API Keys & Billing
287303

288-
### Getting a Gemini API Key
304+
### Getting an API Key
289305

290-
1. Go to [Google AI Studio](https://makersuite.google.com/app/apikey)
291-
2. Click "Create API Key"
292-
3. Select/create a project
293-
4. Copy the key and add to GitHub repo secrets
306+
1. Choose your provider: `gemini` or `groq`
307+
2. Create an API key in the provider console
308+
3. Copy the key and add it to GitHub repo secrets
294309

295310
### Free Tier Quotas
296311

@@ -302,48 +317,48 @@ The free tier has limits:
302317
If you hit quota errors:
303318

304319
1. **Upgrade to paid plan** — Recommended for production
305-
2. **Use lighter models**`gemini-2.5-flash-lite` uses fewer tokens
320+
2. **Use lighter models**`gemini-2.5-flash-lite` or Groq's smaller models like `llama-3.1-8b-instant` use fewer tokens
306321
3. **Reduce reviewer count** — Use 2 instead of 3 reviewers
307322
4. **Schedule reviews** — Spread runs across off-peak hours
308323

309-
See [quota documentation](https://ai.google.dev/gemini-api/docs/rate-limits).
324+
See provider-specific quota documentation for your chosen LLM.
310325

311326
### Costs
312327

313-
Typical cost per PR review:
328+
Typical cost per PR review will vary by provider and model selection:
314329

315-
- **Default config**$0.001-0.005 per review (3 reviewers + optional judge)
316-
- **Cost-optimized**$0.0005-0.002 per review
317-
- **Quality-optimized**$0.005-0.02 per review
330+
- **Default config**Low-cost balanced review
331+
- **Cost-optimized**Minimal token usage and fastest reviewers
332+
- **Quality-optimized**More comprehensive analysis with higher cost
318333

319-
Pricing based on [Gemini API rates](https://ai.google.dev/pricing).
334+
Pricing is provider-dependent. For Gemini, see [Gemini pricing](https://ai.google.dev/pricing).
320335

321336
## Troubleshooting
322337

323338
### Action not running?
324339

325-
- Check `GEMINI_API_KEY` is set in repo secrets
340+
- Check `llm_provider` and `llm_api_key` are configured correctly
326341
- Verify branch triggers (pull_request, branches)
327342
- Check action logs for errors
328343

329344
### Zero findings even with code changes?
330345

331346
- Enable debug mode to see full model responses
332-
- Check if models are available in v1beta API
333-
- Try different model preset
334-
- Verify PR has actual code changes
347+
- Check whether the selected models are valid for your provider
348+
- Try a different model preset
349+
- Verify the PR has actual code changes
335350

336351
### Quota exceeded errors?
337352

338-
- Check your billing plan at [Google Cloud Console](https://console.cloud.google.com)
339-
- Switch to paid plan or upgrade quota
340-
- Use lighter models (flash-lite variants)
353+
- Check your provider billing or free tier quota
354+
- Switch to paid plan or upgrade quota if available
355+
- Use lighter models where supported
341356

342357
### Model not found errors?
343358

344-
- Verify model names match available list
345-
- Models must be in `v1beta` API
346-
- Check [available models](https://ai.google.dev/gemini-api/docs/models/gemini)
359+
- Verify model names match your provider's available models
360+
- For Gemini, check [Gemini models](https://ai.google.dev/gemini-api/docs/models/gemini)
361+
- For Groq, check your Groq account model docs
347362

348363
### Slow reviews?
349364

@@ -439,7 +454,7 @@ MIT License — See [LICENSE](./LICENSE) file
439454

440455
## Acknowledgments
441456

442-
- Built with [Gemini AI API](https://ai.google.dev/)
457+
- Built with configurable LLM providers such as Gemini or Groq
443458
- GitHub Actions integration via [@actions/core](https://github.com/actions/toolkit)
444459
- Code bundling via [@vercel/ncc](https://github.com/vercel/ncc)
445460

0 commit comments

Comments
 (0)