Mini-Chain
Mini-Chain is a micro-framework for building applications with Large Language Models, inspired by LangChain. Its core principle is transparency and modularity, providing a "glass-box" design for engineers who value control and clarity.
Core Features
- Modular Components: Swappable classes for Chat Models, Embeddings, Memory, and more.
- Local & Cloud Ready: Supports both local models (via LM Studio) and cloud services (Azure).
- Modern Tooling: Built with Pydantic for type-safety and Jinja2 for powerful templating.
- GPU Acceleration: Optional
faiss-gpusupport for high-performance indexing.
Installation
pip install minichain-ai
#For Local FAISS (CPU) Support:
pip install minichain-ai[local]
#For NVIDIA GPU FAISS Support:
pip install minichain-ai[gpu]
#For Azure Support (Azure AI Search, Azure OpenAI):
pip install minichain-ai[azure]
#To install everything:
pip install minichain-ai[all]
Quick Start Here is the simplest possible RAG pipeline with Mini-Chain:
pip install minichain-ai[local]
from minichain.rag_runner import create_rag_from_files
# Load knowledge from files
rag = create_rag_from_files(
file_paths=["path/manual.txt", "README.md"],
system_prompt="You are a documentation assistant.",
chunk_size=500,
retrieval_k=3
)
rag.run_chat()
To Read the full directory
from minichain.rag_runner import create_rag_from_directory
# Load all Python files from a directory
rag = create_rag_from_directory(
directory="./src",
file_extensions=['.py', '.md'],
system_prompt="You are a code assistant."
)
rag.run_chat()
Custom RAG Configuration
from minichain.rag_runner import RAGRunner, RAGConfig
config = RAGConfig(
knowledge_texts=["Your knowledge here..."],
knowledge_files=["file1.txt", "file2.md"],
# Chunking settings
chunk_size=1000,
chunk_overlap=200,
# Retrieval settings
retrieval_k=4,
similarity_threshold=0.7, # Only include high-similarity results
# Chat settings
system_prompt="Custom system prompt...",
conversation_keywords=["custom", "keywords", "for", "conversation", "detection"],
# Components (optional - uses defaults if not provided)
chat_model=None, # Will use LocalChatModel
embeddings=None, # Will use LocalEmbeddings
text_splitter=None, # Will use RecursiveCharacterTextSplitter
vector_store=None, # Will create FAISSVectorStore
debug=True # Enable debug output
)
rag = RAGRunner(config).setup()
rag.run_chat()
Using Custom Components
from minichain.rag_runner import RAGConfig, RAGRunner
from minichain.chat_models import LocalChatModel, LocalChatConfig
from minichain.embeddings import LocalEmbeddings
from minichain.text_splitters import RecursiveCharacterTextSplitter
# Custom components
custom_model = LocalChatModel(LocalChatConfig(temperature=0.7))
custom_embeddings = LocalEmbeddings()
custom_splitter = RecursiveCharacterTextSplitter(chunk_size=800)
config = RAGConfig(
knowledge_texts=["Your knowledge..."],
chat_model=custom_model,
embeddings=custom_embeddings,
text_splitter=custom_splitter,
)
rag = RAGRunner(config).setup()
rag.run_chat()
for azure pip install minichain-ai[azure]
Metadata
Release files for minichain-ai 8.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| minichain_ai-8.0.5.tar.gz | 31.9 kB | Without provenance | Details for minichain_ai-8.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minichain_ai-8.0.5-py3-none-any.whl | Python 3 | none | any | Details for minichain_ai-8.0.5-py3-none-any.whl |
Total release size: 72.3 kB
Release files / minichain_ai-8.0.5.tar.gz
| Download URL | minichain_ai-8.0.5.tar.gz |
|---|---|
| Size | 31.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcc9ecdedd77013155af298cf712e296c3e0d5bf63fc8030657813857f673fc2
|
|
BLAKE2b-256 checksum How to use checksums |
28d5423efb76174c3bf62d56501fc492645a39c595e8a95fe5d05eee7e51f111
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Release files / minichain_ai-8.0.5-py3-none-any.whl
| Download URL | minichain_ai-8.0.5-py3-none-any.whl |
|---|---|
| Size | 40.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0eea75ebedb6fd2efac5921972b866a043ad1acf9bd5c910934b8a8ee59b5b7e
|
|
BLAKE2b-256 checksum How to use checksums |
f5cca25290df0b8e707f49ca51a55f970e9700e8ee4d6253f63021343483f51c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Security for minichain-ai 8.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.