Search Toolkit

Search Toolkit is a Python framework for building information retrieval (IR) systems. It provides components for ingestion, retrieval, and evaluation. It works across backends, and every component can be swapped.

LLMs aren't trained on your private data. To ground their answers in your documents, you need a retrieval pipeline that ingests, indexes, and searches your content. Search Toolkit provides the building blocks for that pipeline.

Key features

Key features

Ingestion

Ingestion

Ingestion includes:

  • Multi-format extraction: PDF, DOCX, and PPTX through Mistral OCR, HTML, spreadsheets, emails, plain text
  • File loading: Load from the local filesystem, S3, Google Cloud Storage, or Azure Blob Storage, or implement custom loaders for any source
  • Flexible chunking: Character, token, markdown-aware, or separator-based splitting
  • Enrichment: Enrich documents and chunks with custom metadata or LLM-generated summaries
  • Indexing: Index to vector stores for semantic search
Retrieval

Retrieval

Retrieval includes:

  • Multiple strategies: Vector, keyword, and hybrid search, fused with RRF, with optional reranking
  • Query preprocessing: Improve user queries with LLM reformulation, or generate sub-queries with query extension
  • Reranking: LLM reranker, cross-encoder reranker, or custom rerankers
  • Semantic caching: Cache results by query similarity to skip redundant retrieval
Architecture

Architecture

Ingestion transforms raw documents into searchable chunks. A FileLoader reads raw bytes from a source, a DocumentExtractor converts them into a structured document, a TextSplitter divides it into chunks, optional DocumentProcessor stages (such as a ChunkEnricher or SummaryEnricher) add metadata, and an Embedder produces vectors for indexing into a vector store.

Retrieval finds relevant chunks for a given query. An optional query rewriter rewrites the query, a Retriever searches the index, and an optional Reranker re-scores the results before returning them. An optional query extension generates sub-queries that are returned with the result but not searched.

Both workflows are orchestrated by high-level classes (Pipeline for ingestion, QueryEngine for retrieval) that handle component wiring and execution. Every component can be swapped: use the built-in implementations or bring your own.

Components

Components

ComponentBuilt-in options
File loadersFilesystemFileLoader, S3FileLoader, GCSFileLoader, AzureBlobFileLoader, custom loaders
ExtractorsMistralOCRExtractor, SmartPDFExtractor, PlainTextExtractor, PyMuPDFExtractor, HTMLExtractor, SpreadsheetExtractor, EmailExtractor, EmailWithAttachmentsExtractor, NumbersExtractor, LegacyOfficeExtractor, MistralAudioTranscriptionExtractor
Text splittersCharacterTextSplitter, TokenTextSplitter, MarkdownTextSplitter, ParagraphTokenTextSplitter, MarkdownTokenTextSplitter, SeparatorTextSplitter
EnrichersSummaryEnricher, custom ChunkEnricher
EmbeddersMistralEmbedder, custom Embedder
StorageMistral Search Index, Vespa, Postgres (pgvector), Qdrant, or custom vector store
RetrieversVectorRetriever, KeywordRetriever with a custom KeywordStoreIndex
RerankersLLMReRanker, CrossEncoderReRanker, RRFRanker
PreprocessingLLMQueryRewriter, LLMQueryExtension
CachingSemanticCache with InMemoryCacheBackend
Installation and extras

Installation and extras

Install the core package:

uv add mistralai-search-toolkit

Optional extras add specialized functionality:

ExtraDescription
vespaVespa plugin for vector storage and semantic search
postgresPostgreSQL backend with pgvector and pg_textsearch
extractor-pymupdfAdvanced PDF extraction with PyMuPDF Pro
extractor-spreadsheetSpreadsheet parsing (Excel, CSV, Apple Numbers)
extractor-emailEmail file parsing (EML, MSG formats)
html-converter-markdownifyConvert HTML to Markdown
text-splitter-langchainAdditional text splitting strategies via LangChain
storage-gcsGoogle Cloud Storage integration
storage-azureAzure Blob Storage integration
storage-s3Amazon S3 integration

Install extras with the core package:

uv add "mistralai-search-toolkit[vespa]"
uv add "mistralai-search-toolkit[vespa,extractor-pymupdf]"

All packages are available on PyPI.

i
Information

Requires Python 3.12 to 3.14. We recommend uv for dependency management.

Next steps

Next steps

  • Quickstart: build your first ingestion and retrieval pipeline end to end.
  • Document model: understand Document, DocumentChunk, and the identity that ties them together.
  • Embedding model: understand how the schema describes embedding vectors, separately from the embedder.
  • Search index: set up your vector store.
  • Ingestion: load, extract, chunk, enrich, and index your documents.
  • Retrieval: configure vector search with optional reranking.