Skip to content

v1.2.0 — Retrieval-augmented generation (RAG)

Choose a tag to compare

@ivannavas ivannavas released this 25 Jun 08:58

Retrieval-augmented generation (RAG)

Agents can now ground their answers in your own documents. An @Agent enables RAG by declaring a
vectorStore and an embeddingModel; before each turn Sprout embeds the prompt, retrieves the
retrievalTopK most relevant documents and prepends them as context. The original question is what gets
persisted, so reloaded conversations never carry stale context forward. RAG is opt-in — an agent that
declares no vector store does no retrieval.

New in sprout-core

  • AbstractVectorStore (@VectorStore), EmbeddingModel (@Embedding), and the Document,
    SearchResult and Retriever types — the same component pattern as the rest of the framework.
  • @Agent(vectorStore, embeddingModel, retrievalTopK) to wire retrieval into the agent loop.
  • Built-in defaults so RAG runs offline with no API key: InMemoryVectorStore (cosine similarity) and
    HashingEmbeddingModel (a lexical embedding).

Provider-backed semantic embeddings

  • OpenaiEmbeddingModel (sprout-openai) — OpenAI's embeddings API.
  • VoyageEmbeddingModel (sprout-anthropic) — Voyage AI, the embedding provider Anthropic recommends
    (the Anthropic API itself has no embeddings endpoint).

Examples

  • A new runnable rag example: mvn -pl sprout-examples -am -Prag exec:exec.

Also includes the concurrent orchestration, supervisor delegation and conversation hand-off
(sprout-orchestration) added since 1.0.0.