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
#import numpy as np

query = [0.1, 0.2, 0.3, 0.4]  
#query = np.array([0.1, 0.2, 0.3, 0.4], 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.9939991235733032}, {'id': 'doc_3', 'score': 0.7302967309951782}]

🧩 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
)

'cosine_similarity(...)' Parameters

Parameter Type Default Description
query_vector list of float OR ndarray required Vector to search with
candidate_vectors list of (str, vector) pairs OR ndarray required (id, vector) pairs to compare against
k int 5 Number of top results to return

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.4.tar.gz (15.2 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.4-cp313-cp313-win_amd64.whl (162.7 kB view details)

Uploaded CPython 3.13Windows x86-64

symrank-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl (289.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

symrank-0.1.4-cp313-cp313-macosx_11_0_arm64.whl (251.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

symrank-0.1.4-cp312-cp312-win_amd64.whl (162.7 kB view details)

Uploaded CPython 3.12Windows x86-64

symrank-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl (289.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

symrank-0.1.4-cp312-cp312-macosx_11_0_arm64.whl (251.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

symrank-0.1.4-cp311-cp311-win_amd64.whl (162.2 kB view details)

Uploaded CPython 3.11Windows x86-64

symrank-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl (291.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

symrank-0.1.4-cp311-cp311-macosx_11_0_arm64.whl (254.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

symrank-0.1.4-cp310-cp310-win_amd64.whl (162.3 kB view details)

Uploaded CPython 3.10Windows x86-64

symrank-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl (291.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

symrank-0.1.4-cp310-cp310-macosx_11_0_arm64.whl (254.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: symrank-0.1.4.tar.gz
  • Upload date:
  • Size: 15.2 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.4.tar.gz
Algorithm Hash digest
SHA256 c71315c5a79fc5e0e2b14bfdb790b682be17223e947d02befc7caddb43555ddd
MD5 9417b1ce71a31173a5f8dee84bbd04eb
BLAKE2b-256 136e0931258a3c58ff2becad6e0f3d9fa9fac3e68586020bed1647116564314c

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4.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.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 162.7 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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5b57b9ff2d0e7f740f519f874f6f3dce764ac4b6ab494d674eb7cc3f422ba9fc
MD5 d10b8405a14ae37ef2fd22fb87160914
BLAKE2b-256 92932989d16aa56466973f5fbe1c17abe53584e32f056d455382ebd771b1f971

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 335604247eab4965d0a75d84522df0a934a6d7d2f5eebe81e89179aa8e8e63c9
MD5 a04f5a937d0a96f91bec93ee57b3fa53
BLAKE2b-256 240b3aeef556a7a78addd2caa45e365ca8ae973045f0399bfc322f0dc6d5cd35

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e988f906b2223c0fe71dd9be4354e245d1fdc7e1ea23df3bcc2b28e45459dffe
MD5 ba0a2ce8024049c899bf5f93a804b4b7
BLAKE2b-256 df3338e1dee869ab448a3a6fb85c7d5e14007b05541d42a5f301fd1a530c8902

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 162.7 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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 40e882faa1ec8428f2ab69ddb7921ef435ed73606754f9aa3ccffb6f06c81ea4
MD5 9c2aadd69e4b1e984775a9e41155acab
BLAKE2b-256 ee3375c2d34780d90f847098e994777b065b54114f8095871b3a7acb3d80125d

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1f920b470fac1dd64b765dd24c6a63292c1994a58e6b2e7e7daeabc14ff0980a
MD5 9a67f8c19dc3b010730ec657544f4d17
BLAKE2b-256 7f499870c235de144292ef87fab8905c2195724eb0412b028d61c230ac9a4b40

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb0f087a87acef3cf4de47cc1abeb16f49785dd135b65db2116a9cc95c2913c9
MD5 4a76b33f4a80329305eb8b3a576ff82f
BLAKE2b-256 ca896a556e704097e40cd2281dd59cea8d35149db456e0d80df497f8a891e281

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 162.2 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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a4dccf19c8288d3308e36b78e0706ad7c99d89cf7517f837a8053a5533b223d8
MD5 ca0195c89e095cd0936b879a34e981f6
BLAKE2b-256 a4c81d455db6bd40df2392f674e4b8a7d782685414a37c46fdce357e631fd4d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4e1ffd4c0bdaf607028575c6db26ea441068751e7f80f3f65eebc33cf8f42aee
MD5 e70aad6c8ca3300f4e1e426ad0215234
BLAKE2b-256 962470de39f01fea0edb69ef0c7cf46f398814237ac8c871e7a491bf3c4e6923

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42ff7ebdd5b27d5d6d7001efbe669fa6f2975c193b53ef220148c8dcae23395b
MD5 21e22567d9f92659393ddde57e3fb21c
BLAKE2b-256 6affeb93457fd63fd31f80698bac03c2a81c6eff04530fdbc6f3c1ed434d1a8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: symrank-0.1.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 162.3 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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8d79e8792aef6fce7fafff8467b1f4f74d4b3cf996394ebfcd28a97895cdec8f
MD5 7842e7db130781e470ca406d4a45569e
BLAKE2b-256 98180456d874404c13c9b4ab0a6f7c4389fb320508575299eea77c8d905e0f30

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 99ba7f402a374c6e934ac745c4603898ea15e29278f04adbedc648fbcf362472
MD5 ed8902d02048c1d5a3fb002af61cfa1f
BLAKE2b-256 4c14fd19a2b6c107de90711a4536425ca60c0c653c845d8757a7dba9b7cc90f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symrank-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 53004dfc596a04d263098cd2aebe58d30a78991c409d14ff71ac2cb7e417a181
MD5 17eb17c97eb474eec87b52e9bdb8901e
BLAKE2b-256 ce8bb369107c5f756771b4535b913a8fa6e6af563aafc6b5a17f0cdedffe184e

See more details on using hashes here.

Provenance

The following attestation bundles were made for symrank-0.1.4-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