Microsoft.Extensions.AI Integration
Cross-SDK comparison
See the centralized MEAI documentation for feature matrices and comparisons across all tryAGI SDKs.
The Guardrails SDK provides AIFunction tool wrappers compatible with Microsoft.Extensions.AI. These tools can be used with any IChatClient to give AI models LLM output validation, hallucination detection, and PII protection capabilities.
Available Tools
| Tool | Method | Description |
|---|---|---|
ValidateWithGuard |
AsValidateTool() |
Validates LLM output against a named Guard |
ListGuards |
AsListGuardsTool() |
Lists all available Guards |
GetGuard |
AsGetGuardTool() |
Gets a specific Guard's configuration |
Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
Tool Details
ValidateWithGuard
The primary tool for content validation. It takes a guard name and LLM output text, then returns:
- Whether validation passed or failed
- Validation summaries per validator
- Error spans highlighting problematic content
- Any suggested fixes
1 2 | |
ListGuards
Lists all Guards the user has access to, including their validators and configurations.
GetGuard
Fetches detailed configuration for a specific Guard by name.