Quickstart
Get a first grounded answer back from the chatbot in a few minutes.
Audience: developers integrating the HTTP API.
What you will accomplish: send a question to POST /api/v1/chat and read the answer,
its citations, and its grounding verdict.
Estimated time: about 15 minutes.
Prerequisites
- A running server reachable at the base URL
http://127.0.0.1:8000. (To start one, follow the project README:uvicorn main:app --reload, ordocker-compose up --build.) - At least one ingested document if you want a grounded answer in
strictmode — see Ingesting documents. With no documents, strict mode will politely decline, which is expected behavior, not an error. curl(or any HTTP client).
Send your first question
Step 1: Confirm the server is up
A healthy server responds to a health check. A
degradedresult means Redis or ChromaDB is unreachable — chat may still work, but retrieval can be impaired.Step 2: Post a question to /api/v1/chat
Send a stable
X-User-Idso the bot can remember the conversation, and ask a question your documents can answer.Step 3: Read the answer, sources, and grounding
The response includes
answer, structuredsources[], andmeta(includinggroundedandcorrelation_id). Quote thecorrelation_idif you ever need support.
1. Check health
curl http://127.0.0.1:8000/healthIf it fails: connection refused means the server is not running — start it first. A degraded body means a dependency (Redis / ChromaDB) is down.
2. Ask a question
curl -X POST http://127.0.0.1:8000/api/v1/chat \
-H "Content-Type: application/json" \
-H "X-User-Id: alice" \
-d '{"q":"How long do I have to return an item?","mode":"strict","top_k":4}'If it fails: A 422 means the body failed validation (e.g. empty q); a 429 means you are rate limited — wait for the Retry-After seconds.
Expected result
A successful call returns JSON shaped like this:
{
"answer": "You can return any item within 30 days of purchase.",
"sources": [
{
"label": "return_policy.pdf",
"doc_id": "return_policy",
"score": 0.86,
"page": 1,
"snippet": "Customers may return any item within 30 days..."
}
],
"meta": {
"mode": "strict",
"lang": "en",
"self_ingested": false,
"grounded": "supported",
"grounded_score": 0.86,
"correlation_id": "b1f3…",
"model": "gpt-4o-mini"
}
}Verify your result
- Verify: The HTTP status is
200and the body contains a non-emptyanswer. - Verify:
sources[]lists at least one citation with ascoreand asnippetyou can verify against the answer. - Verify:
meta.groundedreadssupported(orpartial) for an on-topic question. - Verify: The response carries an
X-Correlation-Idheader matchingmeta.correlation_id.
Common failure modes
Related next steps
- Go deeper on the request body and modes in Chatting.
- Render a typing effect with Streaming (SSE).
- Add your own knowledge in Ingesting documents.