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
Provider integrations के लिए optional extras के साथ install करें:
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]" # सभी 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 typed dataclass objects return करता है। Scores को access करें जैसे result.rail_score.score, result.dimension_scores["fairness"].score, वगैरह।
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" ]) # Raw dicts return करता है
asyncio.run(main())
AsyncRAILClient raw dictionaries return करता है, dataclasses नहीं।
Key classes
Class Purpose RailScoreClientSync client - सभी core methods AsyncRAILClientAsync client - सभी core methods RAILSessionConversation में quality track करें PolicyScore enforcement के लिए declarative rules RuleIndividual policy rule RAILMiddlewareकिसी भी async LLM function को wrap करें
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 ( "API key check करें" )
except InsufficientCreditsError as e:
print ( f " { e.required } credits चाहिए, { e.balance } हैं" )
except RateLimitError:
print ( "Requests slow करें" )
except ContentTooHarmfulError:
print ( "Content safety layer पर block हो गया" )
आगे क्या देखें
Evaluation Sync और async eval examples।
Safe Regeneration Threshold से नीचे वाले content को auto-fix करें।
Sessions & Policy Conversations में quality track करें।
Integrations OpenAI, Gemini, Anthropic के लिए provider wrappers।