Skip to main content

A blazing-fast lightweight Rust hybrid retriever optimized for Real Time search.

Reason this release was yanked:

bug with lib file

Project description

Hybrid Retriever API

A lightweight FastAPI-based API for performing hybrid document retrieval using lexical (TF-IDF + BM25) and semantic (embedding-based + cross-encoder) search. It wraps a Rust + PyO3-backed HybridRetriever for high performance and accurate search over small-to-medium datasets.

Features

  • Hybrid search using precomputed document embeddings + query text
  • Cross-encoder reranking support
  • BM25 + TF-IDF lexical fallback
  • CORS-enabled and API-ready

Requirements

  • Python 3.8+
  • numpy
  • PyO3-bound hre module (compiled from Rust)
  • A compatible cross-encoder model (e.g., cross-encoder/ms-marco-MiniLM-L-6-v2)
import numpy as np
from hre_tools import HybridRetriever

documents = [
    "Doc one",
    "Doc two",
    "Another doc"
] + [f"Doc {i}" for i in range(8)]

# Define matching embeddings
embeddings = np.random.rand(len(documents), 300).astype(np.float32)

# Define query
query_text = "What is in another doc?"
query_emb = np.random.rand(1, 300).astype(np.float32)

# Instantiate retriever
retriever = HybridRetriever(
    embeddings=embeddings,
    documents=documents,
    cross_encoder="cross-encoder/ms-marco-MiniLM-L-6-v2",
    source_filename="example_index"
)

# Perform hybrid search
docs, scores = retriever.hybrid_search(query_emb, query_text, top_k=3)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hre_tools-0.1.1.tar.gz (54.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hre_tools-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl (18.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

File details

Details for the file hre_tools-0.1.1.tar.gz.

File metadata

  • Download URL: hre_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 54.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for hre_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5c2d0e96c0d7099714f73ff38c6a7c5a6c86d87f1c71e075e3cc6a092aec18c0
MD5 658ee358f4fa76c594408c1416774494
BLAKE2b-256 3e945b73bb00c3790ce7de06671697a6e56da4cf79c38b0bac96a1d63c59c399

See more details on using hashes here.

File details

Details for the file hre_tools-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for hre_tools-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 8589986005f655b70daa81dd16ac5d5e239a8c3713cf72ed41661e4670dc2f7c
MD5 91d1b9e113c604d6e5022f1222326148
BLAKE2b-256 135e1b5767a63aa04fdd993df14e73595f3a0b0ecdd6a7d64ab23855bff5a3ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page