🔮 SuperDuperDB is open-source: Leave a star ⭐️ to support the project!
Build next-gen AI applications just using Python — without the need for complex MLOps pipelines and infrastructure nor data duplication and migration to specialized vector databases:
- from LLM based (RAG) chatbots and vector search
- image generation, segmentation, time series forecasting, anomaly detection, classification, recommendation, personalisation etc.
- to highly custom machine learning use-cases and workflows
- A single scalable AI deployment of all your models and AI APIs including output computation (inference) — always up-to-date as changing data is handled automatically and immediately.
- A model trainer allowing you to easily train and fine-tune models simply by querying your database.
- A feature store in which the model outputs are stored alongside the inputs in any data format.
- A fully functional vector database to easily generate vector embeddings of your data with your favorite models and APIs and connect them with your database (and/ or) vector database.
Databases | AI Frameworks | Models & AI APIs |
---|---|---|
- MongoDB - MongoDB Atlas - S3 - PostgreSQL (experimental) - SQLite (experimental) - DuckDB (experimental) - MySQL (experimental) - Snowflake (experimental) |
- PyTorch - Scikit-Learn - HuggingFace Transformers |
- OpenAI - Cohere - Anthropic |
- Deploy all your AI models to automatically compute outputs (inference) with your database in a single environment.
- Train models simply by querying without additional ingestion and pre-processing.
- Integrate AI APIs to work together with other models on your data effortlessly.
- Search your data with vector search, including model management and serving.
Accelerate AI development and enable data symbiotic AI applications with a simple and familiar Python interface that can handle even the most complex AI use-cases.
Check out the example use-cases and applications we have already implemented with SuperDuperDB in our docs here.
The following are examples of how to use SuperDuperDB with Python (find all how-tos and examples in the docs):
- Add a ML/AI model to your database (read more in the docs):
import pymongo
from sklearn.svm import SVC
from superduperdb import superduper
# Make your db superduper!
db = superduper(pymongo.MongoClient().my_db)
# Models client can be converted to SuperDuperDB objects with a simple wrapper.
model = superduper(SVC())
# Add the model into the database
db.add(model)
# Predict on the selected data.
model.predict(X='input_col', db=db, select=Collection(name='test_documents').find({'_fold': 'valid'}))
- Train/fine-tune a model using data from your database directly (read more in the docs):
import pymongo
from sklearn.svm import SVC
from superduperdb import superduper
# Make your db superduper!
db = superduper(pymongo.MongoClient().my_db)
# Models client can be converted to SuperDuperDB objects with a simple wrapper.
model = superduper(SVC())
# Predict on the selected data.
model.predict(X='input_col', db=db, select=Collection(name='test_documents').find({'_fold': 'valid'}))
- Use your existing favorite database as a vector search database (read more in the docs):
# First a "Listener" makes sure vectors stay up-to-date
indexing_listener = Listener(model=OpenAIEmbedding(), key='text', select=collection.find())
# This "Listener" is linked with a "VectorIndex"
db.add(VectorIndex('my-index', indexing_listener=indexing_listener))
# The "VectorIndex" may be used to search data. Items to be searched against are passed
# to the registered model and vectorized. No additional app layer is required.
# By default, SuperDuperDB uses LanceDB for vector comparison operations
db.execute(collection.like({'text': 'clothing item'}, 'my-index').find({'brand': 'Nike'}))
- Use OpenAI, PyTorch or Hugging face model as an embedding model for vector search (read more in the docs):
# Create a ``VectorIndex`` instance with indexing listener as OpenAIEmbedding and add it to the database.
db.add(
VectorIndex(
identifier='my-index',
indexing_listener=Listener(
model=OpenAIEmbedding(identifier='text-embedding-ada-002'),
key='abstract',
select=Collection(name='wikipedia').find(),
),
)
)
# The above also executes the embedding model (openai) with the select query on the key.
# Now we can use the vector-index to search via meaning through the wikipedia abstracts
cur = db.execute(
Collection(name='wikipedia')
.like({'abstract': 'philosophers'}, n=10, vector_index='my-index')
)
- Add a Llama 2 model directly into your database! (read more in the docs):
model_id = "meta-llama/Llama-2-7b-chat-hf"
tokenizer = AutoTokenizer.from_pretrained(model_id)
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
torch_dtype=torch.float16,
device_map="auto",
)
model = Pipeline(
identifier='my-sentiment-analysis',
task='text-generation',
preprocess=tokenizer,
object=pipeline,
torch_dtype=torch.float16,
device_map="auto",
)
# You can easily predict on your collection documents.
model.predict(
X=Collection(name='test_documents').find(),
db=db,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=200
)
- Use models outputs as inputs to downstream models (read more in the docs):
model.predict(
X='input_col',
db=db,
select=coll.find().featurize({'X': '<upstream-model-id>'}), # already registered upstream model-id
listen=True,
)
Now you can start using SuperDuperDB with oneclick: Try out this jupyter demo at Jupyter Demo!
pip install superduperdb
- You already have MongoDB installed? Let's go!
- You need to install MongoDB? See the docs here.
3. Try one of our example use cases/notebooks found here (~as many minutes you enjoy)!
- Join our Slack (we look forward to seeing you there).
- Search through our GitHub Discussions, or add a new question.
- Comment an existing issue or create a new one.
- Send us an email to [email protected].
- Feel free to contact a maintainer or community volunteer directly!
There are many ways to contribute, and they are not limited to writing code. We welcome all contributions such as:
- Bug reports
- Documentation improvements
- Enhancement suggestions
- Feature requests
- Expanding the tutorials and use case examples
Please see our Contributing Guide for details.
Help us to improve SuperDuperDB by providing your valuable feedback here!
SuperDuperDB is open-source and intended to be a community effort, and it won't be possible without your support and enthusiasm. It is distributed under the terms of the Apache 2.0 license. Any contribution made to this project will be subject to the same provisions.
We are looking for nice people who are invested in the problem we are trying to solve to join us full-time. Find roles that we are trying to fill here!