File size: 2,221 Bytes
59671c4
0ec7101
 
 
 
 
c921fe2
0ec7101
59671c4
0ec7101
59671c4
 
0ec7101
 
 
 
fd5c1e1
 
 
 
 
 
 
0ec7101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c921fe2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
title: Prompt A/B Tester
emoji: πŸ”¬
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: 1.52.1
app_file: app.py
pinned: false
license: mit
---

# Prompt A/B Tester

Web application for testing and comparing the performance of two OpenAI GPT prompt versions with A/B testing methodology.

## Author
Marek Staniszewski
Heuristica
🌐 www.heuristica.pl
πŸ“§ staniszewski@heuristica.pl
For questions, suggestions, or support, please contact the author.

## Features

- **API Key Management**: Securely store OpenAI API key in Streamlit secrets
- **Model Selection**: Choose from available GPT models (gpt-4o, gpt-4, gpt-3.5-turbo)
- **Parameter Configuration**:
  - Temperature (0.0 - 2.0)
  - Max Tokens (100 - 4000)
  - Number of responses (1-50)
- **Two Input Methods**:
  - Upload `.md` or `.txt` files
  - Paste text directly
- **Progress Tracking**: Real-time progress bars and logs
- **Interactive Rating**: Rate responses on a 1-5 scale
- **Results Visualization**: Compare prompts with statistics
- **CSV Export**: Download results with metadata

## Usage

### 1. Configuration

1. Go to "βš™οΈ Configuration" tab
2. Enter your OpenAI API key
3. Select model and adjust parameters
4. Save settings

### 2. Run Test

1. Go to "πŸš€ Test" tab
2. Either upload two files OR paste two prompts
3. Click "Run Test"
4. Monitor progress

### 3. Rate Responses

1. After generation, go to "⭐ Rating" tab
2. Rate each response (1-5)
3. Click "Calculate Results"

### 4. View Results

1. Review statistics in "πŸ“Š Results" tab
2. Export to CSV if needed

## Configuration on Hugging Face Spaces

To use this app on Hugging Face Spaces:

1. Go to Settings β†’ Repository secrets
2. Add a new secret:
   - **Name**: `OPENAI_API_KEY`
   - **Value**: Your OpenAI API key

## Cost Estimation

Approximate costs per test (2025 pricing):

| Model | 10 responses (5A + 5B) | 20 responses (10A + 10B) |
|-------|------------------------|---------------------------|
| gpt-4o | ~$0.05 | ~$0.10 |
| gpt-4-turbo | ~$0.15 | ~$0.30 |
| gpt-4 | ~$0.30 | ~$0.60 |
| gpt-3.5-turbo | ~$0.01 | ~$0.02 |

## Project Information

**Version**: 2.0 (Streamlit)
**Created**: 2025-10-14
**License**: MIT
**Contact**: www.Heuristica.pl