qdrant / rust-client

Rust client for Qdrant vector search engine
https://crates.io/crates/qdrant-client
Apache License 2.0
232 stars 45 forks source link

Replace macro with just code for structure builders #195

Open generall opened 3 hours ago

generall commented 3 hours ago

Currently we use macro definitions to auto-generate code for structure builders, which looks like this:

builder_type_conversions!(CreateCollection, CreateCollectionBuilder);
builder_type_conversions!(VectorParams, VectorParamsBuilder, true);
builder_type_conversions!(HnswConfigDiff, HnswConfigDiffBuilder);
builder_type_conversions!(ScalarQuantization, ScalarQuantizationBuilder, true);
builder_type_conversions!(ProductQuantization, ProductQuantizationBuilder, true);
builder_type_conversions!(BinaryQuantization, BinaryQuantizationBuilder, true);
builder_type_conversions!(OptimizersConfigDiff, OptimizersConfigDiffBuilder);

https://github.com/qdrant/rust-client/blob/master/src/qdrant.rs#L9606

But usage of macros makes navigation in the project harder.

qdrant.rs file is generated using code from here https://github.com/qdrant/rust-client/blob/master/tests/protos.rs#L173 (yes, in test :man_shrugging: )

I propose to abandon macros and use hand-written code instead. It would be easier to write a whole new definition of the builder than to understand how generator works.

To do this, I think we need to

In order to make sure friction-less transition, we need to make sure all test snippets are still valid without changing: https://github.com/qdrant/rust-client/tree/master/tests/snippet_tests

generall commented 3 hours ago

/bounty $200

algora-pbc[bot] commented 3 hours ago

💎 $200 bounty • Qdrant

Steps to solve:

  1. Start working: Comment /attempt #195 with your implementation plan
  2. Submit work: Create a pull request including /claim #195 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to qdrant/rust-client!

Add a bountyShare on socials