Skip to content

Build multilingual RAG applications with confidence

Muffakir is an open-source Python toolkit for building retrieval-augmented generation (RAG) applications that work seamlessly across languages, with deep specialized support for Arabic and mixed-language content. It brings document ingestion, chunking, retrieval, generation, evaluation, and architecture search into a single composable workflow.

Overview & Demo

import os

from Muffakir import MuffakirRAG

rag = MuffakirRAG(
    data_dir="./knowledge-base",
    llm_provider="openai",
    llm_model="gpt-4.1-mini",
    api_key=os.environ["OPENAI_API_KEY"],
)

result = rag.ask("ما هي سياسة الإجازات السنوية؟")
print(result["answer"])

Keep credentials out of code

The example shows the shape of a configuration. Read credentials from your environment or secret manager in production; never commit a real API key.

Why Muffakir?

  • :material-file-document-outline: Bring your documents

Parse PDFs and office documents, preserve useful metadata, clean Arabic text, and choose a chunking strategy that suits your corpus.

  • :material-magnify-scan: Control retrieval

Combine vector stores, retrieval methods, query transformation, and rerankers without rewriting your pipeline.

  • :material-chart-box-outline: Measure quality

Score retrieval and answer quality, inspect traces, detect answer refusals, and use an LLM Judge Rating when a semantic 1–5 assessment is useful.

  • :material-tune-variant: Search for a better pipeline

Let Composer compare configurations, retain checkpoints, and report the winning setup.

Start here

  1. Install Muffakir.
  2. Build your first RAG application.
  3. Use ComposerUI to explore and compare pipelines.
  4. Configure an LLM provider in code or ComposerUI.

Main capabilities

Area What you can do
Build Parse, clean, chunk, embed, retrieve, rerank, and generate answers.
Evaluate Measure Recall@k, Precision@k, MRR, nDCG, faithfulness, answer correctness, and LLM Judge Rating.
Optimize Search retrieval, query transformation, reranking, embedding, and chunking choices with Composer.
Observe Inspect per-sample traces, generated queries, execution timings, refusals, and reports.

Documentation map

  • Get started explains installation, a minimal RAG workflow, and ComposerUI.
  • Build covers the components you assemble into a production pipeline.
  • Evaluate and optimize explains how to verify and improve quality.
  • Reference is a compact guide to supported configuration, CLI, and public APIs.