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

✨ Add thresholding for detector results #52

Merged
merged 14 commits into from
May 30, 2024

Conversation

evaline-ju
Copy link
Collaborator

@evaline-ju evaline-ju commented May 29, 2024

Following #51 , score thresholding for detector results will be done by the orchestrator. Each detector will need a configured default_threshold, expected to be added when the detector is added to the orchestrator config.

If a user provides a threshold through the API, this will be used. Otherwise the default threshold will be used.

Example config parts API that should give the same output if default_threshold: 0.5 were configured for detector model_name

"guardrail_config": {
        "input": { "models": {}},
        "output": {"models":{"model_name": {}}}
    },
"guardrail_config": {
        "input": { "models": {}},
        "output": {"models":{"model_name": {"threshold": 0.5}}}
    },

This PR also adds documentation/comments for the config structs and updates the validation error for request validation from #42.

For: #24

@evaline-ju evaline-ju marked this pull request as ready for review May 29, 2024 20:25
src/config.rs Outdated Show resolved Hide resolved
src/orchestrator.rs Outdated Show resolved Hide resolved
@evaline-ju evaline-ju force-pushed the detector-threshold branch from 1d5b38b to d425520 Compare May 30, 2024 18:34
@evaline-ju evaline-ju force-pushed the detector-threshold branch from d425520 to 9cce8b0 Compare May 30, 2024 18:36
@declark1 declark1 self-requested a review May 30, 2024 19:00
Copy link
Collaborator

@declark1 declark1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just once last suggested change inline.

src/orchestrator.rs Outdated Show resolved Hide resolved
Signed-off-by: Evaline Ju <[email protected]>

Co-authored-by: declark1 <[email protected]>
@declark1 declark1 self-requested a review May 30, 2024 19:42
Copy link
Collaborator

@declark1 declark1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@evaline-ju evaline-ju merged commit d29f6c4 into foundation-model-stack:main May 30, 2024
1 check passed
@evaline-ju evaline-ju deleted the detector-threshold branch May 30, 2024 22:32
@evaline-ju evaline-ju linked an issue May 30, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deal with the Threshold filter from detectors at Orchestrator
2 participants