Blyx

Retrieval

Ranking metrics library · 0.1.1

Score ranked search or RAG results without giving repeated document IDs extra credit.

Install with Conda

Create an environment containing Retrieval 0.1.1, its Blyx source and a runnable example. Run the second command with Blyx 0.2.1, Rust and a host linker installed.

conda create -y --prefix ./blyx-env --override-channels -c https://rahulchaube1.github.io/blyx-packages blyx-retrieval=0.1.1=0
blyxc native-run ./blyx-env/share/blyx/retrieval/main.blyx

To use this package in your application, copy share/blyx/retrieval/vendor/retrieval from the environment into your project's vendor directory.

Install the full collection with Homebrew or Scoop

Import into a Blyx project

Install Blyx 0.2.1, Rust 1.85 or newer and a host linker. From the directory containing your entry file, clone this tagged release.

git clone --depth 1 --branch v0.1.1 https://github.com/Rahulchaube1/blyx-retrieval.git vendor/retrieval

Save this as main.blyx beside vendor and run blyxc native-run main.blyx.

use vendor::retrieval::retrieval;
fn main() {
    let result = retrieval_at_k([7, 7, 9, 12], [7, 9], 3);
    println!(at(result, 1));
    println!(at(result, 2));
}

Expected output

1
1

API and input requirements

Use finite, whole, nonnegative document IDs up to the largest exactly representable safe integer. Duplicate hits occupy a rank. Precision includes unfilled positions up to the cutoff. The implementation targets small per-query rankings.

APIUse
retrieval_at_k(ranked, relevant, k)Return precision, recall, reciprocal rank and average precision at the cutoff.

Develop and contribute

Open the tagged source to read the implementation and examples. Include the smallest reproducible Blyx program, compiler version and expected result when reporting an issue.