aladindb


Namealadindb JSON
Version 0.1.1 PyPI version JSON
download
home_page
Summary🔮 Super-power your database with AI 🔮
upload_time2024-01-05 01:41:45
maintainer
docs_urlNone
author
requires_python>=3.8
license Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [2023] [aladindb, Inc.] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
keywords mongo mongodb pymongo data-science machine-learning mlops vector-database ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <a href="https://www.aladindb.com">
    <img width="90%" src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/img/aladindb_logo_color.svg">
  </a>
</p>
<div align="center">

# Bring AI to your favorite database! 

</div>

<div align="center">

## <a href="https://aladindb.github.io/aladindb/"><strong>Docs</strong></a> | <a href="https://docs.aladindb.com/blog"><strong>Blog</strong></a> | <a href="https://docs.aladindb.com/docs/category/use-cases"><strong>Use-Cases</strong></a> | <a href="https://demo.aladindb.com"><strong> Live Notebooks</strong></a> | <a href="https://github.com/aladindb/aladin-community-apps"><strong>Community Apps</strong></a> |  <a href="https://join.slack.com/t/aladindb/shared_invite/zt-1zuojj0k0-RjAYBs1TDsvEa7yaFGa6QA"><strong> Slack </strong></a> | <a href="https://www.youtube.com/channel/UC-clq9x8EGtQc6MHW0GF73g"><strong> Youtube </strong></a>

</div>


<div align="center">
	<a href="https://pypi.org/project/aladindb"><img src="https://img.shields.io/pypi/v/aladindb?color=%23007ec6&label=pypi%20package" alt="Package version"></a>
	<a href="https://pepy.tech/project/aladindb"><img src="https://pepy.tech/badge/aladindb" alt="Downloads"></a>
  	<a href="https://pypi.org/project/aladindb"><img src="https://img.shields.io/pypi/pyversions/aladindb.svg" alt="Supported Python versions"></a>    
	<a href="https://github.com/aladindb/aladindb/actions/workflows/ci_code.yml"><img src="https://github.com/aladindb/aladindb/actions/workflows/ci_code.yml/badge.svg?branch=main" /></a>	
	<a href="https://codecov.io/gh/aladindb/aladindb/branch/main"><img src="https://codecov.io/gh/aladindb/aladindb/branch/main/graph/badge.svg" alt="Coverage"></a>
	<a href="https://github.com/aladindb/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache_2.0-green" alt="License - Apache 2.0"></a>	
	<a href="https://twitter.com/aladindb" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow @aladindb"></a>

<b>English</b> |
[**中文**](README_zh.md) |
[**日本語**](README_ja.md)



</div>





## What is aladindb? 🔮 

aladindb is an open-source framework for integrating your database with AI models, APIs, and vector search engines, providing streaming inference and scalable training/fine-tuning.

aladindb is **not** a database. aladindb is an open platform unifying data infrastructure and AI. Think `db = aladin(db)`: aladindb transforms your databases into an intelligent system that leverages the full power of the AI, open-source and Python ecosystem. It is a single scalable environment for all your AI that can be deployed anywhere, in the cloud, on-prem, on your machine.

aladindb allows you to build AI applications easily without needing to move your data to complex MLOps pipelines and specialized vector databases by integrating AI at the data’s source, directly on top of your existing data infrastructure:
- Generative AI & LLM-Chat
- Vector Search
- Standard Machine Learning Use-Cases (Classification, Segmentation, Recommendation etc.)
- Highly custom AI use-cases involving ultra specialized models

