spotify / voyager

🛰️ An approximate nearest-neighbor search library for Python and Java with a focus on ease of use, simplicity, and deployability.
https://spotify.github.io/voyager/
Apache License 2.0
1.26k stars 51 forks source link

Add custom metadata header. #26

Closed psobot closed 10 months ago

psobot commented 10 months ago

This PR introduces a backwards-incompatible change to Voyager: we now prepend a custom metadata header to the start of every index file, indicating three properties that otherwise need to be specified at load time:

This allows us to finally just do:

index = voyager.Index.load("my_index.voy")

...instead of:

index = voyager.Index.load(
    "my_index.hnsw",
    num_dimensions=128,
    space=voyager.Space.Euclidean,
    storage_data_type=voyager.StorageDataType.Float32
)

(and similar in Java).

This PR also includes a collection of V0 test indices (to ensure backwards compatibility) in the Python tests.

Paired with @dylanrb123.