Spaces:
Sleeping
Sleeping
Commit
·
ceb8d7f
1
Parent(s):
61382ad
Judge ID Added
Browse files
app.py
CHANGED
@@ -33,13 +33,21 @@ def llama_guard_classify(conv_prefix, response):
|
|
33 |
|
34 |
def classify_prompt(category,conv_prefix, response):
|
35 |
url = f"{API_ENDPOINT}/api/v1/judge/safety"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
payload = {
|
38 |
"model_name": "collinear_guard_classifier_beta",
|
39 |
"nano_model_type": category,
|
40 |
"conversation": conv_prefix,
|
41 |
"response": response,
|
42 |
-
"space_id":"8b560bf4-3a76-4f00-b378-b528d02445c0"
|
|
|
43 |
}
|
44 |
headers = {
|
45 |
"Authorization": f"Bearer {API_KEY}",
|
@@ -47,6 +55,7 @@ def classify_prompt(category,conv_prefix, response):
|
|
47 |
}
|
48 |
|
49 |
response = requests.request("POST", url, json=payload, headers=headers)
|
|
|
50 |
|
51 |
result = response.json()
|
52 |
judgement = result['judgement']
|
|
|
33 |
|
34 |
def classify_prompt(category,conv_prefix, response):
|
35 |
url = f"{API_ENDPOINT}/api/v1/judge/safety"
|
36 |
+
judge_id=None
|
37 |
+
if category=='response':
|
38 |
+
judge_id='eaad6030-c269-4ce8-8322-454127c380b8'
|
39 |
+
elif category=='prompt':
|
40 |
+
judge_id='7750e114-db3d-422f-be54-9692eb07baec'
|
41 |
+
else:
|
42 |
+
judge_id='7fd02b72-655b-4992-9380-ba496eefe12a'
|
43 |
|
44 |
payload = {
|
45 |
"model_name": "collinear_guard_classifier_beta",
|
46 |
"nano_model_type": category,
|
47 |
"conversation": conv_prefix,
|
48 |
"response": response,
|
49 |
+
"space_id":"8b560bf4-3a76-4f00-b378-b528d02445c0",
|
50 |
+
"judge_id":judge_id
|
51 |
}
|
52 |
headers = {
|
53 |
"Authorization": f"Bearer {API_KEY}",
|
|
|
55 |
}
|
56 |
|
57 |
response = requests.request("POST", url, json=payload, headers=headers)
|
58 |
+
print(response.json())
|
59 |
|
60 |
result = response.json()
|
61 |
judgement = result['judgement']
|