Skip to main content
rag.chat() runs retrieval and answer generation together. It is stateless: pass history in and persist the returned history for the next turn.

Basic Chat

Result fields:

Streaming Chat

chat_stream() yields structured event dicts and ends with a final event.
Typical event types are progress, token, error, and final.
chat_stream() streams normal RAG chat. It does not stream agentic tool execution.

Chat Tuning

Low-confidence modes are answer_with_caution, ask_clarifying_question, refuse_grounded_answer, and return_no_answer.

Reranking in Chat

Configure reranker={"provider": "voyage", "model": "rerank-2-lite"} on RagRails(...), or pass reranker=rag.reranker(...) to one call.

llm()

Agentic Tools and Tool Calling

rag.chat() does not execute tools. Tool execution requires application-owned authorization, confirmation, allowlists, secrets, side-effect policy, and audit logs. For SDK apps, use the lower-level LLM method complete_with_tools() and run the tool loop inside your own application boundary. The ready-made web_fetch and api_call loop is available in the interactive CLI (ragrails chat with no query argument), not in rag.chat().

Tool Calling

Build your own SDK tool loop.

Query

Use chat in the query workflow.