> ## 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.

# Python SDK Overview

> RAIL Score Python SDK install और configure करें - sync और async clients।

## Installation

```bash theme={null}
pip install rail-score-sdk
```

Provider integrations के लिए optional extras के साथ install करें:

```bash theme={null}
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

```python theme={null}
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

```python theme={null}
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                                    |
| ----------------- | ------------------------------------------ |
| `RailScoreClient` | Sync client - सभी core methods             |
| `AsyncRAILClient` | Async client - सभी core methods            |
| `RAILSession`     | Conversation में quality track करें        |
| `Policy`          | Score enforcement के लिए declarative rules |
| `Rule`            | Individual policy rule                     |
| `RAILMiddleware`  | किसी भी async LLM function को wrap करें    |

## Error handling

```python theme={null}
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 हो गया")
```

## आगे क्या देखें

<CardGroup cols={2}>
  <Card title="Evaluation" icon="magnifying-glass" href="/sdk/python/evaluation">
    Sync और async eval examples।
  </Card>

  <Card title="Safe Regeneration" icon="rotate" href="/sdk/python/safe-regeneration">
    Threshold से नीचे वाले content को auto-fix करें।
  </Card>

  <Card title="Sessions & Policy" icon="gavel" href="/sdk/python/sessions">
    Conversations में quality track करें।
  </Card>

  <Card title="Integrations" icon="plug" href="/integrations/overview">
    OpenAI, Gemini, Anthropic के लिए provider wrappers।
  </Card>
</CardGroup>
