Coder Social home page Coder Social logo

pyvecdb's Introduction

PyVecDB

PyVecDB is a Python library that provides a simple way to store and search high-dimensional vectors using the Annoy approximate nearest neighbors search library. This library is useful for various applications, such as searching for similar items, clustering, or reducing search spaces in machine learning problems.

Features

  • Store high-dimensional vectors with associated metadata in an SQLite database
  • Perform fast, approximate nearest neighbor searches using Annoy
  • Easily add, update, and delete entries
  • Serialize and deserialize vector data using MessagePack

Installation

You can install PyVecDB using pip:

pip install pyvecdb

Usage

Here's a simple example that demonstrates how to use PyVecDB:

from datetime import datetime
from random import random
from pyvecdb import VectorDB, DataObject

# Initialize the database
db = VectorDB(db_path="vector_data.db")

# Create a new entry
entry = DataObject(timestamp=datetime.now(), message="Example message", vector=[random() for _ in range(3)])
db.add_entry(entry)

# Save the Annoy index
db.save_index("vector_index.ann")

# Load the Annoy index
db.load_index("vector_index.ann")

# Search for similar entries
entries = db.search_entries(vector=entry.vector, num_results=10)

Documentation

For detailed documentation and examples, please visit the official documentation.

Contributing

Contributions are welcome! Please read our contributing guidelines to get started.

License

PyVecDB is released under the MIT License.

Support

If you like my work consider buying me a coffee โ˜• Support my work on Patreon or PayPal!

Support me on Patreon

pyvecdb's People

Stargazers

Patrick Barker avatar TylerNorth avatar

Watchers

TylerNorth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.