SuperDuperDB / superduperdb
- пятница, 8 декабря 2023 г. в 00:00:09
🔮 SuperDuperDB: Bring AI to your database: Integrate, train and manage any AI models and APIs directly with your database and your data.
SuperDuperDB is an open-source framework for integrating AI directly with your existing databases, including streaming inference, scalable model training, and vector search.
SuperDuperDB is not a database. It transforms your favorite database into an AI development and deployment environment; think db = superduper(db)
.
SuperDuperDB eliminates complex MLOps pipelines, specialized vector databases - and the need to migrate and duplicate data by integrating AI at the data's source, directly on top of your existing data infrastructure. This massively simplifies building and managing AI applications:
To get started: Check the uses cases that we have already implemented here in the docs as well as apps built by the community in the dedicated superduper-community-apps repo and try all of them with Jupyter right in your browser!
SuperDuperDB is open-source: Please leave a star to support the project! ⭐
For more information about SuperDuperDB and why we believe it is much needed, read this blog post.
bytes
in Python.With SuperDuperDB | Without | |
---|---|---|
Data Management & Security | Data stays in the database, with AI outputs stored alongside inputs available to downstream applications. Data access and security to be externally controlled via database access management. | Data duplication and migration to different environments, and specialized vector databases, imposing data management overhead. |
Infrastructure | A single environment to build, ship, and manage your AI applications, facilitating scalability and optimal compute efficiency. | Complex fragmented infrastructure, with multiple pipelines, coming with high adoption and maintenance costs and increasing security risks. |
Code | Minimal learning curve due to a simple and declarative API, requiring simple Python commands. | Hundreds of lines of codes and settings in different environemts and tools. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Transform your existing database into a Python-only AI development and deployment stack with one command:
db = superduper('mongodb|postgres|sqlite|duckdb|snowflake://<your-db-uri>')
![]() |
![]() |
![]() |
Integrate, train and manage any AI model (whether from open-source, commercial models or self-developed) directly with your datastore to automatically compute outputs with a single Python command:
m = db.add(
<sklearn_model>|<torch_module>|<transformers_pipeline>|<arbitrary_callable>,
preprocess=<your_preprocess_callable>,
postprocess=<your_postprocess_callable>,
encoder=<your_datatype>
)
m.predict(X='<input_column>', db=db, select=<mongodb_query>, listen=False|True, create_vector_index=False|True)
m.fit(X='<input_column_or_key>', y='<target_column_or_key>', db=db, select=<mongodb_query>|<ibis_query>)
![]() |
![]() |
![]() |
Integrate externally hosted models accessible via API to work together with your other models with a simple Python command:
m = db.add(
OpenAI<Task>|Cohere<Task>|Anthropic<Task>(*args, **kwargs), # <Task> - Embedding,ChatCompletion,...
)
Try our ready-to-use notebooks live on your browser.
Also find use-cases and apps built by the community in the superduper-community-apps repository.
|
|
|
Text-To-Image Search | Text-To-Video Search | Question the Docs |
---|---|---|
|
|
|
Semantic Search Engine | Classical Machine Learning | Cross-Framework Transfer Learning |
pip
(~1 minute):pip install superduperdb
docker run -p 8888:8888 superduperdb/demo:latest
Here are snippets which give you a sense of how superduperdb
works and how simple it is to use. You can visit the docs to learn more.
Automatically compute outputs (inference) with your database in a single environment.
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'}))
Simply by querying your database, without additional ingestion and pre-processing:
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.train(X='input_col', y='target_col', db=db, select=Collection(name='test_documents').find({'_fold': 'valid'}))
Use your existing favorite database as a vector search database, including model management and serving.
# 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.
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.
# 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')
)
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
)
model.predict(
X='input_col',
db=db,
select=coll.find().featurize({'X': '<upstream-model-id>'}), # already registered upstream model-id
listen=True,
)
gethelp@superduperdb.com
.Please see our Contributing Guide for details.
SuperDuperDB is open-source and intended to be a community effort, and it wouldn'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!