Skip to main content

ragaas — SDK Python

SDK oficial do RAGaaS — RAG, memória de agente e gateway OpenAI-compatible. Zero dependências (só stdlib).

pip install ragaas
from ragaas import Ragaas, RagaasError

ragaas = Ragaas(api_key="rag_sk_...")   # chave da subconta

# pergunta com RAG completo (resposta + fontes citadas + run_id)
r = ragaas.query("qual o prazo de matrícula?")
print(r["answer"], r["sources"], r["run_id"])

# busca híbrida sem LLM
hits = ragaas.search("matrícula", kb_id="kb_...", top_k=8)["hits"]

# memória de agente (sempre armazenada no Brasil)
ragaas.memory.add("o cliente prefere respostas curtas", kind="preference")
ragaas.memory.search("preferências", top_k=5)

# streaming pelo gateway OpenAI-compatible
for delta in ragaas.chat_stream({"model": "ragaas", "messages": msgs}, kb_id="kb_..."):
    print(delta["choices"][0]["delta"].get("content", ""), end="", flush=True)

Robustez (produção)

  • Retry/backoff exponencial com jitter em 429/502/503/504 e falhas de rede; respeita Retry-After. Configurável via max_retries / timeout.
  • Erros tipados: RagaasError expõe .status, .message, .request_id (header X-Request-Id — cite no suporte) e .retryable.
try:
    r = ragaas.query("...")
except RagaasError as e:
    print(e.status, e.message, "request:", e.request_id, "retryable:", e.retryable)

Superfície

query · search · feedback · ingest_url · ingest_file · documents.{list,get,delete} · knowledge_bases.{list,get} · runs.get · memory.{add,search,list,update,delete} · chat · chat_stream · embeddings · models.

Especificação completa (OpenAPI 3.1): https://api.ragaas.com.br/openapi.json · docs: https://ragaas.com.br/developers

Metadata

Release files for ragaas 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ragaas 0.1.0
File Size Uploaded
ragaas-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ragaas 0.1.0
File Interpreter ABI Platform
ragaas-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / ragaas-0.1.0.tar.gz

Download URL ragaas-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a5e0dc9fc2a1ad0239e224e16bbe813490983e36a0c029cf1ef141c9c85d7f55
BLAKE2b-256 checksum
How to use checksums
c7db626c37d27d590b2d0d31e042cfb72750b6f75ab49e56cc8671b4b7afd921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / ragaas-0.1.0-py3-none-any.whl

Download URL ragaas-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
160ac653be6726229b2cc4e23fd9a7d2e2e57040b6baa70273f75e3b42a8447a
BLAKE2b-256 checksum
How to use checksums
883c6cb173c8b9e062ee8682aaf894a757a9184eefa5ea012dcb54d195343fbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page