Update Fiddler Guardrails API to match new specification#1619
Open
kevinfiddlerai wants to merge 3 commits intoNVIDIA-NeMo:developfrom
Open
Update Fiddler Guardrails API to match new specification#1619kevinfiddlerai wants to merge 3 commits intoNVIDIA-NeMo:developfrom
kevinfiddlerai wants to merge 3 commits intoNVIDIA-NeMo:developfrom
Conversation
- Change Safety API from 'prompt' to 'input' field - Change Faithfulness API to use strings instead of lists - Add fdl_roleplaying category to safety detection - Add unit tests to verify request payload format Signed-off-by: Kevin Truong kevin@fiddler.ai
Contributor
Greptile OverviewGreptile SummaryUpdated Fiddler Guardrails API integration to match the new specification. The changes simplify the request format by using strings instead of lists and add support for the new Key changes:
The changes are well-tested with three new unit tests that mock the API calls and verify the exact structure of the outgoing requests, ensuring backward compatibility is broken intentionally to match the new API spec.
|
| Filename | Overview |
|---|---|
| nemoguardrails/library/fiddler/actions.py | Updates API request format from 'prompt' (list) to 'input' (string) for safety checks and from lists to strings for faithfulness checks; adds fdl_roleplaying safety category |
| tests/test_fiddler_rails.py | Adds fdl_roleplaying to existing test mocks and includes comprehensive unit tests verifying the new request payload format for safety and faithfulness endpoints |
Sequence Diagram
sequenceDiagram
participant Client as NeMo Guardrails
participant SafetyAction as call_fiddler_safety_user/bot
participant FaithAction as call_fiddler_faithfulness
participant API as Fiddler API
Note over Client,API: Safety Guardrail Flow (User/Bot Message)
Client->>SafetyAction: context with user_message or bot_message
SafetyAction->>SafetyAction: Extract message from context
SafetyAction->>SafetyAction: Build payload: {"data": {"input": message}}
SafetyAction->>API: POST /v3/guardrails/ftl-safety
API-->>SafetyAction: Response with safety scores (fdl_harmful, fdl_violent, etc., fdl_roleplaying)
SafetyAction->>SafetyAction: Calculate max score across all categories
SafetyAction->>SafetyAction: Compare score >= threshold
SafetyAction-->>Client: Return boolean result
Note over Client,API: Faithfulness Guardrail Flow
Client->>FaithAction: context with bot_message and relevant_chunks
FaithAction->>FaithAction: Extract bot_message and relevant_chunks
FaithAction->>FaithAction: Build payload: {"data": {"context": relevant_chunks, "response": bot_message}}
FaithAction->>API: POST /v3/guardrails/ftl-response-faithfulness
API-->>FaithAction: Response with fdl_faithful_score
FaithAction->>FaithAction: Compare score <= threshold
FaithAction-->>Client: Return boolean result
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
will-fiddler
approved these changes
Feb 4, 2026
|
@Pouyanpi Can you take a look? |
Collaborator
|
Thank you @kevinfiddlerai, lgtm! Just need to run pre-commits and push to resolve the Lint job failure. |
Author
|
Thank you @Pouyanpi, I just re-pushed above |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Kevin Truong kevin@fiddler.ai
Description
Made changes to account for new Fiddler Guardrail API formatting and fdl_roleplaying category
Related Issue(s)
None
Fiddler Reviewer: @copperstick6
Checklist