SDKs
SDK Python
The official SDK for Python. Zero external dependencies, works with Python 3.8+.
Installation
bash
pip install reliant-py
Initialization
python
from reliant import Reliant
client = Reliant(
api_key="rel_...",
base_url="https://reliant-production.up.railway.app"
)
Available methods
client.execute()
python
result = client.execute(
prompt="Extract data: John Smith, john@email.com",
schema_id="sch_...",
provider="anthropic",
model="claude-sonnet-4-20250514",
max_retries=3, # optional
)
print(result.output) # dict with the output
print(result.success) # True or False
print(result.status) # 'success', 'fallback' or 'failed'
print(result.metadata.attempts)
print(result.metadata.latency_ms)
print(result.metadata.tokens_used)
client.create_schema()
python
schema = client.create_schema(
name="Contact Extraction",
slug="contact-extraction",
definition={
"type": "object",
"required": ["name", "email"],
"properties": {
"name": {"type": "string"},
"email": {"type": "string"},
}
},
safe_fallback={"name": None, "email": None}
)
print(schema.id) # created schema ID
print(schema.version) # current version
client.list_schemas()
python
schemas = client.list_schemas()
for schema in schemas:
print(schema.id, schema.name, schema.version)
client.get_metrics()
python
metrics = client.get_metrics()
print(metrics['total_executions'])
print(metrics['success_rate'])
print(metrics['avg_latency_ms'])
Error handling
python
from reliant import Reliant, ReliantError
try:
result = client.execute(...)
except ReliantError as e:
print(f"Error {e.status_code}: {e}")