File size: 900 Bytes
b2b6341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import json
import os
import sys
from pathlib import Path
from groq import Groq

# Add project root to sys.path
sys.path.append(str(Path(__file__).resolve().parent.parent))

from backend.config import GROQ_API_KEY

client = Groq(api_key=GROQ_API_KEY)
model = "qwen/qwen3-32b"

# Read sample 450
with open("data/training/legal_rag_dataset.jsonl", "r", encoding="utf-8") as f:
    lines = f.readlines()
    sample = json.loads(lines[450])

print(f"Sample to evaluate: {sample['input'][:100]}...")

prompt = f"Evaluate this sample. Return JSON with 'score' and 'decision'.\n\n{json.dumps(sample)}"

try:
    response = client.chat.completions.create(
        messages=[{"role": "user", "content": prompt}],
        model=model,
        # NO response_format to see raw output
    )
    print("RAW RESPONSE:")
    print(response.choices[0].message.content)
except Exception as e:
    print(f"ERROR: {e}")