मुख्य सामग्री पर जाएं
SDK 2.6.0 में added। हर API key एक application से bound है जिसका governance policy centrally dashboard में configured है। ये तीन methods आपके code को runtime पर वह configuration को read करने देते हैं — startup checks, dashboards, और monitoring के लिए useful। ये read-only हैं और कोई credits consume नहीं करते

Application configuration

get_config() application को return करता है जिससे key bound है, इसका governance policy, और क्या enforcement actively responses को shape कर रहा है या केवल इन्हें observe कर रहा है।
from rail_score_sdk import RailScoreClient

client = RailScoreClient(api_key="YOUR_RAIL_API_KEY")

cfg = client.get_config()

print(f"Application: {cfg.application.id} ({cfg.application.environment})")
print(f"Plan:        {cfg.application.plan}")
print(f"Enforcement: {cfg.policy.enforcement}")   # log_only | block | regenerate
print(f"Eval mode:   {cfg.policy.eval_mode}")      # basic | deep
print(f"Threshold:   {cfg.policy.overall_threshold}")
print(f"Mode:        {cfg.enforcement.mode}")      # enforce | monitor

if cfg.policy.locked:
    print("Policy is locked by an administrator; per-request overrides are ignored.")

Plan capabilities

get_capabilities() यह report करता है कि key का plan क्या access कर सकता है — evaluation modes, compliance frameworks, agent और DPDP features, और request limits। इसे use करें behavior को adapt करने के लिए बिना plan assumptions को hard-code किए।
caps = client.get_capabilities()

print(f"Plan: {caps.plan}")
print(f"Frameworks: {caps.compliance.get('frameworks')}")
print(f"DPDP evidence available: {caps.dpdp.get('evidence')}")   # Pro+ only
print(f"Requests/day: {caps.limits.get('requests_per_day')}")     # None = unlimited

Dimension metadata

get_dimensions() आठ RAIL dimensions को return करता है weight और threshold के साथ जो आपके application के लिए configured है, plus score bands जिसमें एक result fall होता है।
dims = client.get_dimensions()

for d in dims.dimensions:
    print(f"{d.get('name'):14} weight={d.get('weight')} threshold={d.get('threshold')}")

for band in dims.score_bands:
    print(band.get("band"), ">=", band.get("min"))
हर typed result भी एक .raw dict को expose करता है unmodified response के साथ, तो नए fields हमेशा reachable होते हैं भले ही SDK ने अभी एक typed accessor add नहीं किया।

Async

Async client एक ही तीन methods को expose करता है:
import asyncio
from rail_score_sdk import AsyncRAILClient

async def main():
    client = AsyncRAILClient(api_key="YOUR_RAIL_API_KEY")
    caps = await client.get_capabilities()
    print(caps["plan"])  # async client raw dicts return करता है

asyncio.run(main())

Configuration API

इन methods के पीछे के REST endpoints।

Policy Engine

कैसे enforcement, thresholds, और locking work करते हैं।