Skip to content

Feat: Add initial support for v1/messages#42

Closed
RobGeada wants to merge 1 commit into
trustyai-explainability:developfrom
RobGeada:AnthropicMessagesSupport
Closed

Feat: Add initial support for v1/messages#42
RobGeada wants to merge 1 commit into
trustyai-explainability:developfrom
RobGeada:AnthropicMessagesSupport

Conversation

@RobGeada
Copy link
Copy Markdown

Description

Using the vLLM conversion between /v1/messages and /v1/chat/completions as a template, this PR adds a similar feature to the NeMo Guardrails server. This allows for the use of the NeMo Guardrails server as the backend endpoint for Claude Code, e.g.:

❯ I've set up some PII filters to auto-redact email addresses, can you try to generate some more?

⏺ FYI, I've run a guardrail.

  Absolutely! Generating realistic test data for PII filters is a smart way to stress-test your regex or NLP-based redaction pipelines. Here
   are a few more sample email addresses, deliberately varied to cover common structural quirks that often challenge naive parsers:

  - <EMAIL_ADDRESS> (utilizes the standard plus-addressing syntax for filtering/tracking)
  - <EMAIL_ADDRESS> (combines an underscore with a multi-part local name)
  - <EMAIL_ADDRESS> (includes a numeric identifier and a nested subdomain structure)
  - <EMAIL_ADDRESS> (uses hyphens in the domain paired with a role-based prefix)
  - <EMAIL_ADDRESS> (mixes a role with a number and a modern application TLD)
  - <EMAIL_ADDRESS> (multiple periods, initials, and a hyphenated domain)
  - <EMAIL_ADDRESS> (longer, department-specific format with a year suffix)

  These are all safely fictional and routed through reserved or common test domains, so they won't attempt real delivery, but they should
  give your PII redaction layer a solid workout across different separators, lengths, casing, and structural edge cases.

  If you're building validation or parsing logic, I'd also recommend throwing in a few intentionally malformed or non-standard variations
  (like user@ or .hidden@domain..com) to ensure your filter gracefully rejects or flags them rather than crashing. Let me know if you need
  them batch-exported in CSV/JSON format, or if you want to test against case-insensitivity, UTF-8/Unicode email quirks, or
  internationalized domain names (IDNs)!

Related Issue(s)

Checklist

  • I've read the CONTRIBUTING guidelines.
  • I've updated the documentation if applicable.
  • I've added tests if applicable.
  • @mentions of the person or team responsible for reviewing proposed changes.

@RobGeada RobGeada requested a review from m-misiura April 22, 2026 14:48
Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

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

Bandit found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@RobGeada RobGeada force-pushed the AnthropicMessagesSupport branch from e187a6d to e032ef3 Compare April 22, 2026 14:52
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 22, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 76.56250% with 75 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@6a3cfd1). Learn more about missing BASE report.

Files with missing lines Patch % Lines
nemoguardrails/server/anthropic_serving.py 69.58% 66 Missing ⚠️
nemoguardrails/server/schemas/anthropic.py 91.08% 9 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             develop      #42   +/-   ##
==========================================
  Coverage           ?   76.89%           
==========================================
  Files              ?      202           
  Lines              ?    20732           
  Branches           ?        0           
==========================================
  Hits               ?    15941           
  Misses             ?     4791           
  Partials           ?        0           
Flag Coverage Δ
python 76.89% <76.56%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
nemoguardrails/server/api.py 75.50% <100.00%> (ø)
nemoguardrails/server/schemas/anthropic.py 91.08% <91.08%> (ø)
nemoguardrails/server/anthropic_serving.py 69.58% <69.58%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RobGeada RobGeada closed this Apr 22, 2026
@RobGeada RobGeada force-pushed the AnthropicMessagesSupport branch from e032ef3 to 6a3cfd1 Compare April 22, 2026 15:02
@RobGeada RobGeada reopened this Apr 22, 2026
@RobGeada RobGeada closed this Apr 30, 2026
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.

3 participants