Skip to main content

High-performance cosine similarity ranking for Retrieval-Augmented Generation (RAG) pipelines, vector search, and information retrieval, with a Python interface powered by a Rust backend.

Project description

logo-symrank

Similarity ranking for Retrieval-Augmented Generation

Meta       uv  Ruff  Powered by Rust  Analytics in Motion

✨ What is SymRank?

SymRank is a blazing-fast Python library for top-k cosine similarity ranking, designed for vector search, retrieval-augmented generation (RAG), and embedding-based matching.

Built with a Rust + SIMD backend, it offers the speed of native code with the ease of Python.


🚀 Why SymRank?

⚡ Fast: SIMD-accelerated cosine scoring with adaptive parallelism

🧠 Smart: Automatically selects serial or parallel mode based on workload

🔢 Top-K optimized: Efficient inlined heap selection (no full sort overhead)

🐍 Pythonic: Easy-to-use Python API

🦀 Powered by Rust: Safe, high-performance core engine


📦 Installation

You can install SymRank with 'uv' or alternatively using 'pip'.

Recommended (with uv):

uv pip install symrank

Alternatively (using pip):

pip install symrank

🧪 Usage

Basic Example

import symrank as sr

query = [0.1, 0.2, 0.3, 0.4]  # or np.array([...], dtype=np.float32)
candidates = [
    ("doc_1", [0.1, 0.2, 0.3, 0.5]),
    ("doc_2", [0.9, 0.1, 0.2, 0.1]),
    ("doc_3", [0.0, 0.0, 0.0, 1.0]),
]

results = sr.cosine_similarity(query, candidates, k=2)
print(results)

Output

[{'id': 'doc_1', 'score': 0.9987}, {'id': 'doc_3', 'score': 0.8912}]

🧩 API: cosine_similarity(...)

cosine_similarity(
    query_vector,              # List[float] or np.ndarray
    candidate_vectors,         # List[Tuple[str, List[float] or np.ndarray]]
    k=5,                       # Number of top results to return
    batch_size=None,           # Optional: split into batches for large sets
)

'cosine_similarity(...)' Parameters

Parameter Type Default Description
query_vector List[float] or np.ndarray required Vector to search with
candidate_vectors List[Tuple[str, List[float] or np.ndarray]] required (id, vector) pairs to compare against
k int 5 Number of results to return
batch_size int or None None Optional batch size to reduce memory use

Returns

List of dictionaries with id and score (cosine similarity):

[{"id": "doc_42", "score": 0.8763}, {"id": "doc_17", "score": 0.8451}, ...]

📄 License

This project is licensed under the Apache License 2.0.

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

symrank-0.1.2.tar.gz (15.4 kB view details)

Uploaded Source

Built Distributions

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

symrank-0.1.2-cp313-cp313-win_amd64.whl (169.6 kB view details)

Uploaded CPython 3.13Windows x86-64

