Skip to content

Commit 7ff96cf

Browse files
committed
update readme and .env
1 parent a2bfa7d commit 7ff96cf

File tree

3 files changed

+67
-10
lines changed

3 files changed

+67
-10
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Fireworks API Key for SVGBench Vercel Function
2+
# Copy this file to .env and add your actual API key
3+
4+
# Your Fireworks API key (get it from https://fireworks.ai)
5+
FIREWORKS_API_KEY=your-fireworks-api-key-here
6+
7+
# Note: The API key can also be passed in the request payload
8+
# by RemoteRolloutProcessor. This .env file serves as a fallback.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.vercel
22
.env
3+
!.env.example

eval_protocol/quickstart/svg_agent/vercel_svg_server/README.md

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ A Vercel serverless function that handles model calls for the SVGBench evaluatio
1111

1212
## Setup
1313

14+
### Option 1: Local Development (Recommended)
15+
1416
1. **Install Vercel CLI:**
1517
```bash
1618
npm install -g vercel
@@ -21,7 +23,28 @@ A Vercel serverless function that handles model calls for the SVGBench evaluatio
2123
cd eval_protocol/quickstart/svg_agent/vercel_svg_server
2224
```
2325

24-
3. **Deploy to Vercel:**
26+
3. **Create .env file with your API key (optional):**
27+
```bash
28+
cp .env.example .env
29+
# Edit .env and add your actual API key
30+
```
31+
32+
**Note:** The API key can be provided either:
33+
- In the request payload (automatically handled by `RemoteRolloutProcessor`)
34+
- In a local `.env` file (fallback option)
35+
36+
4. **Start local development server:**
37+
```bash
38+
vercel dev
39+
```
40+
41+
Your function will be available at `http://localhost:3000`
42+
43+
### Option 2: Production Deployment
44+
45+
1. **Follow steps 1-2 above**
46+
47+
2. **Deploy to Vercel:**
2548
```bash
2649
vercel deploy
2750
```
@@ -30,17 +53,13 @@ A Vercel serverless function that handles model calls for the SVGBench evaluatio
3053
- Create a new project (or link existing)
3154
- Set project name (e.g., `svgbench-server`)
3255

33-
4. **Set environment variable:**
34-
```bash
35-
vercel env add FIREWORKS_API_KEY
36-
# Enter your Fireworks API key when prompted
37-
```
38-
39-
5. **Deploy to production:**
56+
3. **Deploy to production:**
4057
```bash
4158
vercel --prod
4259
```
4360

61+
**Note:** The function receives the API key in the request payload (automatically handled by `RemoteRolloutProcessor`), but can also fall back to a local `.env` file if needed.
62+
4463
## Usage
4564

4665
The function provides these endpoints:
@@ -62,13 +81,16 @@ Processes SVGBench evaluation requests.
6281
"metadata": {
6382
"rollout_id": "some-unique-id"
6483
},
84+
"api_key": "your-fireworks-api-key",
6585
"completion_params": {
6686
"temperature": 0.8,
6787
"max_tokens": 32768
6888
}
6989
}
7090
```
7191

92+
**Note:** The `api_key` field is automatically populated by `RemoteRolloutProcessor` from your local `FIREWORKS_API_KEY` environment variable.
93+
7294
**Response format:**
7395
```json
7496
{
@@ -90,18 +112,44 @@ Health check endpoint - returns server status.
90112

91113
## Integration with Tests
92114

93-
Update your `test_remote_svgbench.py` to use your deployed URL:
115+
### Local Development
116+
For local testing with `vercel dev`:
94117

95118
```python
96119
@evaluation_test(
97120
rollout_processor=RemoteRolloutProcessor(
98-
remote_base_url="https://your-deployment-url.vercel.app",
121+
remote_base_url="http://localhost:3000",
99122
timeout_seconds=300,
100123
),
101124
# ... other params
102125
)
103126
```
104127

128+
### Production Deployment
129+
For testing with deployed function:
130+
131+
```python
132+
@evaluation_test(
133+
rollout_processor=RemoteRolloutProcessor(
134+
remote_base_url="https://vercel-svg-server.vercel.app",
135+
timeout_seconds=300,
136+
),
137+
# ... other params
138+
)
139+
```
140+
141+
**Note:** The `RemoteRolloutProcessor` automatically passes your local `FIREWORKS_API_KEY` environment variable to the Vercel function.
142+
143+
## API Key Configuration
144+
145+
The function uses the following priority for API keys:
146+
147+
1. **Request payload** (`req.api_key`) - Automatically provided by `RemoteRolloutProcessor`
148+
2. **Local .env file** (`FIREWORKS_API_KEY`) - Fallback for local development
149+
3. **Environment variable** - Fallback for other deployment methods
150+
151+
This flexible approach works for both local development and production deployment.
152+
105153
## Architecture
106154

107155
- **Remote**: Model calls (handled by this serverless function)

0 commit comments

Comments
 (0)