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

# Übersicht über das Python SDK

> Installieren und konfigurieren Sie das RAIL Score Python SDK - synchron und asynchron Clients.

## Installation

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

Installieren Sie mit optionalen Extras für Anbieterintegrationen:

```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]" # Alle LLM-Anbieter
pip install "rail-score-sdk[agents]"       # CrewAI, LangGraph, AutoGen
pip install "rail-score-sdk[telemetry]"    # OpenTelemetry Unterstützung
pip install "rail-score-sdk[dev]"          # Entwicklungstools
```

## Sync-Client

```python theme={null}
from rail_score_sdk import RailScoreClient

client = RailScoreClient(api_key="YOUR_RAIL_API_KEY")

result = client.eval(content="Ihr KI-generierter Text hier", mode="basic")
print(f"RAIL Score: {result.rail_score.score}/10")
```

`RailScoreClient` gibt typisierte Dataclass-Objekte zurück. Greifen Sie auf Scores zu als `result.rail_score.score`, `result.dimension_scores["fairness"].score` usw.

## 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="Ihr Text hier", mode="basic")
    print(result["rail_score"]["score"])  # Gibt rohe Dictionnaires zurück

asyncio.run(main())
```

`AsyncRAILClient` gibt rohe Dictionnaires anstelle von Dataclasses zurück.

## Schlüsselklassen

| Klasse            | Zweck                                          |
| ----------------- | ---------------------------------------------- |
| `RailScoreClient` | Sync-Client - alle Kernmethoden                |
| `AsyncRAILClient` | Async-Client - alle Kernmethoden               |
| `RAILSession`     | Qualität über ein Gespräch hinweg verfolgen    |
| `Policy`          | Deklarative Regeln zur Durchsetzung von Scores |
| `Rule`            | Einzelne Richtlinienregel                      |
| `RAILMiddleware`  | Jede asynchrone LLM-Funktion umwickeln         |

## Fehlerbehandlung

```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("Überprüfen Sie Ihren API-Schlüssel")
except InsufficientCreditsError as e:
    print(f"Benötigen {e.required} Credits, haben {e.balance}")
except RateLimitError:
    print("Anfragen verlangsamen")
except ContentTooHarmfulError:
    print("Inhalt an der Sicherheitsschicht blockiert")
```

## Was kommt als Nächstes

<CardGroup cols={2}>
  <Card title="Bewertung" icon="magnifying-glass" href="/sdk/python/evaluation">
    Beispiele für synchrone und asynchrone Bewertungen.
  </Card>

  <Card title="Sichere Regeneration" icon="rotate" href="/sdk/python/safe-regeneration">
    Automatische Korrektur von Inhalten unterhalb des Schwellenwerts.
  </Card>

  <Card title="Sitzungen & Richtlinien" icon="gavel" href="/sdk/python/sessions">
    Qualität über Gespräche hinweg verfolgen.
  </Card>

  <Card title="Integrationen" icon="plug" href="/integrations/overview">
    Anbieter-Wrapper für OpenAI, Gemini, Anthropic.
  </Card>
</CardGroup>
