How to Configure MiniMax Embeddings for code-review-graph Semantic Search
To configure MiniMax embeddings for semantic search in code-review-graph, set the MINIMAX_API_KEY environment variable, optionally export CRG_ACCEPT_CLOUD_EMBEDDINGS=1 to acknowledge cloud data processing, and specify --embedding-provider minimax via CLI or provider="minimax" in Python.
The code-review-graph library supports multiple vector embedding backends for semantic code search, including the cloud-based MiniMax provider (embo-01). Configuring MiniMax embeddings enables high-quality 1536-dimensional vector representations of your codebase stored in a local SQLite database. This guide walks through the exact environment variables, CLI flags, and Python API calls required to enable MiniMax as implemented in code_review_graph/embeddings.py.
Prerequisites: API Key and Cloud Egress Acknowledgment
Before initializing the MiniMax provider, you must satisfy two security requirements hardcoded in the source.
Set the MiniMax API Key
The MiniMaxEmbeddingProvider class reads your API key from the MINIMAX_API_KEY environment variable. Without this variable, the provider cannot authenticate against the MiniMax endpoint at https://api.minimax.io/v1/embeddings.
export MINIMAX_API_KEY="your-minimax-api-key-here"
Accept Cloud Data Processing
Because MiniMax is a third-party cloud service, the library implements a safety check in the _warn_cloud_egress function within code_review_graph/embeddings.py. Unless you set CRG_ACCEPT_CLOUD_EMBEDDINGS=1, the library prints a one-time warning about sending code snippets to external APIs.
export CRG_ACCEPT_CLOUD_EMBEDDINGS=1
Configure MiniMax via Command Line Interface
The CLI entry point in code_review_graph/cli.py accepts an --embedding-provider argument that routes to the get_provider factory function. To use MiniMax for indexing your repository:
code-review-graph update \
--embedding-provider minimax \
--embedding-model embo-01 \
--repo /path/to/your/repo
This command initializes a MiniMaxEmbeddingProvider instance with the embo-01 model, batches your source files (default 100 texts per batch), and stores the resulting 1536-dimensional vectors in the SQLite database.
Configure MiniMax Programmatically
For custom pipelines, instantiate EmbeddingStore with provider="minimax" or use the lower-level get_provider factory directly.
Using EmbeddingStore for Search
The EmbeddingStore class manages the SQLite persistence layer and vector search logic. When you specify provider="minimax", it internally calls get_provider("minimax") to construct the provider.
from code_review_graph.embeddings import EmbeddingStore
# Initialize with MiniMax provider
store = EmbeddingStore(
db_path="mygraph.db",
provider="minimax",
model="embo-01"
)
# Perform semantic search
results = store.search("how to build a spring service", limit=10)
for qualified_name, score in results:
print(f"{score:.3f} {qualified_name}")
Direct Provider Access
If you need embeddings without SQLite storage, import get_provider to obtain a MiniMaxEmbeddingProvider instance:
from code_review_graph.embeddings import get_provider
provider = get_provider(provider="minimax")
# Batch embed documents (automatic batching at 100 items)
vectors = provider.embed(["def foo(): pass", "class Bar:"])
# Embed a single query
query_vec = provider.embed_query("function that does nothing")
MiniMax Implementation Details
Understanding the internal architecture helps debug configuration issues.
- Model Specification: The provider uses the
embo-01model (_MODELconstant) producing 1536-dimensional vectors (_DIMENSIONconstant) as defined incode_review_graph/embeddings.py. - API Endpoint: Requests route to
https://api.minimax.io/v1/embeddings(_ENDPOINTconstant) via the_call_apimethod, which includes retry logic for resilience. - Task Types: The provider distinguishes between indexing (
task="db") and querying (task="query") when calling the MiniMax API, automatically set byembed()versusembed_query()methods. - Integration Points: During indexing,
embed_nodescallsself.provider.embed(texts)to populate the SQLiteembeddingstable. At query time,searchusesself.provider.embed_query(query)to vectorize the search phrase before computing cosine similarity.
Summary
- Export
MINIMAX_API_KEYto authenticate with the MiniMax cloud API endpoint. - Set
CRG_ACCEPT_CLOUD_EMBEDDINGS=1to suppress the cloud egress warning implemented in_warn_cloud_egress. - Use
--embedding-provider minimaxwith the CLI orprovider="minimax"with theEmbeddingStoreconstructor. - The provider generates 1536-dimensional vectors using the
embo-01model with automatic batching of 100 texts per request handled by_call_api. - Core implementation resides in
code_review_graph/embeddings.pywith CLI argument parsing incode_review_graph/cli.py.
Frequently Asked Questions
What embedding model does the MiniMax provider use?
The MiniMaxEmbeddingProvider hardcodes the embo-01 model, which produces 1536-dimensional vectors suitable for high-accuracy semantic code search. This is defined as the _MODEL constant in code_review_graph/embeddings.py.
Can I use MiniMax embeddings without storing them in SQLite?
Yes. Instead of using EmbeddingStore, call get_provider("minimax") to obtain a raw provider instance. You can then call provider.embed() for documents or provider.embed_query() for search queries without database persistence.
Why do I need to set CRG_ACCEPT_CLOUD_EMBEDDINGS?
This environment variable acknowledges that your code snippets will be sent to MiniMax's cloud API (https://api.minimax.io). The _warn_cloud_egress function in code_review_graph/embeddings.py enforces this opt-in to prevent accidental data leakage to third-party services.
Is there a limit to how many files I can embed at once?
The MiniMaxEmbeddingProvider automatically handles batching with a default size of 100 texts per API call. You can embed thousands of files; the provider will chunk them appropriately in the _call_api method to respect rate limits and payload size constraints.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →