Ir para o conteúdo

Quickstart — Naive RAG in 20 lines

Zero API keys. Runs entirely in memory.

Python
import asyncio
from apogee_ai_rag import (
    RagFactory, RagType, PipelineSpec,
    Document, RagQuery, IngestionJob,
    HashingEmbedder, InMemoryVectorStore, RecursiveTextChunker,
)

async def main():
    spec = PipelineSpec(
        rag_type=RagType.NAIVE,
        chunker=RecursiveTextChunker(chunk_size=200, chunk_overlap=20),
        embedder=HashingEmbedder(dim=128),
        vector_store=InMemoryVectorStore(),
    )
    rag = RagFactory.build(spec)

    docs = [
        Document(id="d1", text="The Apogee Framework generates Clean Architecture projects."),
        Document(id="d2", text="apogee-ai-rag supports 28 RAG variants and 60+ integrations."),
    ]
    await rag.ingest(IngestionJob(documents=docs))

    answer = await rag.query(RagQuery(question="How many RAG variants are there?"))
    print(answer.answer)

asyncio.run(main())

Step up to a real vector DB

Just swap the vector_store for QdrantVectorStore(...) or PgVectorStore(...). The rest of your code does not change.

  • Variants — pick the right RAG type for your problem.
  • Integrations — full matrix of supported tools.