Skip to main content

A lightweight vector database

Project description

Embedin - Empower AI with persistent memory

PyPI Coverage Status

What is Embedin

Embedin is a highly efficient software library designed to seamlessly convert widely-used databases, such as MySQL, PostgreSQL, and MS SQL Server, into a vector database with minimal effort. Its lightweight design enables quick and easy integration into your existing software stack, allowing you to leverage the benefits of a vector database without the need for extensive modifications to your current system.

With fast indexing and retrieval, it's ideal for high-performance applications such as natural language processing, image recognition, and recommendation systems. Embedin's simple API and query language make it easy to use and integrate.

Installation

pip install embedin

Quick Start

Using memory

from embedin.client import Client

client = Client(collection_name="test_collection", texts=["This is a test", "Hello world!"])
result = client.query("These are tests", top_k=1)
print(result)

Using Sqlite

from embedin.client import Client

url = 'sqlite:///test.db'
client = Client(collection_name="test_collection", texts=["This is a test", "Hello world!"])
result = client.query("These are tests", top_k=1)

Using PostgreSQL

import os

from embedin.client import Client

url = os.getenv('EMBEDIN_POSGRES_URL', "postgresql+psycopg2://embedin:embedin@localhost/embedin_db")
client = Client(collection_name="test_collection", texts=["This is a test", "Hello world!"])
result = client.query("These are tests", top_k=1)

Using MySQL

import os

from embedin.client import Client

url = os.getenv('EMBEDIN_MYSQL_URL', "mysql+pymysql://embedin:embedin@localhost/embedin_db")
client = Client(collection_name="test_collection", texts=["This is a test", "Hello world!"])
result = client.query("These are tests", top_k=1)

Using MS-SQL

import os

from embedin.client import Client

url = os.getenv('EMBEDIN_MSSQL_URL', "mssql+pymssql://sa:StrongPassword123@localhost/tempdb")
client = Client(collection_name="test_collection", url=url)
client.add_data(texts=["This is a test"], meta_data=[{"source": "abc4"}])
result = client.query("These are tests", top_k=1)

For development

Clone the repo

git clone https://github.com/EmbedInAI/embedin.git

Start PostgreSQL DB (Only necessary for using PostgreSQL as the storage)

cd docker
docker-compose up embedin-postgres

Start MySQL DB (Only necessary for using MySQL as the storage)

cd docker
docker-compose up embedin-mysql

Start MS-SQL DB (Only necessary for using MS-SQL as the storage)

cd docker
docker-compose up embedin-mssql

Run unit test with coverage report

coverage run -m unittest discover -s tests -p '*.py'
coverage report

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

embedin-0.2.1.tar.gz (22.3 kB view hashes)

Uploaded Source

Built Distribution

embedin-0.2.1-py3-none-any.whl (34.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page