forked from sectechsociety/Prometheus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api.py
More file actions
67 lines (54 loc) · 1.87 KB
/
Copy pathtest_api.py
File metadata and controls
67 lines (54 loc) · 1.87 KB
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
#!/usr/bin/env python3
"""
Test script for Prometheus API
Tests the /augment endpoint with various inputs
"""
import requests
import json
BASE_URL = "http://localhost:8000"
def test_health():
"""Test health endpoint"""
print("=" * 60)
print("Testing /health endpoint...")
print("=" * 60)
response = requests.get(f"{BASE_URL}/health")
print(f"Status: {response.status_code}")
print(json.dumps(response.json(), indent=2))
print()
def test_augment(raw_prompt, target_model="ChatGPT", num_variations=2):
"""Test augment endpoint"""
print("=" * 60)
print(f"Testing /augment endpoint")
print(f"Prompt: {raw_prompt}")
print(f"Model: {target_model}")
print("=" * 60)
payload = {
"raw_prompt": raw_prompt,
"target_model": target_model,
"num_variations": num_variations
}
response = requests.post(f"{BASE_URL}/augment", json=payload)
print(f"Status: {response.status_code}")
if response.status_code == 200:
data = response.json()
print(f"\nModel Type: {data['model_type']}")
print(f"RAG Context Used: {data['rag_context_used']}")
print(f"RAG Chunks: {data['rag_chunks_count']}")
print(f"\nEnhanced Prompts ({len(data['enhanced_prompts'])}):")
print("-" * 60)
for i, enhanced in enumerate(data['enhanced_prompts'], 1):
print(f"\n[Variation {i}]")
print(enhanced)
print("-" * 60)
else:
print(f"Error: {response.text}")
print()
if __name__ == "__main__":
# Test health first
test_health()
# Test ChatGPT enhancement
test_augment("Explain machine learning", "ChatGPT", 2)
# Test Claude enhancement
test_augment("Write a function to sort a list", "Claude", 1)
# Test Gemini enhancement
test_augment("Summarize a research paper", "Gemini", 1)