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

RAG — Upload and Query

Upload

let r = client.rag_upload("Document content...", Some("policy.txt".into())).await?;

Query

let r = client.rag_query("What is the refund policy?", None).await?;
println!("{}", r.answer);

One-shot

let answer = client.rag_ask("What are the terms?", "Payment due in 30 days...").await?;

Streaming

let req = ChatRequest::quick("auto", "Summarize");
let mut rx = client.chat_stream(req).await?;
while let Some(chunk) = rx.recv().await {
    print!("{}", chunk.unwrap_or_default());
}

Clone this wiki locally