RAG app quickstart
End-to-end: create a Knowledge Base, upload a document, and ask a grounded question against it. All examples are curl; the same requests work through the OpenAI SDK with the Advania ALT base URL.
Prerequisites
- An Advania ALT API key in
$ALT_API_KEY - One PDF or Markdown file to index (a few paragraphs is enough)
1. Create the Knowledge Base
curl -sS https://api.alt.advania.ai/v1/knowledge-bases \
-H "Authorization: Bearer $ALT_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "quickstart-kb" }'
Save the returned id as $KB_ID.
2. Upload a file to Data Hub
curl -sS https://api.alt.advania.ai/v1/files \
-H "Authorization: Bearer $ALT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filename": "handbook.pdf",
"content_type": "application/pdf",
"size_bytes": 1048576
}'
Save the returned id as $FILE_ID. Follow the returned upload target to actually transfer the file bytes — see the interactive OpenAPI for the exact upload shape.
3. Attach the file to the Knowledge Base
Once the file is uploaded, attach it to $KB_ID. The platform runs the indexing pipeline asynchronously — expect a short wait before content is searchable.
4. Ask a grounded question
curl -sS https://api.alt.advania.ai/v1/retrieve-and-generate \
-H "Authorization: Bearer $ALT_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"knowledge_base_id\": \"$KB_ID\",
\"messages\": [{ \"role\": \"user\", \"content\": \"What does the handbook say about onboarding?\" }]
}"
The response includes the answer plus citations to the source passages — your app can render those alongside the text so users can verify.
Next
- How chunking and embeddings work — why indexing is asynchronous
- Citations and sessions — multi-turn conversations
- Guardrails — the
x-decision-idheader your app should log