foundation-model-stack / fms-guardrails-orchestrator

🚀 Guardrails orchestration server for application of various detections on text generation input and output.
https://foundation-model-stack.github.io/fms-guardrails-orchestrator/
Apache License 2.0
3 stars 15 forks source link

Empty generated text can return 500s #130

Closed evaline-ju closed 2 months ago

evaline-ju commented 2 months ago

Describe the bug

When generated_text from an LLM is empty and any detectors are requested on classification-with-text-generation, this can trigger 500

Sample Code

curl -v -H "Content-Type: application/json" --request POST \
--data '{"inputs": "!",
    "model_id": "my-model",
    "guardrail_config": {
        "input": {
            "models": {}
        },
        "output": {
            "models": {}
        }
    }
}' \
    http://localhost:8033/api/v1/task/classification-with-text-generation

Expected behavior

200 with no generated text (and no classification results, since the detectors would be acting on empty text

Observed behavior

500

Additional context

Potentially make sure contents is passed as [""] instead of "" or [] which could trigger 422 on detectors because contents is a required field on /api/v1/text/contents [ref. https://foundation-model-stack.github.io/fms-guardrails-orchestrator/?urls.primaryName=Detector+API#/default/text_content_analysis_unary_handler]

flaviabeo commented 2 months ago

Can you assign me on this one? Debugging this 🔍