Open samfhritp opened 1 week ago
sry for the unbearable formatting btw.
Basic Rest troubleshooting steps I've used. Try curl with the desired json data and headers. Use test.Test probe until you have your Rest generator config working. Add debug lines to rest.py to see what the data looks like (copy below commented sections and uncomment) If the llm app is poorly designed and returning HTTP errors for non-API issues, then you might need to capture the errors and continue (see below). I get this with with some LLM Firewalls as well as an internal app that has a very limited input length. Below is my modifications to put errors into the response. From there you could have a detector looking for the errors and adding that to the detector list.
Code from my hacked Rest generator.(1)
req_kArgs = {
data_kw: request_data,
"headers": request_headers,
"timeout": self.request_timeout,
}
# logging.debug( "RestGenerator Request content: %s"
# % repr(req_kArgs)
# )
resp = self.http_function(self.uri, **req_kArgs)
# logging.debug( "RestGenerator Response content: %s"
# % repr(resp.content)
# )
if resp.status_code in self.ratelimit_codes:
response = [f"REST URI Rate limited: {resp.status_code} - {resp.reason}"]
elif str(resp.status_code)[0] == "3":
response = [f"REST URI redirection: {resp.status_code} - {resp.reason} \n {resp.content}"]
elif str(resp.status_code)[0] == "4":
response = [f"REST URI client error: {resp.status_code} - {resp.reason} \n {resp.content}"]
elif str(resp.status_code)[0] == "5":
response = [f"REST URI server error: {resp.status_code} - {resp.reason} \n {resp.content}"]
elif not self.response_json:
return [str(resp.text)]
(1) Note to my employer: I'm helping someone out, not contributing code to an open source project.
Summary
Hi all,
i'm trying to get garak to run with the rest generator on an llm project i'm in atm. Whatever i do, i always get 422. been testing all the id's, token and post/get requests without problems. maybe someone has any idea on what i'm doing wrong. i will put some copied info out of my shell (redacted of course)
Relevant information
This is how my jsonfile.json looks like: