Zoni
A retrieval-augmented generation framework for Swift, providing document loading, chunking, embeddings, vector stores and query synthesis so document search and question answering can be built natively for Linux, macOS and iOS.
Zoni loads PDF, Markdown, JSON, CSV and plain text documents, with optional HTML and web-page loading, and chunks them with recursive, semantic, markdown-aware, code-aware, sentence or paragraph strategies. It supports multiple embedding sources, including mock or local core embeddings, optional OpenAI, Cohere, Voyage and Ollama integrations, and Apple's own NLEmbedding, MLX and Foundation Models frameworks for on-device use, alongside an in-memory vector store or optional Qdrant, Pinecone and PostgreSQL with pgvector integrations. Advanced retrieval features include hybrid search, multi-query expansion, MMR diversity and reranking, and a query engine offers several response-synthesis strategies such as compact, refine and tree-summarize.
A server-side product, ZoniServer, adds multi-tenancy and a job-queue system, while ZoniAgents provides SwiftAgents-compatible tools for agentic workflows built on RAG operations; heavier storage and framework integrations are kept in optional packages outside the root library so that core users are not forced to resolve those dependencies.
It is built with Swift 6.1 and Swift's structured concurrency, targets Linux, macOS, iOS, tvOS, watchOS and visionOS, and is released under the MIT license.