Documentation Index Fetch the complete documentation index at: https://docs.responsibleailabs.ai/llms.txt
Use this file to discover all available pages before exploring further.
Installation
pip install rail-score-sdk
Install with optional extras for provider integrations:
pip install "rail-score-sdk[openai]" # OpenAI wrapper
pip install "rail-score-sdk[anthropic]" # Anthropic wrapper
pip install "rail-score-sdk[google]" # Gemini wrapper
pip install "rail-score-sdk[litellm]" # LiteLLM wrapper
pip install "rail-score-sdk[integrations]" # All LLM providers
pip install "rail-score-sdk[agents]" # CrewAI, LangGraph, AutoGen
pip install "rail-score-sdk[telemetry]" # OpenTelemetry support
pip install "rail-score-sdk[dev]" # Development tools
Sync client
from rail_score_sdk import RailScoreClient
client = RailScoreClient( api_key = "YOUR_RAIL_API_KEY" )
result = client.eval( content = "Your AI-generated text here" , mode = "basic" )
print ( f "RAIL Score: { result.rail_score.score } /10" )
RailScoreClient returns typed dataclass objects. Access scores as result.rail_score.score, result.dimension_scores["fairness"].score, etc.
Async client
import asyncio
from rail_score_sdk import AsyncRAILClient
async def main ():
client = AsyncRAILClient( api_key = "YOUR_RAIL_API_KEY" )
result = await client.eval( content = "Your text here" , mode = "basic" )
print (result[ "rail_score" ][ "score" ]) # Returns raw dicts
asyncio.run(main())
AsyncRAILClient returns raw dictionaries rather than dataclasses.
Key classes
Class Purpose RailScoreClientSync client - all core methods AsyncRAILClientAsync client - all core methods RAILSessionTrack quality across a conversation PolicyDeclarative rules for score enforcement RuleIndividual policy rule RAILMiddlewareWrap any async LLM function
Error handling
from rail_score_sdk import (
RailScoreClient,
AuthenticationError,
InsufficientCreditsError,
RateLimitError,
ContentTooHarmfulError,
)
client = RailScoreClient( api_key = "YOUR_RAIL_API_KEY" )
try :
result = client.eval( content = "..." , mode = "deep" )
except AuthenticationError:
print ( "Check your API key" )
except InsufficientCreditsError as e:
print ( f "Need { e.required } credits, have { e.balance } " )
except RateLimitError:
print ( "Slow down requests" )
except ContentTooHarmfulError:
print ( "Content blocked at safety layer" )
What’s next
Evaluation Sync and async eval examples.
Safe Regeneration Auto-fix below-threshold content.
Sessions & Policy Track quality across conversations.
Integrations Provider wrappers for OpenAI, Gemini, Anthropic.