**To get started:**
Check the use-cases we have already implemented [here in the docs](https://docs.aladindb.com/docs/category/use-cases) as well as the apps built by the community in the dedicated [aladin-community-apps repo](https://github.com/aladindb/aladin-community-apps) and try all of them with [Jupyter right in your browser](https://demo.aladindb.com/)! 

`aladindb is open-source: Please leave a star to support the project! ⭐`


For more information about aladindb and why we believe it is much needed, [read this blog post](https://docs.aladindb.com/blog/aladindb-the-open-source-framework-for-bringing-ai-to-your-datastore/). 




<div align="center">
	<a href="https://www.youtube.com/watch?v=FxJs7pbHj3Q"><img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/overview.png" alt="Overview" width="400"></a>
	<a href="https://www.youtube.com/watch?v=Hr0HkmIL3go"><img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/quickstart.png" alt="QuickStart" width="400"></a>
</div>


</div>

### Key Features:
- **[Integration of AI with your existing data infrastructure](https://docs.aladindb.com/docs/docs/walkthrough/apply_models):** Integrate any AI models and APIs with your databases in a single scalable deployment, without the need for additional pre-processing steps, ETL or boilerplate code.
- **[Streaming Inference](https://docs.aladindb.com/docs/docs/walkthrough/daemonizing_models_with_listeners):** Have your models compute outputs automatically and immediately as new data arrives, keeping your deployment always up-to-date.
- **[Scalable Model Training](https://docs.aladindb.com/docs/docs/walkthrough/training_models):** Train AI models on large, diverse datasets simply by querying your training data. Ensured optimal performance via in-build computational optimizations.
- **[Model Chaining](https://docs.aladindb.com/docs/docs/walkthrough/linking_interdependent_models/)**: Easily setup complex workflows by connecting models and APIs to work together in an interdependent and sequential manner.
- **[Simple, but Extendable Interface](https://docs.aladindb.com/docs/docs/fundamentals/procedural_vs_declarative_api)**: Add and leverage any function, program, script or algorithm from the Python ecosystem to enhance your workflows and applications. Drill down to any layer of implementation, including to the inner workings of your models while operating aladindb with simple Python commands.
- **[Difficult Data-Types](https://docs.aladindb.com/docs/docs/walkthrough/encoding_special_data_types/)**: Work directly with images, video, audio in your database, and any type which can be encoded as `bytes` in Python.
- **[Feature Storing](https://docs.aladindb.com/docs/docs/walkthrough/encoding_special_data_types):** Turn your database into a centralized repository for storing and managing inputs and outputs of AI models of arbitrary data-types, making them available in a structured format and known environment.
- **[Vector Search](https://docs.aladindb.com/docs/docs/walkthrough/vector_search):** No need to duplicate and migrate your data to additional specialized vector databases - turn your existing battle-tested database into a fully-fledged multi-modal vector-search database, including easy generation of vector embeddings and vector indexes of your data with preferred models and APIs.

### Why opt for aladindb?
|                            | With aladindb | 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 environments and tools.     |


## Supported Datastores (*more coming soon*):

<table>
    <tr>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmongodb.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmongodb-atlas.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xaws-s3.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpostgresql.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmysql.png" width="139px" />
        </td>
    </tr>
    <tr>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xsqlite.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xduckdb.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xsnowflake.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xbigquery.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xclickhouse.png" width="139px" />
        </td>
    </tr>
    <tr>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xdatafusion.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xdruid.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Ximpala.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmssql.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xoracle.png" width="139px" />
        </td>
    </tr>
    <tr>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpandas.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpolars.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpyspark.png" width="139px" />
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xtrino.png" width="139px" />
        </td>
    </tr>

</table>

**Transform your existing database into a Python-only AI development and deployment stack with one command:**

```
db = aladin('mongodb|postgres|mysql|sqlite|duckdb|snowflake://<your-db-uri>')
```

## Supported AI Frameworks and Models (*more coming soon*):

<table>
    <tr>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/frameworks/2Xpytorch.png" width="139px"/>
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/frameworks/2Xscikit-learn.png" width="139px"/>
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/frameworks/2Xhuggingface-transformers.png" width="139px"/>
        </td>
    </tr>
</table>

**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:**

- Install and deploy model:

```
m = db.add(
    <sklearn_model>|<torch_module>|<transformers_pipeline>|<arbitrary_callable>,
    preprocess=<your_preprocess_callable>,
    postprocess=<your_postprocess_callable>,
    encoder=<your_datatype>
)
```

- Predict:

```
m.predict(X='<input_column>', db=db, select=<mongodb_query>, listen=False|True, create_vector_index=False|True)
```

- Train model:

```
m.fit(X='<input_column_or_key>', y='<target_column_or_key>', db=db, select=<mongodb_query>|<ibis_query>)
```





## Pre-Integrated AI APIs (*more coming soon*):

<table >
    <tr>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/2Xopenai.png" width="139px"/>
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/2Xcohere.png" width="139px"/>
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/2Xanthropic.png" width="139px"/>
        </td>
        <td align="center" width="140" height="112.43">
            <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/jinaai.png" width="139px"/>
        </td>
    </tr>
</table>

**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>|JinaAI<Task>(*args, **kwargs),   # <Task> - Embedding,ChatCompletion,...
)
```




## Infrastructure Diagram

<p align="center">
  <img width="100%" src="docs/hr/static/img/aladindb.gif">
</p>



## Featured Examples

Try our ready-to-use notebooks [live on your browser](https://demo.aladindb.com). 

Also find use-cases and apps built by the community in the [aladin-community-apps repository](https://github.com/aladindb/aladin-community-apps).


<table>
  <tr>
    <td width="30%">
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/multimodal_image_search_clip.ipynb">
        <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/image-search.svg" />
      </a>
    </td>
    <td width="30%">
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/video_search.ipynb">
        <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/video-search.svg" />
      </a>
    </td>
    <td width="30%">
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/question_the_docs.ipynb">
        <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/semantic-search.svg" />
      </a>
    </td>
  </tr>
  <tr>
    <th>
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/multimodal_image_search_clip.ipynb">Text-To-Image Search</a>
    </th>
    <th>
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/video_search.ipynb">Text-To-Video Search</a>
    </th>
    <th>
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/question_the_docs.ipynb">Question the Docs</a>
    </th>
  </tr>
  <tr>     
    <td width="30%">
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/vector_search.ipynb">
        <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/document-search.svg" />
      </a>
    </td>
    <td width="30%">
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/mnist_torch.ipynb">
        <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/machine-learning.svg" />
      </a>
    </td>
    <td width="30%">
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/transfer_learning.ipynb">
        <img src="https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/transfer-learning.svg" />
      </a>
    </td>
  </tr>
  <tr>
    <th>
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/vector_search.ipynb">Semantic Search Engine</a>
    </th>
    <th>
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/mnist_torch.ipynb">Classical Machine Learning</a>
    </th>
    <th>
      <a href="https://demo.aladindb.com/user-redirect/lab/tree/transfer_learning.ipynb">Cross-Framework Transfer Learning</a>
    </th>
  </tr>
</table>



## Installation

#### 1. Install aladindb via `pip` *(~1 minute)*:

**Requirements**:

- Python 3.10 or 3.11
- Working `pip` installation (e.g. via virtual environment)

```
pip install aladindb
```

#### 2. Try aladindb via Docker *(~2 minutes)*:
  
**Requirements**:
   
- Working `docker` [installation](https://docs.docker.com/engine/install/)

```
docker run -p 8888:8888 aladindb/demo:latest
```

## Preview

Here are snippets which give you a sense of how `aladindb` works and how simple it is to use. You can visit the <a href="https://docs.aladindb.com">docs</a> to learn more.


#### - Deploy ML/AI models to your database:
Automatically compute outputs (inference) with your database in a single environment.

```python
import pymongo
from sklearn.svm import SVC

from aladindb import aladin

# Make your db aladin!
db = aladin(pymongo.MongoClient().my_db)

# Models client can be converted to aladindb objects with a simple wrapper.
model = aladin(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 models directly from your database.
Simply by querying your database, without additional ingestion and pre-processing:

```python
import pymongo
from sklearn.svm import SVC

from aladindb import aladin

# Make your db aladin!
db = aladin(pymongo.MongoClient().my_db)

# Models client can be converted to aladindb objects with a simple wrapper.
model = aladin(SVC())

# Fit model on the training data.
model.fit(X='input_col', y='target_col', db=db, select=Collection(name='test_documents').find({}))
```

#### - Vector-Search your data:
Use your existing favorite database as a vector search database, including model management and serving. 

```python
# 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'}))
```

#### - Integrate AI APIs to work together with other models. 
Use OpenAI, Jina AI, PyTorch or Hugging face model as an embedding model for vector search.

```python
# 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 to aladindb!:
```python
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:

```python
model.predict(
    X='input_col',
    db=db,
    select=coll.find().featurize({'X': '<upstream-model-id>'}),  # already registered upstream model-id
    listen=True,
)
```



## Community & Getting Help 

#### If you have any problems, questions, comments, or ideas:
- Join <a href="https://join.slack.com/t/aladindb/shared_invite/zt-1zuojj0k0-RjAYBs1TDsvEa7yaFGa6QA">our Slack</a> (we look forward to seeing you there).
- Search through <a href="https://github.com/aladindb/aladindb/discussions">our GitHub Discussions</a>, or <a href="https://github.com/aladindb/aladindb/discussions/new/choose">add a new question</a>.
- Comment <a href="https://github.com/aladindb/aladindb/issues/">an existing issue</a> or create <a href="https://github.com/aladindb/aladindb/issues/new/choose">a new one</a>.
- Help us to improve aladindb by providing your valuable feedback <a href="https://docs.google.com/forms/d/e/1FAIpQLScKNyLCjSEWAwc-THjC7NJVDNRxQmVR5ey30VVayPhWOIhy1Q/viewform">here</a>!
- Email us at `gethelp@aladindb.com`.
- Feel free to contact a maintainer or community volunteer directly! 



## Contributing  

#### There are many ways to contribute, and they are not limited to writing code. We welcome all contributions such as:


- <a href="https://github.com/aladindb/aladindb/issues/new/choose">Bug reports</a>
- <a href="https://github.com/aladindb/aladindb/issues/new/choose">Documentation improvements</a>
- <a href="https://github.com/aladindb/aladindb/issues/new/choose">Enhancement suggestions</a>
- <a href="https://github.com/aladindb/aladindb/issues/new/choose">Feature requests</a>
- <a href="https://github.com/aladindb/aladindb/issues/new/choose">Expanding the tutorials and use case examples</a>

Please see our [Contributing Guide](CONTRIBUTING.md) for details.

## Contributors
#### Thanks goes to these wonderful people:

<a href="https://github.com/aladindb/aladindb/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=aladindb/aladindb" />
</a>


## License  

aladindb 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.

## Join Us 

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 <a href="https://join.com/companies/aladindb">here</a>!

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "aladindb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Duncan Blythe <opensource@aladindb.com>",
    "keywords": "mongo,mongodb,pymongo,data-science,machine-learning,mlops,vector-database,ai",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/2a/10/3b6984d8640d7c47c73bbcc9ac8a0b022f2113c671a2e040276c57364328/aladindb-0.1.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <a href=\"https://www.aladindb.com\">\n    <img width=\"90%\" src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/img/aladindb_logo_color.svg\">\n  </a>\n</p>\n<div align=\"center\">\n\n# Bring AI to your favorite database! \n\n</div>\n\n<div align=\"center\">\n\n## <a href=\"https://aladindb.github.io/aladindb/\"><strong>Docs</strong></a> | <a href=\"https://docs.aladindb.com/blog\"><strong>Blog</strong></a> | <a href=\"https://docs.aladindb.com/docs/category/use-cases\"><strong>Use-Cases</strong></a> | <a href=\"https://demo.aladindb.com\"><strong> Live Notebooks</strong></a> | <a href=\"https://github.com/aladindb/aladin-community-apps\"><strong>Community Apps</strong></a> |  <a href=\"https://join.slack.com/t/aladindb/shared_invite/zt-1zuojj0k0-RjAYBs1TDsvEa7yaFGa6QA\"><strong> Slack </strong></a> | <a href=\"https://www.youtube.com/channel/UC-clq9x8EGtQc6MHW0GF73g\"><strong> Youtube </strong></a>\n\n</div>\n\n\n<div align=\"center\">\n\t<a href=\"https://pypi.org/project/aladindb\"><img src=\"https://img.shields.io/pypi/v/aladindb?color=%23007ec6&label=pypi%20package\" alt=\"Package version\"></a>\n\t<a href=\"https://pepy.tech/project/aladindb\"><img src=\"https://pepy.tech/badge/aladindb\" alt=\"Downloads\"></a>\n  \t<a href=\"https://pypi.org/project/aladindb\"><img src=\"https://img.shields.io/pypi/pyversions/aladindb.svg\" alt=\"Supported Python versions\"></a>    \n\t<a href=\"https://github.com/aladindb/aladindb/actions/workflows/ci_code.yml\"><img src=\"https://github.com/aladindb/aladindb/actions/workflows/ci_code.yml/badge.svg?branch=main\" /></a>\t\n\t<a href=\"https://codecov.io/gh/aladindb/aladindb/branch/main\"><img src=\"https://codecov.io/gh/aladindb/aladindb/branch/main/graph/badge.svg\" alt=\"Coverage\"></a>\n\t<a href=\"https://github.com/aladindb/blob/main/LICENSE\"><img src=\"https://img.shields.io/badge/license-Apache_2.0-green\" alt=\"License - Apache 2.0\"></a>\t\n\t<a href=\"https://twitter.com/aladindb\" target=\"_blank\"><img src=\"https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow @aladindb\"></a>\n\n<b>English</b> |\n[**\u4e2d\u6587**](README_zh.md) |\n[**\u65e5\u672c\u8a9e**](README_ja.md)\n\n\n\n</div>\n\n\n\n\n\n## What is aladindb? \ud83d\udd2e \n\naladindb is an open-source framework for integrating your database with AI models, APIs, and vector search engines, providing streaming inference and scalable training/fine-tuning.\n\naladindb is **not** a database. aladindb is an open platform unifying data infrastructure and AI. Think `db = aladin(db)`: aladindb transforms your databases into an intelligent system that leverages the full power of the AI, open-source and Python ecosystem. It is a single scalable environment for all your AI that can be deployed anywhere, in the cloud, on-prem, on your machine.\n\naladindb allows you to build AI applications easily without needing to move your data to complex MLOps pipelines and specialized vector databases by integrating AI at the data\u2019s source, directly on top of your existing data infrastructure:\n- Generative AI & LLM-Chat\n- Vector Search\n- Standard Machine Learning Use-Cases (Classification, Segmentation, Recommendation etc.)\n- Highly custom AI use-cases involving ultra specialized models\n\n**To get started:**\nCheck the use-cases we have already implemented [here in the docs](https://docs.aladindb.com/docs/category/use-cases) as well as the apps built by the community in the dedicated [aladin-community-apps repo](https://github.com/aladindb/aladin-community-apps) and try all of them with [Jupyter right in your browser](https://demo.aladindb.com/)! \n\n`aladindb is open-source: Please leave a star to support the project! \u2b50`\n\n\nFor more information about aladindb and why we believe it is much needed, [read this blog post](https://docs.aladindb.com/blog/aladindb-the-open-source-framework-for-bringing-ai-to-your-datastore/). \n\n\n\n\n<div align=\"center\">\n\t<a href=\"https://www.youtube.com/watch?v=FxJs7pbHj3Q\"><img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/overview.png\" alt=\"Overview\" width=\"400\"></a>\n\t<a href=\"https://www.youtube.com/watch?v=Hr0HkmIL3go\"><img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/quickstart.png\" alt=\"QuickStart\" width=\"400\"></a>\n</div>\n\n\n</div>\n\n### Key Features:\n- **[Integration of AI with your existing data infrastructure](https://docs.aladindb.com/docs/docs/walkthrough/apply_models):** Integrate any AI models and APIs with your databases in a single scalable deployment, without the need for additional pre-processing steps, ETL or boilerplate code.\n- **[Streaming Inference](https://docs.aladindb.com/docs/docs/walkthrough/daemonizing_models_with_listeners):** Have your models compute outputs automatically and immediately as new data arrives, keeping your deployment always up-to-date.\n- **[Scalable Model Training](https://docs.aladindb.com/docs/docs/walkthrough/training_models):** Train AI models on large, diverse datasets simply by querying your training data. Ensured optimal performance via in-build computational optimizations.\n- **[Model Chaining](https://docs.aladindb.com/docs/docs/walkthrough/linking_interdependent_models/)**: Easily setup complex workflows by connecting models and APIs to work together in an interdependent and sequential manner.\n- **[Simple, but Extendable Interface](https://docs.aladindb.com/docs/docs/fundamentals/procedural_vs_declarative_api)**: Add and leverage any function, program, script or algorithm from the Python ecosystem to enhance your workflows and applications. Drill down to any layer of implementation, including to the inner workings of your models while operating aladindb with simple Python commands.\n- **[Difficult Data-Types](https://docs.aladindb.com/docs/docs/walkthrough/encoding_special_data_types/)**: Work directly with images, video, audio in your database, and any type which can be encoded as `bytes` in Python.\n- **[Feature Storing](https://docs.aladindb.com/docs/docs/walkthrough/encoding_special_data_types):** Turn your database into a centralized repository for storing and managing inputs and outputs of AI models of arbitrary data-types, making them available in a structured format and known environment.\n- **[Vector Search](https://docs.aladindb.com/docs/docs/walkthrough/vector_search):** No need to duplicate and migrate your data to additional specialized vector databases - turn your existing battle-tested database into a fully-fledged multi-modal vector-search database, including easy generation of vector embeddings and vector indexes of your data with preferred models and APIs.\n\n### Why opt for aladindb?\n|                            | With aladindb | Without |\n|----------------------------|-|-|\n| 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.   |\n| 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. |\n| Code                       | Minimal learning curve due to a simple and declarative API, requiring simple Python commands. |  Hundreds of lines of codes and settings in different environments and tools.     |\n\n\n## Supported Datastores (*more coming soon*):\n\n<table>\n    <tr>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmongodb.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmongodb-atlas.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xaws-s3.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpostgresql.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmysql.png\" width=\"139px\" />\n        </td>\n    </tr>\n    <tr>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xsqlite.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xduckdb.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xsnowflake.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xbigquery.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xclickhouse.png\" width=\"139px\" />\n        </td>\n    </tr>\n    <tr>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xdatafusion.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xdruid.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Ximpala.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xmssql.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xoracle.png\" width=\"139px\" />\n        </td>\n    </tr>\n    <tr>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpandas.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpolars.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xpyspark.png\" width=\"139px\" />\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/databases/2Xtrino.png\" width=\"139px\" />\n        </td>\n    </tr>\n\n</table>\n\n**Transform your existing database into a Python-only AI development and deployment stack with one command:**\n\n```\ndb = aladin('mongodb|postgres|mysql|sqlite|duckdb|snowflake://<your-db-uri>')\n```\n\n## Supported AI Frameworks and Models (*more coming soon*):\n\n<table>\n    <tr>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/frameworks/2Xpytorch.png\" width=\"139px\"/>\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/frameworks/2Xscikit-learn.png\" width=\"139px\"/>\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/frameworks/2Xhuggingface-transformers.png\" width=\"139px\"/>\n        </td>\n    </tr>\n</table>\n\n**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:**\n\n- Install and deploy model:\n\n```\nm = db.add(\n    <sklearn_model>|<torch_module>|<transformers_pipeline>|<arbitrary_callable>,\n    preprocess=<your_preprocess_callable>,\n    postprocess=<your_postprocess_callable>,\n    encoder=<your_datatype>\n)\n```\n\n- Predict:\n\n```\nm.predict(X='<input_column>', db=db, select=<mongodb_query>, listen=False|True, create_vector_index=False|True)\n```\n\n- Train model:\n\n```\nm.fit(X='<input_column_or_key>', y='<target_column_or_key>', db=db, select=<mongodb_query>|<ibis_query>)\n```\n\n\n\n\n\n## Pre-Integrated AI APIs (*more coming soon*):\n\n<table >\n    <tr>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/2Xopenai.png\" width=\"139px\"/>\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/2Xcohere.png\" width=\"139px\"/>\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/2Xanthropic.png\" width=\"139px\"/>\n        </td>\n        <td align=\"center\" width=\"140\" height=\"112.43\">\n            <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/apis/jinaai.png\" width=\"139px\"/>\n        </td>\n    </tr>\n</table>\n\n**Integrate externally hosted models accessible via API to work together with your other models with a simple Python command:**\n\n```\nm = db.add(\n    OpenAI<Task>|Cohere<Task>|Anthropic<Task>|JinaAI<Task>(*args, **kwargs),   # <Task> - Embedding,ChatCompletion,...\n)\n```\n\n\n\n\n## Infrastructure Diagram\n\n<p align=\"center\">\n  <img width=\"100%\" src=\"docs/hr/static/img/aladindb.gif\">\n</p>\n\n\n\n## Featured Examples\n\nTry our ready-to-use notebooks [live on your browser](https://demo.aladindb.com). \n\nAlso find use-cases and apps built by the community in the [aladin-community-apps repository](https://github.com/aladindb/aladin-community-apps).\n\n\n<table>\n  <tr>\n    <td width=\"30%\">\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/multimodal_image_search_clip.ipynb\">\n        <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/image-search.svg\" />\n      </a>\n    </td>\n    <td width=\"30%\">\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/video_search.ipynb\">\n        <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/video-search.svg\" />\n      </a>\n    </td>\n    <td width=\"30%\">\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/question_the_docs.ipynb\">\n        <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/semantic-search.svg\" />\n      </a>\n    </td>\n  </tr>\n  <tr>\n    <th>\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/multimodal_image_search_clip.ipynb\">Text-To-Image Search</a>\n    </th>\n    <th>\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/video_search.ipynb\">Text-To-Video Search</a>\n    </th>\n    <th>\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/question_the_docs.ipynb\">Question the Docs</a>\n    </th>\n  </tr>\n  <tr>     \n    <td width=\"30%\">\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/vector_search.ipynb\">\n        <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/document-search.svg\" />\n      </a>\n    </td>\n    <td width=\"30%\">\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/mnist_torch.ipynb\">\n        <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/machine-learning.svg\" />\n      </a>\n    </td>\n    <td width=\"30%\">\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/transfer_learning.ipynb\">\n        <img src=\"https://raw.githubusercontent.com/aladindb/aladindb/main/docs/hr/static/icons/featured-examples/transfer-learning.svg\" />\n      </a>\n    </td>\n  </tr>\n  <tr>\n    <th>\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/vector_search.ipynb\">Semantic Search Engine</a>\n    </th>\n    <th>\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/mnist_torch.ipynb\">Classical Machine Learning</a>\n    </th>\n    <th>\n      <a href=\"https://demo.aladindb.com/user-redirect/lab/tree/transfer_learning.ipynb\">Cross-Framework Transfer Learning</a>\n    </th>\n  </tr>\n</table>\n\n\n\n## Installation\n\n#### 1. Install aladindb via `pip` *(~1 minute)*:\n\n**Requirements**:\n\n- Python 3.10 or 3.11\n- Working `pip` installation (e.g. via virtual environment)\n\n```\npip install aladindb\n```\n\n#### 2. Try aladindb via Docker *(~2 minutes)*:\n  \n**Requirements**:\n   \n- Working `docker` [installation](https://docs.docker.com/engine/install/)\n\n```\ndocker run -p 8888:8888 aladindb/demo:latest\n```\n\n## Preview\n\nHere are snippets which give you a sense of how `aladindb` works and how simple it is to use. You can visit the <a href=\"https://docs.aladindb.com\">docs</a> to learn more.\n\n\n#### - Deploy ML/AI models to your database:\nAutomatically compute outputs (inference) with your database in a single environment.\n\n```python\nimport pymongo\nfrom sklearn.svm import SVC\n\nfrom aladindb import aladin\n\n# Make your db aladin!\ndb = aladin(pymongo.MongoClient().my_db)\n\n# Models client can be converted to aladindb objects with a simple wrapper.\nmodel = aladin(SVC())\n\n# Add the model into the database\ndb.add(model)\n\n# Predict on the selected data.\nmodel.predict(X='input_col', db=db, select=Collection(name='test_documents').find({'_fold': 'valid'}))\n```\n\n\n#### - Train models directly from your database.\nSimply by querying your database, without additional ingestion and pre-processing:\n\n```python\nimport pymongo\nfrom sklearn.svm import SVC\n\nfrom aladindb import aladin\n\n# Make your db aladin!\ndb = aladin(pymongo.MongoClient().my_db)\n\n# Models client can be converted to aladindb objects with a simple wrapper.\nmodel = aladin(SVC())\n\n# Fit model on the training data.\nmodel.fit(X='input_col', y='target_col', db=db, select=Collection(name='test_documents').find({}))\n```\n\n#### - Vector-Search your data:\nUse your existing favorite database as a vector search database, including model management and serving. \n\n```python\n# First a \"Listener\" makes sure vectors stay up-to-date\nindexing_listener = Listener(model=OpenAIEmbedding(), key='text', select=collection.find())\n\n# This \"Listener\" is linked with a \"VectorIndex\"\ndb.add(VectorIndex('my-index', indexing_listener=indexing_listener))\n\n# The \"VectorIndex\" may be used to search data. Items to be searched against are passed\n# to the registered model and vectorized. No additional app layer is required.\ndb.execute(collection.like({'text': 'clothing item'}, 'my-index').find({'brand': 'Nike'}))\n```\n\n#### - Integrate AI APIs to work together with other models. \nUse OpenAI, Jina AI, PyTorch or Hugging face model as an embedding model for vector search.\n\n```python\n# Create a ``VectorIndex`` instance with indexing listener as OpenAIEmbedding and add it to the database.\ndb.add(\n    VectorIndex(\n        identifier='my-index',\n        indexing_listener=Listener(\n            model=OpenAIEmbedding(identifier='text-embedding-ada-002'),\n            key='abstract',\n            select=Collection(name='wikipedia').find(),\n        ),\n    )\n)\n# The above also executes the embedding model (openai) with the select query on the key.\n\n# Now we can use the vector-index to search via meaning through the wikipedia abstracts\ncur = db.execute(\n    Collection(name='wikipedia')\n        .like({'abstract': 'philosophers'}, n=10, vector_index='my-index')\n)\n```\n\n\n#### - Add a Llama 2 model to aladindb!:\n```python\nmodel_id = \"meta-llama/Llama-2-7b-chat-hf\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\npipeline = transformers.pipeline(\n    \"text-generation\",\n    model=model_id,\n    torch_dtype=torch.float16,\n    device_map=\"auto\",\n)\n\nmodel = Pipeline(\n    identifier='my-sentiment-analysis',\n    task='text-generation',\n    preprocess=tokenizer,\n    object=pipeline,\n    torch_dtype=torch.float16,\n    device_map=\"auto\",\n)\n\n# You can easily predict on your collection documents.\nmodel.predict(\n    X=Collection(name='test_documents').find(),\n    db=db,\n    do_sample=True,\n    top_k=10,\n    num_return_sequences=1,\n    eos_token_id=tokenizer.eos_token_id,\n    max_length=200\n)\n```\n\n#### - Use models outputs as inputs to downstream models:\n\n```python\nmodel.predict(\n    X='input_col',\n    db=db,\n    select=coll.find().featurize({'X': '<upstream-model-id>'}),  # already registered upstream model-id\n    listen=True,\n)\n```\n\n\n\n## Community & Getting Help \n\n#### If you have any problems, questions, comments, or ideas:\n- Join <a href=\"https://join.slack.com/t/aladindb/shared_invite/zt-1zuojj0k0-RjAYBs1TDsvEa7yaFGa6QA\">our Slack</a> (we look forward to seeing you there).\n- Search through <a href=\"https://github.com/aladindb/aladindb/discussions\">our GitHub Discussions</a>, or <a href=\"https://github.com/aladindb/aladindb/discussions/new/choose\">add a new question</a>.\n- Comment <a href=\"https://github.com/aladindb/aladindb/issues/\">an existing issue</a> or create <a href=\"https://github.com/aladindb/aladindb/issues/new/choose\">a new one</a>.\n- Help us to improve aladindb by providing your valuable feedback <a href=\"https://docs.google.com/forms/d/e/1FAIpQLScKNyLCjSEWAwc-THjC7NJVDNRxQmVR5ey30VVayPhWOIhy1Q/viewform\">here</a>!\n- Email us at `gethelp@aladindb.com`.\n- Feel free to contact a maintainer or community volunteer directly! \n\n\n\n## Contributing  \n\n#### There are many ways to contribute, and they are not limited to writing code. We welcome all contributions such as:\n\n\n- <a href=\"https://github.com/aladindb/aladindb/issues/new/choose\">Bug reports</a>\n- <a href=\"https://github.com/aladindb/aladindb/issues/new/choose\">Documentation improvements</a>\n- <a href=\"https://github.com/aladindb/aladindb/issues/new/choose\">Enhancement suggestions</a>\n- <a href=\"https://github.com/aladindb/aladindb/issues/new/choose\">Feature requests</a>\n- <a href=\"https://github.com/aladindb/aladindb/issues/new/choose\">Expanding the tutorials and use case examples</a>\n\nPlease see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## Contributors\n#### Thanks goes to these wonderful people:\n\n<a href=\"https://github.com/aladindb/aladindb/graphs/contributors\">\n  <img src=\"https://contrib.rocks/image?repo=aladindb/aladindb\" />\n</a>\n\n\n## License  \n\naladindb is open-source and intended to be a community effort, and it wouldn't be possible without your support and enthusiasm.\nIt is distributed under the terms of the Apache 2.0 license. Any contribution made to this project will be subject to the same provisions.\n\n## Join Us \n\nWe 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 <a href=\"https://join.com/companies/aladindb\">here</a>!\n",
    "bugtrack_url": null,
    "license": " Apache License Version 2.0, January 2004 http://www.apache.org/licenses/  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION  1. Definitions.  \"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.  \"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.  \"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.  \"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.  \"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.  \"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.  \"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).  \"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.  \"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"  \"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.  2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.  3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.  4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:  (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and  (b) You must cause any modified files to carry prominent notices stating that You changed the files; and  (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and  (d) If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.  You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.  5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.  6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.  7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.  8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.  9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.  END OF TERMS AND CONDITIONS  APPENDIX: How to apply the Apache License to your work.  To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't include the brackets!)  The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same \"printed page\" as the copyright notice for easier identification within third-party archives.  Copyright [2023] [aladindb, Inc.]  Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ",
    "summary": "\ud83d\udd2e Super-power your database with AI \ud83d\udd2e",
    "version": "0.1.1",
    "project_urls": {
        "documentation": "https://docs.aladindb.com",
        "homepage": "https://www.aladindb.com/",
        "source": "https://github.com/aladindb/aladindb/"
    },
    "split_keywords": [
        "mongo",
        "mongodb",
        "pymongo",
        "data-science",
        "machine-learning",
        "mlops",
        "vector-database",
        "ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "69940c819ab56ca5cb3dcc169ac640aede6cb55009b5d02196e944112fa1b7d3",
                "md5": "17eca679aaf9cf2de0339e3267ada753",
                "sha256": "072aae1423227a574da016720d067e4cb4439771811ff8d2f8f8966a985b6df6"
            },
            "downloads": -1,
            "filename": "aladindb-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "17eca679aaf9cf2de0339e3267ada753",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 180811,
            "upload_time": "2024-01-05T01:41:43",
            "upload_time_iso_8601": "2024-01-05T01:41:43.353488Z",
            "url": "https://files.pythonhosted.org/packages/69/94/0c819ab56ca5cb3dcc169ac640aede6cb55009b5d02196e944112fa1b7d3/aladindb-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a103b6984d8640d7c47c73bbcc9ac8a0b022f2113c671a2e040276c57364328",
                "md5": "40a525a32ad50d294c96f29b8444469f",
                "sha256": "d7d158ddebbf5f8a249ed955917f137dcd1868ec0a0fed6680c5d6bbd243006c"
            },
            "downloads": -1,
            "filename": "aladindb-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "40a525a32ad50d294c96f29b8444469f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 148987,
            "upload_time": "2024-01-05T01:41:45",
            "upload_time_iso_8601": "2024-01-05T01:41:45.218341Z",
            "url": "https://files.pythonhosted.org/packages/2a/10/3b6984d8640d7c47c73bbcc9ac8a0b022f2113c671a2e040276c57364328/aladindb-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-05 01:41:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aladindb",
    "github_project": "aladindb",
    "github_not_found": true,
    "lcname": "aladindb"
}
        
Elapsed time: 0.18351s