This commit is contained in:
Cyberes 2023-10-03 00:13:55 -06:00
parent 0f5e22191c
commit 62eb0196cc
1 changed files with 2 additions and 2 deletions

View File

@ -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():