Skip to main content

A simple vector database for fast similarity search

Project description

AttogradDB

A lightweight document based vector store for fast and efficient semantic retrieval. Lightning fast vector-based search for NoSQL and plaintext documents, embedded using BERT.

Version 0.4

Features

  • NoSQL Key Value Store
  • Plaintext document processing
  • Document Embedding
  • Customizable Vector Store
  • HNSW Indexing
  • Semantic search for NoSQL documents

Installation

Method 1: Install the PyPI package

pip install attogradDB==0.3.1

Method 2: Clone and build from source

git clone https://github.com/gouthamk16/AttogradDB.git

Setup and activate python virtual environment

cd AttogradDB
python -m venv .venv
source .venv/bin/activate

Build setup dependencies

pip install -e .

Usage

Examples can be found at AttogradDB/examples

Documentation

VectorStore

  • __init__(indexing="hnsw", embedding_model="bert", save_index=False) Initialize vector store with specified indexing and embedding model.

  • add_text(vector_id, input_data) Add a single text document to the vector store after embedding.

  • add_documents(docs) Bulk-add a list of JSON documents to the vector store after converting to text and embedding.

  • get_similar(query_text, top_n=5, decode_results=True) Find top N semantically similar documents for a given query text. Returns list of tuples containing (vector_id, similarity_score, document_text) if decode_results=True, otherwise returns (vector_id, similarity_score).

  • similarity(vector_a, vector_b, method="cosine") Calculate cosine similarity between two vectors.

keyValueStore

  • create_master_collection(name) Create a new master collection to group related collections.

  • create_collection(name, master_collection="default") Create a new collection within a master collection.

  • use_collection(collection, master_collection="default") Switch to a specific collection for operations.

  • add(data, doc_id=None) Add document(s) to current collection with optional custom IDs.

  • add_json(json_file) Add documents from a JSON file to current collection.

  • search(key, value) Search documents by key-value pair in current collection.

  • toVector(indexing="brute-force", embedding_model="bert", collection=None, master_collection=None) Convert collection documents to vector store with specified indexing and embedding model.

Embedding

BertEmbedding

  • Generates BERT-based embeddings for input text.

  • Supports reverse mapping from embeddings back to text.

Indexing

HNSW

  • Implements Hierarchical Navigable Small World indexing.

  • Provides efficient approximate nearest-neighbor search for large data.

Clustered Brute-Force

  • Implements brute-force search of clustered documents.

  • Lightspeed search for small to medium sized documents and NoSQL databases.

Roadmap

  • Add support for GPU-accelerated embedding generation and vector search using cuda.
  • C/Rust backend for similarity search and indexing.
  • Performance logging for HNSW indexing.
  • Publishing the library on PyPI.
  • Adding support for more embedding models and indexing methods.

Contributing

Contributions are welcome! If you encounter bugs or have feature requests, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

attograddb-0.4.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

attogradDB-0.4-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file attograddb-0.4.tar.gz.

File metadata

  • Download URL: attograddb-0.4.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for attograddb-0.4.tar.gz
Algorithm Hash digest
SHA256 881f0c3687f5608a9c68c5df9fd47d9c42f0b6f5be41c6b09344c0493af72e8a
MD5 1075efbb23122453f00b33cdad51bc01
BLAKE2b-256 001f0563194a047e1daf9b9cfd52914c67b25c31922b45a639a22c8d803e81a2

See more details on using hashes here.

File details

Details for the file attogradDB-0.4-py3-none-any.whl.

File metadata

  • Download URL: attogradDB-0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for attogradDB-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 310bcd7e37fcdb7a8a4b55f6c77c8909c091813b91152f64f758a4c4e9850648
MD5 1467b57439f91e2448355f71d4016ba5
BLAKE2b-256 26c343dbaf6d440373da86a342d0328ada011bd4855f8e58092e85d171ed9700

See more details on using hashes here.

Supported by

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