Skip to main content

SDK Python oficial do RAGaaS (ragaas.com.br) — RAG, memória de agente e gateway OpenAI-compatible

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragaas-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragaas-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file ragaas-0.1.0.tar.gz.

File metadata

  • Download URL: ragaas-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ragaas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a5e0dc9fc2a1ad0239e224e16bbe813490983e36a0c029cf1ef141c9c85d7f55
MD5 0fb3edf535af36119af31cd22dd66842
BLAKE2b-256 c7db626c37d27d590b2d0d31e042cfb72750b6f75ab49e56cc8671b4b7afd921

See more details on using hashes here.

File details

Details for the file ragaas-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ragaas-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ragaas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 160ac653be6726229b2cc4e23fd9a7d2e2e57040b6baa70273f75e3b42a8447a
MD5 3ec02564be19bfb6506355782d3787a0
BLAKE2b-256 883c6cb173c8b9e062ee8682aaf894a757a9184eefa5ea012dcb54d195343fbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page