Skip to content

Commit 491734b

Browse files
committed
Fix API key validation and improve quickstart visibility
- Move OPENAI_API_KEY validation to beginning of for fail-fast behavior
1 parent eaac047 commit 491734b

File tree

3 files changed

+79
-51
lines changed

3 files changed

+79
-51
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"permissions": {
33
"allow": [
44
"Bash(source venv/bin/activate)",
5-
"Bash(python -m pytest:*)"
5+
"Bash(python -m pytest:*)",
6+
"Bash(unset OPENAI_API_KEY)",
7+
"Bash(evalview run:*)"
68
],
79
"deny": [],
810
"ask": []

README.md

Lines changed: 64 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,60 @@
2020
2121
---
2222

23+
## 🚀 Try it in 2 minutes
24+
25+
```bash
26+
# Install
27+
pip install evalview
28+
29+
# Set your OpenAI API key (for LLM-as-judge evaluation)
30+
export OPENAI_API_KEY='your-key-here'
31+
32+
# Run the quickstart - creates demo agent, test case, runs everything!
33+
evalview quickstart
34+
```
35+
36+
**That's it!** You'll see a working test pass with tool accuracy, output quality, cost, and latency metrics.
37+
38+
<details>
39+
<summary>📺 See example output</summary>
40+
41+
```
42+
━━━ EvalView Quickstart ━━━
43+
44+
Step 1/4: Creating demo agent...
45+
✅ Demo agent created
46+
47+
Step 2/4: Creating test case...
48+
✅ Test case created
49+
50+
Step 3/4: Creating config...
51+
✅ Config created
52+
53+
Step 4/4: Starting demo agent and running test...
54+
✅ Demo agent running
55+
56+
Running test...
57+
58+
Test Case: Quickstart Test
59+
Score: 95.0/100
60+
Status: ✅ PASSED
61+
62+
Tool Accuracy: 100.0%
63+
✅ Correct: calculator
64+
65+
Output Quality: 90.0/100
66+
67+
Performance:
68+
Cost: $0.0010
69+
Latency: 27ms
70+
71+
🎉 Quickstart complete!
72+
```
73+
</details>
74+
75+
---
76+
2377
## Why EvalView?
2478

2579
- **🔓 Fully Open Source** – No SaaS, no vendor lock-in, runs entirely on your machine
@@ -35,7 +89,7 @@
3589
- **Automated evaluation** – Tool accuracy, output quality (LLM-as-judge), cost, and latency
3690
- **CI/CD ready** – JSON reports and exit codes for automated testing
3791

38-
## Quick taste
92+
## Example test case
3993

4094
```yaml
4195
# tests/test-cases/stock-analysis.yaml
@@ -61,14 +115,11 @@ $ evalview run
61115
Cost: $0.0234 | Latency: 3.4s
62116
```
63117
64-
> **Note:** Requires `OPENAI_API_KEY` for LLM-as-judge evaluation. [Get one here](https://platform.openai.com/api-keys)
65-
66118
---
67119
68-
## ⚡ Zero-Config Connection
120+
## Connect to your agent
69121
70-
**Before:** Manual port configuration, endpoint guessing, adapter selection...
71-
**After:** Just run `evalview connect` - it figures everything out!
122+
Already have an agent running? Use `evalview connect` to auto-detect it:
72123

73124
```bash
74125
# Start your agent (LangGraph, CrewAI, whatever)
@@ -134,59 +185,22 @@ We're building a hosted version:
134185

135186
## Quickstart
136187

137-
### Step 1: Install
138-
188+
**Fastest way (recommended):**
139189
```bash
140190
pip install evalview
191+
export OPENAI_API_KEY='your-key-here'
192+
evalview quickstart
141193
```
142194

143-
Or install from source:
144-
```bash
145-
git clone https://github.com/hidai25/EvalView.git
146-
cd EvalView
147-
pip install -e .
148-
```
149-
150-
### Step 2: Initialize
195+
This creates a demo agent, test case, starts everything, and runs your first test in under 2 minutes.
151196

197+
**For existing agents:**
152198
```bash
153-
# Set up your project
154-
evalview init --interactive
155-
```
156-
157-
This creates:
158-
- `.evalview/config.yaml` - Agent endpoint configuration
159-
- `tests/test-cases/example.yaml` - Example test case
160-
161-
### Step 3: Configure (Optional)
162-
163-
Edit `.evalview/config.yaml` if needed:
164-
165-
```yaml
166-
adapter: http
167-
endpoint: http://localhost:3000/api/agent # Your agent URL
168-
timeout: 30.0
169-
```
170-
171-
### Step 4: Configure Environment
172-
173-
```bash
174-
# Copy the example environment file
175-
cp .env.example .env
176-
177-
# Edit .env and add your OpenAI API key
178-
# Get yours at: https://platform.openai.com/api-keys
179-
```
180-
181-
### Step 5: Run
182-
183-
```bash
184-
# Run tests
199+
pip install evalview
200+
evalview init --interactive # Configure for your agent
185201
evalview run
186202
```
187203

188-
Done! 🎉
189-
190204
---
191205

192206
## Installation

evalview/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,18 @@ async def _run_async(
10611061
from evalview.core.retry import RetryConfig, with_retry
10621062
from evalview.core.config import ScoringWeights
10631063

1064+
# Validate OPENAI_API_KEY upfront (required for LLM-as-judge evaluation)
1065+
openai_api_key = os.getenv("OPENAI_API_KEY")
1066+
if not openai_api_key:
1067+
console.print("\n[red bold]❌ Error: OPENAI_API_KEY is required[/red bold]\n")
1068+
console.print("EvalView uses LLM-as-judge to evaluate output quality.")
1069+
console.print("Please set your OpenAI API key:\n")
1070+
console.print(" [cyan]export OPENAI_API_KEY='your-key-here'[/cyan]")
1071+
console.print("\nOr add it to your .env file:")
1072+
console.print(" [cyan]echo 'OPENAI_API_KEY=your-key-here' >> .env[/cyan]\n")
1073+
console.print("[dim]Get your API key at: https://platform.openai.com/api-keys[/dim]")
1074+
return
1075+
10641076
if debug:
10651077
console.print("[dim]🐛 Debug mode enabled - will show raw responses[/dim]\n")
10661078
verbose = True # Debug implies verbose

0 commit comments

Comments
 (0)