This commit is contained in:
parent
0f5e22191c
commit
62eb0196cc
|
@ -10,11 +10,11 @@ def check_moderation_endpoint(prompt: str):
|
||||||
}
|
}
|
||||||
response = requests.post('https://api.openai.com/v1/moderations', headers=headers, json={"input": prompt}, timeout=10)
|
response = requests.post('https://api.openai.com/v1/moderations', headers=headers, json={"input": prompt}, timeout=10)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
print(response.text)
|
print(response)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
response = response.json()
|
response = response.json()
|
||||||
|
|
||||||
print(response.text)
|
print(response)
|
||||||
|
|
||||||
offending_categories = []
|
offending_categories = []
|
||||||
for k, v in response['results'][0]['categories'].items():
|
for k, v in response['results'][0]['categories'].items():
|
||||||
|
|
Reference in New Issue