--- id: flagembedding version: "1.4.0" license: unclear license_treatment: unclear maintenance: active --- # FlagEmbedding — FlagEmbedding License: unclear · Maintenance: active · Downloads: 632.8K/mo ## What it is and what it does FlagEmbedding is a toolkit for building semantic search and RAG systems using pre-trained embedding and reranking models. It wraps transformer-based models that convert text into dense vector representations, enabling similarity-based retrieval. The package integrates with torch, transformers, and sentence_transformers to handle model loading, inference, and fine-tuning workflows. The toolkit supports multilingual queries, variable input lengths, and multiple retrieval strategies (dense, lexical, and multi-vector). It is commonly used to rank and retrieve relevant documents for LLM prompts, implement semantic search over document collections, and fine-tune embedding models on domain-specific data. Use it for: - Build a semantic search engine over a document corpus by encoding documents and queries into embeddings and finding nearest neighbors. - Implement retrieval-augmented generation (RAG) by retrieving relevant documents to augment LLM context before generation. - Re-rank top-k search results using reranker models to improve relevance of retrieved documents. - Fine-tune embedding models on custom datasets to optimize for domain-specific or task-specific retrieval. - Support multilingual search applications where queries and documents span multiple languages. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. FlagEmbedding provides embedding and reranking models for semantic search and retrieval-augmented generation (RAG), supporting dense retrieval, multilingual queries, and document ranking. Yes, with conditions. FlagEmbedding is actively maintained with no known vulnerabilities. Install if you need semantic search or RAG capabilities and can accommodate the heavy ML dependencies (torch, transformers). Verify the license terms in the repository first, as the package metadata does not declare a clear license. Not suitable if you need a lightweight embedding solution or cannot install PyTorch. ## Install pip install flagembedding uv add flagembedding poetry add flagembedding ## Installing FlagEmbedding Before you install: Low friction installation with a pure Python wheel. Active maintenance with recent commits and a large repository (12050 stars). Depends on heavy ML libraries (torch, transformers, sentence_transformers) that may require significant disk and memory. License in practice: License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms in the repository before use in proprietary or commercial projects. Quickstart: pip install flagembedding from flagembedding import FlagModel model = FlagModel('BAAI/bge-small-en-v1.5') embeddings = model.encode(['hello world']) Requires torch and transformers; model downloads are large and may require significant disk space and network bandwidth on first use. Verify before relying: - Exact Python version compatibility (requires_python not specified in metadata) - Whether all 9 runtime dependencies are always required or only for specific use cases - Performance characteristics and typical latency for embedding generation ## Package facts - License: not declared (unclear) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 632.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags semantic search embeddings, retrieval augmented generation RAG, multilingual embeddings, document reranking, dense retrieval models, text embedding models, cross-lingual search, embeddings, retrieval-augmented-generation, semantic-search [View on SkillFed](https://skillfed.io/packages/flagembedding) · [View on PyPI](https://pypi.org/project/flagembedding/)