This repo exposes C API for using vector similarity search. Allows Creating indices of vectors and searching for top K similar to some vector in two methods: brute force, and by using hnsw algorithm (probabilistic).
The API header files are vec_sim.h
and query_results.h
, which are located in src/VecSim
.
TBD
TBD
For building you will need:
python
(either by creating virtual environment or setting your system pytnon to point to the right python distribution)To build the main library, unit tests and python byndings in one command run
make
To execute unit tests run
make
make unit_test
To run unit with valgrind run
make VALGRIND=1
make unit_test VALGRIND=1
To run unit tests with clang memory and address santizersm, we have provided you a docker image to do so.
If you are using VSCode, make sure you have the Visual Studio Code Remote Development Extension Pack installed. You will be prompt about opening the repository in the devcontainer. This will automatically setup a development container with all the dependencies installed and will use Oh My ZSH as shell.
When done, execute below for memory sanitizer
make
make unit_test SAN=memory
Or execute below for address sanitizer
make
make unit_test SAN=address
Build and run the docker image
docker build .devcontainer -t vecsim_sanitizer
docker run -it -v "$(pwd)":/project vecsim_sanitizer
When on docker, you will need to install the dependencies in order to build and run tests
$ cd /project
$ ./sbin/system-setup.p
When done, execute below for memory sanitizer
make
make unit_test SAN=memory
Or execute below for address sanitizer
make
make unit_test SAN=address
Examples for using the python bindings to run vector similarity search can be found in tests/flow
.
To build the python wheel, first create a dedicated virtualenv using python 3.6 and higher. Then, activate the environment, install the dependencies and build the package. Please note, due to the way poetry generates a setup.py, you may have to erase it prior to re-running poetry build.
python -m venv venv
source venv/bin/activate
pip install poetry
poetry install
poetry build
To run in debug mode, replace the last two lines with:
DEBUG=1 poetry install
DEBUG=1 poetry build
After building the wheel, if you want to use the package you built, you will need to manually execute a pip install dist/.whl. Remember to replace with the complete package name.
This will create a new tox environment, install the wheel and execute the python bindings tests
tox -e flowenv
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。