The RAG (Retrieval-Augmented Generation) API allows you to ingest text under topics and later query them using semantic search. Asta uses Ollama’s nomic-embed-text model for embeddings and ChromaDB for vector storage.
Check RAG Status
curl -X GET "http://localhost:8000/api/rag/status"
{
"ok": true,
"chromadb": true,
"embedding_provider": "ollama"
}
Endpoint
Check if RAG is working (ChromaDB + at least one embedding provider).
Response
Whether RAG system is operational
ChromaDB connection status
Active embedding provider (e.g., “ollama”)
Learn Topic
curl -X POST "http://localhost:8000/api/rag/learn" \
-H "Content-Type: application/json" \
-d '{
"topic": "product-docs",
"text": "Asta is a personal AI workspace that runs locally. It provides file management, RAG, audio transcription, and cron jobs.",
"doc_id": "readme-intro"
}'
{
"ok": true,
"topic": "product-docs"
}
Endpoint
Ingest text under a topic for later retrieval.
Request Body
Topic name to organize learned content (e.g., “product-docs”, “meeting-notes”)
Text content to learn and embed
Optional document ID for tracking and deduplication
Response
The topic that was learned
Query RAG
curl -X POST "http://localhost:8000/api/rag/ask" \
-H "Content-Type: application/json" \
-d '{
"question": "What features does Asta provide?",
"topic": "product-docs",
"k": 5
}'
{
"summary": "Asta provides file management, RAG (retrieval-augmented generation), audio transcription, and cron jobs. It runs locally as a personal AI workspace..."
}
Endpoint
Retrieve relevant context for a question using semantic search.
Request Body
The question to search for
Filter results to a specific topic (omit to search all topics)
Number of top results to return
Response
Aggregated context from matching chunks
List Learned Topics
curl -X GET "http://localhost:8000/api/rag/learned"
{
"has_learned": true,
"topics": [
{
"name": "product-docs",
"chunks": 42
},
{
"name": "meeting-notes",
"chunks": 15
}
]
}
Endpoint
List all topics and their chunk counts.
Response
Whether any content has been learned
List of topicsNumber of embedded chunks
Manage Topics
Get Topic Content
curl -X GET "http://localhost:8000/api/rag/topic/product-docs"
{
"topic": "product-docs",
"content": "Asta is a personal AI workspace...\n\nFeatures include..."
}
GET /api/rag/topic/{topic}
Update Topic Content
curl -X PUT "http://localhost:8000/api/rag/topic/product-docs" \
-H "Content-Type: application/json" \
-d '{
"content": "Updated product documentation..."
}'
PUT /api/rag/topic/{topic}
New content to replace existing topic content
Delete Topic
curl -X DELETE "http://localhost:8000/api/rag/topic/product-docs"
{
"ok": true,
"topic": "product-docs",
"deleted_chunks": 42
}
DELETE /api/rag/topic/{topic}
Deletes all chunks for the specified topic.
Check Ollama Connection
curl -X GET "http://localhost:8000/api/rag/check-ollama?url=http://localhost:11434"
GET /api/rag/check-ollama
Ollama URL to test connection (e.g., http://localhost:11434)
Check if Ollama is reachable at the given URL (for UI connection testing).