Practical overview
When it fits
Use FlagEmbedding when developing the retrieval layer of a search or RAG application and you want to work with BGE models and Python tools.
Who it is for
- Developers building semantic search over document collections.
- Teams adding embedding-based retrieval or passage retrieval to an LLM application.
Documented uses
- Create semantic search for a document collection.
- Retrieve relevant passages to provide context to a language model.
- Build embedding-based retrieval or text semantic similarity search.
Requirements & limits
The repository is public and identifies the project as MIT-licensed open-source software.
- It is a developer library, so it serves as a component in a larger application rather than a ready-to-use hosted search product.
- The repository identifies Python as its primary language.
- The project covers BGE retrieval models and search and RAG use cases.
- The repository lists an MIT license.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install FlagEmbedding and compute text similarity
Install the package without fine-tuning dependencies, create embeddings for two sentence lists, and compare them by inner product.
Before you start
- Python package installation with pip.
- For this recipe, no fine-tuning dependency is needed.
Steps
Install FlagEmbedding with the command below.
pip install -U FlagEmbeddingLoad the BGE model with
from FlagEmbedding import FlagAutoModelandFlagAutoModel.from_finetuned('BAAI/bge-base-en-v1.5', query_instruction_for_retrieval="Represent this sentence for searching relevant passages:", use_fp16=True).Pass sentence lists to
model.encode, for examplesentences_1 = ["I love NLP", "I love machine learning"]andsentences_2 = ["I love BGE", "I love text retrieval"], then assign the outputs toembeddings_1andembeddings_2.Compute pairwise similarity with
similarity = embeddings_1 @ embeddings_2.Tand print the result.
Expected outcome
Two sentence lists are represented as embeddings, and their pairwise inner-product similarity matrix is computed.
Guide limitations
- This recipe demonstrates embedding and similarity computation, not a complete document-search or RAG pipeline.
- The README does not specify hardware requirements or model-download details.
Compare options for Retrieval-augmented applications
These projects document a common task and share a project role. This is a source-based comparison, not an execution benchmark or a guarantee of interchangeability.
| Project | Documented purpose | Platform | Access and requirements |
|---|---|---|---|
| Flagembedding | Create semantic search for a document collection. | Linux, macOS, Server, Windows | The repository is public and identifies the project as MIT-licensed open-source software. |
| Langsearch | Crawl website or local data for a knowledge base. | CLI, Self-hosted, Server | |
| Hybrid Search Rag | Combine document retrieval and language-model generation in a configurable workflow. |
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 7 October 2026
- Original website title
- FlagOpen/FlagEmbedding · Official homepage title · retained in its source language

