Shardul Dhekane commited on
Commit ·
fe2fd48
1
Parent(s): edaad73
README Update
Browse filesDocker Composer changes (Removed HF_TOKEN Ref ---> Changed to API_KEY)
- README.md +69 -1
- docker-compose.yml +6 -6
README.md
CHANGED
|
@@ -1,2 +1,70 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Code Review Agent Environment
|
| 3 |
+
sdk: docker
|
| 4 |
+
app_port: 7860
|
| 5 |
+
---
|
| 6 |
|
| 7 |
+
# Code Review Agent Environment
|
| 8 |
+
|
| 9 |
+
Submission for the Meta x Hugging Face OpenEnv Hackathon.
|
| 10 |
+
|
| 11 |
+
Authors / Members:
|
| 12 |
+
- Ashish
|
| 13 |
+
- Shardul
|
| 14 |
+
- Harshit
|
| 15 |
+
|
| 16 |
+
## Overview
|
| 17 |
+
|
| 18 |
+
This project is a real-world code review environment for AI agents. The agent receives a code diff plus surrounding context and must identify issues, suggest fixes, and decide whether changes should be approved or rejected.
|
| 19 |
+
|
| 20 |
+
## Live Section
|
| 21 |
+
Live Space: [huggingface.co/spaces/Spirit-26/code-review-environment](https://huggingface.co/spaces/Spirit-26/code-review-environment)
|
| 22 |
+
|
| 23 |
+
## Core Features
|
| 24 |
+
|
| 25 |
+
- OpenEnv-style `reset()`, `step()`, and `state()` API
|
| 26 |
+
- Pydantic-based action, observation, and state models
|
| 27 |
+
- 6 review tasks across easy, medium, and hard difficulty
|
| 28 |
+
- Deterministic graders with scores from `0.0` to `1.0`
|
| 29 |
+
- Reward shaping for partial progress and invalid actions
|
| 30 |
+
- Docker support and Hugging Face Space deployment
|
| 31 |
+
- Baseline inference script at the repository root: `inference.py`
|
| 32 |
+
|
| 33 |
+
## Required Environment Variables
|
| 34 |
+
|
| 35 |
+
Use an OpenAI-compatible endpoint.
|
| 36 |
+
|
| 37 |
+
- `API_BASE_URL`
|
| 38 |
+
- `MODEL_NAME`
|
| 39 |
+
- `API_KEY`
|
| 40 |
+
|
| 41 |
+
Backward-compatible aliases are also supported:
|
| 42 |
+
|
| 43 |
+
- `HF_TOKEN`
|
| 44 |
+
- `OPENAI_API_KEY`
|
| 45 |
+
|
| 46 |
+
## Local Run
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
python -m venv .venv
|
| 50 |
+
.\.venv\Scripts\Activate.ps1
|
| 51 |
+
pip install -r requirements.txt
|
| 52 |
+
python inference.py --task-id bug_detection_easy_1 --max-steps 50 --output baseline_results.json
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## Validation
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
python submit.py
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Docker
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
docker build -t code-review-openenv .
|
| 65 |
+
docker run --rm -p 7860:7860 \
|
| 66 |
+
-e API_BASE_URL=https://api.openai.com/v1 \
|
| 67 |
+
-e MODEL_NAME=gpt-4o-mini \
|
| 68 |
+
-e API_KEY=<your_key> \
|
| 69 |
+
code-review-openenv
|
| 70 |
+
```
|
docker-compose.yml
CHANGED
|
@@ -6,7 +6,7 @@ services:
|
|
| 6 |
environment:
|
| 7 |
API_BASE_URL: https://api.openai.com/v1
|
| 8 |
MODEL_NAME: gpt-4
|
| 9 |
-
|
| 10 |
TEMPERATURE: 0.7
|
| 11 |
MAX_TOKENS: 2000
|
| 12 |
command: ["--task-id", "bug_detection_easy_1"]
|
|
@@ -14,9 +14,9 @@ services:
|
|
| 14 |
gemini-agent:
|
| 15 |
build: .
|
| 16 |
environment:
|
| 17 |
-
API_BASE_URL: https://generativelanguage.googleapis.com
|
| 18 |
-
MODEL_NAME: gemini-
|
| 19 |
-
|
| 20 |
command: ["--task-id", "memory_leak_medium_1"]
|
| 21 |
|
| 22 |
local-agent:
|
|
@@ -25,7 +25,7 @@ services:
|
|
| 25 |
environment:
|
| 26 |
API_BASE_URL: http://localhost:11434/v1
|
| 27 |
MODEL_NAME: llama2
|
| 28 |
-
|
| 29 |
command: ["--task-id", "security_hard_1"]
|
| 30 |
|
| 31 |
groq-agent:
|
|
@@ -33,5 +33,5 @@ services:
|
|
| 33 |
environment:
|
| 34 |
API_BASE_URL: https://api.groq.com/openai/v1
|
| 35 |
MODEL_NAME: llama2-70b-4096
|
| 36 |
-
|
| 37 |
command: ["--task-id", "bug_detection_easy_1"]
|
|
|
|
| 6 |
environment:
|
| 7 |
API_BASE_URL: https://api.openai.com/v1
|
| 8 |
MODEL_NAME: gpt-4
|
| 9 |
+
API_KEY: ${OPENAI_API_KEY}
|
| 10 |
TEMPERATURE: 0.7
|
| 11 |
MAX_TOKENS: 2000
|
| 12 |
command: ["--task-id", "bug_detection_easy_1"]
|
|
|
|
| 14 |
gemini-agent:
|
| 15 |
build: .
|
| 16 |
environment:
|
| 17 |
+
API_BASE_URL: https://generativelanguage.googleapis.com/v1beta/openai
|
| 18 |
+
MODEL_NAME: gemini-2.0-flash
|
| 19 |
+
API_KEY: ${GEMINI_API_KEY}
|
| 20 |
command: ["--task-id", "memory_leak_medium_1"]
|
| 21 |
|
| 22 |
local-agent:
|
|
|
|
| 25 |
environment:
|
| 26 |
API_BASE_URL: http://localhost:11434/v1
|
| 27 |
MODEL_NAME: llama2
|
| 28 |
+
API_KEY: not-needed
|
| 29 |
command: ["--task-id", "security_hard_1"]
|
| 30 |
|
| 31 |
groq-agent:
|
|
|
|
| 33 |
environment:
|
| 34 |
API_BASE_URL: https://api.groq.com/openai/v1
|
| 35 |
MODEL_NAME: llama2-70b-4096
|
| 36 |
+
API_KEY: ${GROQ_API_KEY}
|
| 37 |
command: ["--task-id", "bug_detection_easy_1"]
|