Flex Vector
A simple and intuitive vector database abstraction layer supporting multiple vector stores.
Features
- Unified interface for multiple vector databases
- Chroma
- Qdrant
- Weaviate
- PGVector
- Milvus
- Azure AI Search
- ...and more to come!
- LangChain support
- LlamaIndex support
- Flexible data loading from files, direct data, or URIs
- Async support for all operations
- Command-line interface for common operations
Installation
pip install flexvector
Add the CLI tool to your path:
# After installation, use the 'flexvector' command directly
flexvector --help
Quick Start
Environment Variables
Required:
export OPENAI_API_KEY="sk-..."
Using the Python API
from flexvector import VectorDBFactory
from flexvector.config import settings
from flexvector.core import Document
# Initialize client with configuration
client = VectorDBFactory.get("chroma", settings)
# Load documents from file or directory
docs = client.load(collection_name="my_collection", path="path/to/document.txt")
# Or create and add documents directly
from langchain_core.documents import Document
doc = Document(page_content="Hello world", metadata={"source": "example"})
client.from_langchain("my_collection", [doc])
# Search
results = client.search(
collection_name="my_collection",
query="hello",
top_k=5
)
# Delete collection
client.remove_collection("my_collection")
# Delete documents
Using the Command Line Interface
Load documents from a file:
flexvector load --input-file examples/files/data.txt --collection my_documents
# Or using python
python cli.py load --input-file examples/files/data.txt --collection my_documents
Load documents from a directory:
flexvector load --input-dir examples/files --collection research_papers
Search for documents:
flexvector search --query "What is vector database?" --collection my_documents --top-k 5
Delete a collection:
flexvector delete --collection my_documents
Configuration
FlexVector supports multiple configuration methods for different deployment environments:
Configuration Sources (in priority order)
- CLI arguments (highest priority) - Direct command-line overrides
- Environment variables - Runtime environment settings
- Configuration files - YAML, TOML, or JSON files
- Default values (lowest priority) - Built-in fallback values
-
Create a configuration file:
python cli.py init-config --config-file flexvector.yaml
-
Edit the configuration file for your environment:
# flexvector.yaml environments: development: CHROMA_DB_FILE: "./data/vectorstores/chroma-dev" EMBEDDING_MODEL: "text-embedding-3-small" production: CHROMA_HTTP_URL: "https://prod-chroma.example.com" EMBEDDING_MODEL: "text-embedding-3-large" # Default settings EMBEDDING_DIMENSION: 512
-
Use environment-specific settings:
# Development python cli.py load --input-dir ./docs --environment development # Production python cli.py search --query "AI" --environment production
.env File Support
cp env.example .env
# Edit .env with your local settings
📖 See full configuration documentation for advanced configuration patterns, multiple environments, and security best practices.
Documentation
For more usage info, see docs.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
This package aims to be a versatile tool for various AI applications, including but not limited to:
Research and Development
- Prototyping: Quickly test different vector databases without changing your application code
- A/B Testing: Compare performance across different vector stores for your specific use case
- Academic Research: Study vector search behavior with a standardized interface
RAG Pipeline Integration
Build robust Retrieval Augmented Generation (RAG) systems with a database-agnostic approach:
- ETL Workflows: Create efficient extract-transform-load pipelines that process documents and store embeddings without locking into a specific vector database
- Multi-modal RAG: Store and retrieve text, images, and other data types with the same consistent interface
- Hybrid Search Systems: Combine semantic search with traditional keyword search for improved retrieval quality
Research and Development
- Prototyping: Quickly test different vector databases without changing your application code
- A/B Testing: Compare performance across different vector stores for your specific use case
- Academic Research: Study vector search behavior with a standardized interface
Metadata
Release files for flexvector 0.1.2
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 | |
|---|---|---|---|---|
| flexvector-0.1.2.tar.gz | 21.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flexvector-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.7 kB
Release files / flexvector-0.1.2.tar.gz
| Download URL | flexvector-0.1.2.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62391d3aa257cf97330516d7d514453f46ee84de23a7ca211732aef820f59000
|
|
BLAKE2b-256 checksum How to use checksums |
f733e5d3df3810e89ff29147105ce091169d3c9855d892490ad96c4ce86151fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2025.
Transparency logRelease files / flexvector-0.1.2-py3-none-any.whl
| Download URL | flexvector-0.1.2-py3-none-any.whl |
|---|---|
| Size | 27.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d316b049e3ea667784da9bc3005e722d678be9a56350b4d595d0f9ebe0d5491
|
|
BLAKE2b-256 checksum How to use checksums |
e7e0f54a35d6ffd0be28f5939eb29d6d0f8dc2268eb70a8b8757b61e091c2427
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2025.
Transparency logSecurity for flexvector 0.1.2
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for flexvector-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2025.
Transparency logA 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.