Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize mask validation error #145

Open
evaline-ju opened this issue Jul 31, 2024 · 0 comments
Open

Standardize mask validation error #145

evaline-ju opened this issue Jul 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@evaline-ju
Copy link
Collaborator

evaline-ju commented Jul 31, 2024

Describe the bug

Currently while most validation errors return 422, failing masks validation on the classification endpoints returns 400 with an error like

{"code":400,"details":"Failed to parse the request body as JSON: guardrail_config.input.masks[0]: trailing characters at line 5 column 44"}%

Sample Code

Example call

curl -v -H "Content-Type: application/json" -k --request POST \
--data '{"inputs": "There once was...",
    "model_id": "llm-model-id",
    "guardrail_config": {
        "input": {
            "models": {}, "masks": [[0, 6, 7]]
        },
        "output": {
            "models": {"detector-id": {}}
        }
    }
}' \
    http://localhost:8033/api/v1/task/server-streaming-classification-with-text-generation

Expected behavior

422/same code as validation errors. In case all request validation is updated from 400 to 422 we still want the error message to be informative about masks format (only start, end) rather than referring to "trailing characters" which is less intuitive

Error can look like the case of "masks": [[0, 6]] which returns
{"code":422,"details":"invalid masks"}

Observed behavior

{"code":400,"details":"Failed to parse the request body as JSON...

@evaline-ju evaline-ju added the bug Something isn't working label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant