Skip to content

Commit

Permalink
log & skip past NVCF 4xx errors (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
leondz authored Feb 29, 2024
1 parent ae9b82d commit 7b6438a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions garak/generators/nvcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,17 @@ def _call_model(self, prompt: str) -> str:
if 400 <= response.status_code < 600:
logging.warning("nvcf : returned error code %s", response.status_code)
logging.warning("nvcf : returned error body %s", response.content)
if response.status_code == 500 and json.loads(response.content)[
"detail"
].startswith("Input value error"):
if response.status_code >= 500:
if response.status_code == 500 and json.loads(response.content)[
"detail"
].startswith("Input value error"):
logging.warning("nvcf : skipping this prompt")
return None
else:
response.raise_for_status()
else:
logging.warning("nvcf : skipping this prompt")
return None
else:
response.raise_for_status()

else:
response_body = response.json()
Expand Down

0 comments on commit 7b6438a

Please sign in to comment.