Official Python SDK for Reliant — LLM Reliability Layer
Project description
reliant-py
SDK oficial Python para o Reliant — LLM Reliability Layer.
Instalação
pip install reliant-py
Início rápido
from reliant import Reliant
client = Reliant(
api_key="rel_...", # Dashboard → Configurações
user_id="seu-user-id", # Dashboard → Configurações
base_url="https://reliant-production.up.railway.app",
)
# Executar com validação garantida
result = client.execute(
prompt="Extraia os dados: João Silva, joao@email.com",
schema_id="id-do-seu-schema",
provider="anthropic",
model="claude-sonnet-4-20250514",
)
print(result["output"]) # {"name": "João Silva", "email": "joao@email.com"}
print(result["metadata"]["attempts"]) # 1
print(result["metadata"]["latency_ms"]) # 743
Providers suportados
anthropic— Claude Sonnet, Opus, Haikuopenai— GPT-4o, GPT-4o-minigemini— Gemini 1.5 Pro, Flashgroq— Llama 3, Mixtralmistral— Mistral Large, Small
Métodos
execute()
result = client.execute(
prompt="seu prompt",
schema_id="sch_...",
provider="anthropic",
model="claude-sonnet-4-20250514",
max_retries=3,
)
# result["success"] → bool
# result["output"] → dict com o output validado
# result["status"] → "success" | "fallback" | "failed"
# result["metadata"]["execution_id"]
# result["metadata"]["attempts"]
# result["metadata"]["latency_ms"]
# result["metadata"]["tokens_used"]
list_schemas() / get_schema() / create_schema()
schemas = client.list_schemas()
schema = client.get_schema("id-do-schema")
new_schema = client.create_schema(
name="Extração de Contato",
slug="contact-extraction",
definition={
"type": "object",
"required": ["name", "email"],
"properties": {
"name": {"type": "string"},
"email": {"type": "string"},
}
},
safe_fallback={"name": None, "email": None},
)
list_executions() / get_execution()
executions = client.list_executions(limit=20, status="failed")
execution = client.get_execution("exec_...")
get_metrics()
metrics = client.get_metrics(days=30)
print(metrics["success_rate"]) # 98.5
print(metrics["total_executions"]) # 1420
print(metrics["estimated_cost_usd"]) # 0.0842
Tratamento de erros
from reliant import Reliant, ReliantException
try:
result = client.execute(...)
except ReliantException as e:
print(f"Erro {e.status_code}: {e}")
Requisitos
- Python >= 3.7
- Sem dependências externas
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
reliant_py-1.0.0.tar.gz
(2.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reliant_py-1.0.0.tar.gz.
File metadata
- Download URL: reliant_py-1.0.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4ef4cdc3712384a79382ad3ade1fb29c2a18f7b89b2212a58bf8aee4869a090
|
|
| MD5 |
780ceb64763d4186bac7571afd170d4c
|
|
| BLAKE2b-256 |
bbe1f3a894f8c613eb88425fcd8ed3c1c094cbf4a03b1609401109c8b39e2af7
|
File details
Details for the file reliant_py-1.0.0-py3-none-any.whl.
File metadata
- Download URL: reliant_py-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5508aec262a09cd4cc5d46f135670e9074be257620082d6d1a943bc375e75e9
|
|
| MD5 |
904d71bee86dbd7a2b870e4f2f4b0e2b
|
|
| BLAKE2b-256 |
6a687753d8a92ad5ee7d07f734aed2c461bd59950cd5a82782b2f18bb5fcef23
|