Skip to content
Benmebrouk edited this page Apr 12, 2026 · 1 revision

RAG — Upload and Query

Upload documents, then ask questions. Every answer is verified against the sources.

Upload

result = client.rag_upload(
    content="Our refund policy allows returns within 60 days...",
    filename="policy.txt",
)
print(result.document_id)   # "user::abc-def-..."
print(result.chunks_count)  # 3

Query

result = client.rag_query("What is the refund policy?")
print(result.answer)
print(result.sources)
print(result.get_confidence())  # 0.0 to 1.0

One-shot

answer = client.rag_ask(
    question="What are the payment terms?",
    text="Payment is due within 30 days of invoice..."
)

Supported Formats

Plain text, Markdown, JSON, YAML, CSV via rag_upload(). PDF, DOCX, images via upload_file().

Clone this wiki locally