Skip to content

RAG

Memonic’s RAG pipeline lets you ingest documents and retrieve relevant chunks for any prompt — grounding your agent in up-to-date knowledge.

Terminal window
curl -X POST https://memonic.dev/api/rag/ingest \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"documentId": "doc-runbook-001",
"content": "To restart the API: run npm run deploy from the worker directory. To check live logs: use the dashboard at app.memonic.dev.",
"metadata": {"source": "runbook", "version": "v2"}
}'

Memonic chunks the document, generates embeddings via Workers AI (bge-base-en-v1.5), and stores them in Vectorize.

Terminal window
curl -X POST https://memonic.dev/api/rag/query \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "how do I restart the worker",
"topK": 3,
"filter": {"source": "runbook"}
}'

Returns the most semantically relevant chunks to inject into your prompt context.