symrank-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl (298.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

symrank-0.1.2-cp313-cp313-macosx_11_0_arm64.whl (256.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

symrank-0.1.2-cp312-cp312-win_amd64.whl (169.6 kB view details)

Uploaded CPython 3.12Windows x86-64

symrank-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl (298.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

symrank-0.1.2-cp312-cp312-macosx_11_0_arm64.whl (255.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

symrank-0.1.2-cp311-cp311-win_amd64.whl (169.0 kB view details)

Uploaded CPython 3.11Windows x86-64

symrank-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl (300.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

symrank-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (259.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

symrank-0.1.2-cp310-cp310-win_amd64.whl (169.1 kB view details)

Uploaded CPython 3.10Windows x86-64

symrank-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl (301.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

symrank-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (259.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file symrank-0.1.2.tar.gz.

File metadata

  • Download URL: symrank-0.1.2.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7b0c7b32bd5e10f67f4d8739417a4e65db9671877535f5c8c6fd53dce15e9200
MD5 2724bc37989040c5a7c6e1abacf87b6c
BLAKE2b-256 d4b0fa317fbfd84a360a9d24d8e301d301706a5aa22c055f6e4129e806477df3

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2.tar.gz:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 169.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ee122b451c8ea68e00fb4f4918a19fbc206461da3754ae2de43d122609dcc546
MD5 0c707c7463036d0c854a31e607f82fd5
BLAKE2b-256 2098e142ecaaf36b722a0c15b1133513aa7d0b9044097930ce9c755098a19b9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp313-cp313-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d15b7831c4893daeefec8ac6ccbfff9f5ed4c38d731210fd2c2c13d16e19a4e5
MD5 a17719a8287b31b4f0f8734ea13842ff
BLAKE2b-256 77e11bebf5fc8943b4e416a6930fe58f03cd0edcf9e2a1215708ef4f784b772a

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 51b457a3e09832eb6f0855c175add9f815999e8bc0de2742ca6409bade255084
MD5 f5963bf1297b03d962654e0c53a31b99
BLAKE2b-256 67751c3568ee323604a293b49843a6d4e69a8ee668f87c82e45c279667058c90

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 169.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 538a0582d253b8aea9646668c503b6d7d7ae8783e9b7558298f0a07816bf79cb
MD5 ff02798d9eb59e323aecd357714f64d1
BLAKE2b-256 3e411b2a004b8a36ca2abe5d552fc9277c01c3c3ab1699c1492721aa34c5dccf

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp312-cp312-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 574b8903b0401ffbe333fe7d4abd867dcdbe9cf5556c4ab486544e9cec74d7d0
MD5 543c35c97b5afa9d7af520ebd5ec3756
BLAKE2b-256 fea4d438c1e8431fc34bc94ab20feb71d81727131773e7785c29e67e3f8ac196

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ea74201255f045d35287b358ca760051b00eb194eaeac88a87bcde520316cdf
MD5 0fdc34b8546e13f2e7081e52c5f186f8
BLAKE2b-256 b894b67f27b1e0729faf0fe21c9d7687f8bcd1482ef701693295b5c3b3bd8179

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 169.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 86cf1bce03d4a9fd785eee19b9f45341fb69291727045a4aee2a60d1db9b7292
MD5 6cc011d96f10dba8f112f5d47472f20c
BLAKE2b-256 b485db51db6598e8c44e2219f076ef82b40424f8dd245fa393e3bd3127809199

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp311-cp311-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1102a2ac11c6752fd117e55008dcaf9b9bfcd934e3e2e693898a83418e5d8bc4
MD5 0fd873489ff6832c272e6fd3e7ea5e97
BLAKE2b-256 ff45319f7a259de286b60b1d5d13cf4f463985ae327cf9ee295f57841db5e968

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e144308b1d60c5dd6a2512f73bfdcd31027045e56298dca88545d67193ccfc77
MD5 4c3285134dff1a772756d4a9d3873297
BLAKE2b-256 64e59dd54c778e855437007c66dc83526ff36691243a71d2b45d10afc422eb0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 169.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for symrank-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 80bb89b97c1c6bf5d49d3f3a461e9cd95762e9e4eea0016a426ff35e5588ec2b
MD5 ca0c620d386a15b56e225ae68f9af6e6
BLAKE2b-256 b7ed2d3820e3ebd86240fcf825dc2fb72982b152ea49d6523f472b5b40608e09

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp310-cp310-win_amd64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 01b3bcdea68cd49fcef009e6d13f2b62aaf0924617d5dc4ed5a1317f259ab9b3
MD5 9013fe7b4bd1ab12eb62b34763fffaa6
BLAKE2b-256 4125b0c92d2e141fc29e45b68b0a1818e59f071b255ce885e6b9c210d734c9ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file symrank-0.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 592b6d4d6b46f17764e3f881463002622fdbbcff3e8e61edb9bcf39f9d458aca
MD5 84eebf565ae23fc9928495ca69ecadb7
BLAKE2b-256 b3379aff3458d793ff2daa27401a55bdf550563cc6564c77724c7b8b05825deb

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.2-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: CI.yml on analyticsinmotion/symrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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