Skip to main content

Powered by Dipamkara

Bhakti is

  1. A light-weight vector database

  2. Easy to use

  3. Thread safe

  4. Portable

  5. Reliable

  6. Suitable for small-sized datasets

Installation

  • From PYPI

    pip install bhakti
    
  • From Github

    Download .whl first then run

    pip install ./bhakti-X.X.X-py3-none-any.whl
    

Quick Start

Before all, make sure you've successfully installed Bhakti :)

  • Run Bhakti Server

    • To begin, create a path for storing data

      mkdir -p /path/to/db
      
    • Start server using shell command

      1. Create configuration file (.yaml)

        # bhakti.yaml
        DIMENSION: 1024
        DB_PATH: /path/to/db
        DB_ENGINE: dipamkara # optional, default to dipamkara
        CACHED: false # optional, default to false
        HOST: 0.0.0.0 # optional, default to 0.0.0.0
        PORT: 23860 # optional, default to 23860
        EOF: <eof> # optional, default to <eof>
        TIMEOUT: 4.0 # optional, default to 4.0 seconds
        BUFFER_SIZE: 256 # optional, default to 256 bytes
        VERBOSE: false # optional, default to false
        
      2. Run bhakti in shell

        # bash
        bhakti ./bhakti.yaml
        
    • Start server using Python

      # main.py
      from bhakti import BhaktiServer
      from bhakti.database import DBEngine
      
      if __name__ == '__main__':
          bhakti_server = BhaktiServer(
              dimension=1024,  # required, only vectors with 1024 dimensions are acceptable
              db_path='/path/to/db',  # required, path where stores data, portable
              db_engine=DBEngine.DIPAMKARA,  # optional, default to dipamkara
              cached=False,  # optional, default to false
              host='0.0.0.0',  # optional, default to 0.0.0.0
              port=23860,  # optional, default to 23860
              eof=b'<eof>',  # optional, default to b'<eof>'
              timeout=4.0,  # optional, default to 4.0 seconds
              buffer_size=256,  # optional, default to 256 bytes
              verbose=False  # optional, default to false
          )
          # run server
          bhakti_server.run()
      
  • Interact With A Bhakti Client

    Currently, Python(>=3.10) is supported

    # main.py
    import asyncio
    import numpy as np
    from bhakti import BhaktiClient
    from bhakti.database import Metric
    from bhakti.database import DBEngine
    
    
    async def main():
        client = BhaktiClient(
            server='127.0.0.1',  # optional, default to 127.0.0.1
            port=23860,  # optional, default to 23860
            eof=b'<eof>',  # optional, default to b'<eof>'
            timeout=4.0,  # optional, default to 4.0 seconds
            buffer_size=256,  # optional, default to 256 bytes
            db_engine=DBEngine.DIPAMKARA,  # optional, default to dipamkara
            verbose=False  # optional, default to false
        )
        vector = np.random.randn(1024)
        await client.create(vector=vector, document={'age': 31, 'gender': 'male'})
        await client.create_index('age')
        await client.create_index('gender')
        results = await client.find_documents_by_vector_indexed(
            query='age <= 31 && gender != "female"', 
            vector=vector,
            metric=Metric.EUCLIDEAN_Z_SCORE, 
            top_k=3
        )
        print(results)
        
    
    if __name__ == '__main__':
        asyncio.run(main())
    

Metadata

Release files for bhakti 0.2.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bhakti 0.2.19
File Size Uploaded
bhakti-0.2.19.tar.gz 51.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bhakti 0.2.19
File Interpreter ABI Platform
bhakti-0.2.19-py3-none-any.whl Python 3 none any Details

Total release size: 97.9 kB

Release files / bhakti-0.2.19.tar.gz

Download URL bhakti-0.2.19.tar.gz
Size 51.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b5046a13db64bc830905f82cd47d6d1c061782dc2922cfd8001792d0ffec63cd
BLAKE2b-256 checksum
How to use checksums
21b521d25bf14af1699a6408769f9b54a5847312d75a264ce5ae84f01ff28e5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / bhakti-0.2.19-py3-none-any.whl

Download URL bhakti-0.2.19-py3-none-any.whl
Size 46.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1bb4a2a246b47b6c03ee01efd378ef46ad195035ab34d3e5b4a1f56a8493a6a
BLAKE2b-256 checksum
How to use checksums
b413ac7f62b0c3ad475d8b93ed2b93a51e600099cdd4e74f8db16a89b84506ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.19 This release

2 release files

0.2.18

2 release files

0.2.17

2 release files

0.2.16

2 release files

0.2.15

2 release files

0.2.13

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page