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[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

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

Uploaded CPython 3.13Windows x86-64

symrank-0.1.3-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.3-cp313-cp313-macosx_11_0_arm64.whl (251.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

symrank-0.1.3-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.3-cp312-cp312-macosx_11_0_arm64.whl (251.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

symrank-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl (291.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

symrank-0.1.3-cp311-cp311-macosx_11_0_arm64.whl (254.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

symrank-0.1.3-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.3-cp310-cp310-macosx_11_0_arm64.whl (253.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: symrank-0.1.3.tar.gz
  • Upload date:
  • Size: 15.1 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.3.tar.gz
Algorithm Hash digest
SHA256 ae13e888f0a134de83b08071e9c163f242e4e5b57aebbdac5da9d29c82aa4ed8
MD5 e64315101a9269c9290ca8146211fc19
BLAKE2b-256 28bae99df31620ff6946313b273d2f5fad1fce6fa6d241b52a8c8b29af0e76bc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: symrank-0.1.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ea6f22a600c9af4a9dfb0afc26a2b5da7f3c1cc966fa0950234f62c8d2bce4c8
MD5 72b151f60f2a48ee1bc08b6928a3b881
BLAKE2b-256 eea69cc446b436b48842b5af61aa38fa5e8497e449204ac961f52429b1acf343

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a407f78b8c0ca846d23df4507a9670d473bc7369fec2f26dbb68005dc49e4bda
MD5 9daa97a09ae4aef578d32b660af1335d
BLAKE2b-256 16056d0e47f087f487f23dc27305944dac100e965b7749287e58f1d8879dbf07

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d62814ecc9e62c2fb3fd0a363606202f064ef0a20dc17945fc98589688e9115a
MD5 ea6d6b5feebf96e63f46885f19d50dca
BLAKE2b-256 9e760547381b8d56cc2623431f6f38fe0e867c87b17a38354d2469d586961d15

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: symrank-0.1.3-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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9e45c0d9fc07303a576257bbe7f4879843af6b796f729d16ab15de030a3168d1
MD5 9e2aa09f980d661218fb55fea1769de7
BLAKE2b-256 94eeb3e097579f36f79b69dc72decbe7e0aa08f2cc81d1f6f47eec2ec16cce69

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 494e82405a48ac7cec463b93de230297867076d7a987f0ddef48e9aaa8c2460a
MD5 9b5d68944ac2c268bde948d5506e859e
BLAKE2b-256 24a5ad7a52aba82e925f01a8f81a8e6f8b132fb59dee5f140eb4b2fdb3eb948f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a60384d5031795d882194513268072aaf39c672a499d47ed1f9a0154038c7119
MD5 2a8a9fe52067f8392bcd85480c293949
BLAKE2b-256 d55df9dede043f9720d649dffbf2594c88535993ee242769485473fc6d1ab5bb

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: symrank-0.1.3-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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 294d0cfd79c707018ab914e144e5cf6ba7fae06cb0fb45c3975ae33d85ff9a39
MD5 fcb03a5d8216867d1d965eebf7dadf82
BLAKE2b-256 2f4e1bfd111755df82386bb7897aea55e646111bb826856123fe4cb74f8b7792

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 27c24505084a07b04cc1f7178b5dc3a862fb84a66a76e8cd85e3151dabefbbc4
MD5 acb81c0fa0a50b3d98ad2ebeb430dc29
BLAKE2b-256 95b7d0490e9060137f1dc1134b09bae3bb63b90df95943b8e650cfc2edc325d6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ccb07dd0f4dd4c46b8b8762cd85d3e2a734a55fca9f7aba3aa6e0bf91779db4
MD5 d463f358fe66bff9ef7e8f0103cf013f
BLAKE2b-256 102857409f28dc4f8ba537a39d124866f6f16ce4d7fd3c0010916baf6ee684ba

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: symrank-0.1.3-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.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 99ae939699592e0172033a68d976e48ce3c4db96e63b1bfe251310186a338968
MD5 61ab49e462a50a0614ed3fdbc04fd23d
BLAKE2b-256 2d68d06f5f9cc7635ff433c2aa236a8ba97190546edfe964f45cbacfda36db33

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d9cfb93de97c9a8e85eaebe36d9169d81cc6f57203a25a9417ebcc69a7d916f9
MD5 8ef738b980dbfcf7ed8965b3306f1914
BLAKE2b-256 85905eca1b6b72588747a41ce30d9f15ebe45f53cefc65f0b4d5816c94d0fa6e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for symrank-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc869e212df28923a9c5c4d3011348078b8b984427da118adcd1752063a86abf
MD5 b3a70fb378e571c17a718773154acfa7
BLAKE2b-256 038b026aae4fc1450b02fb5c47e5bd3b181b022330c5037fb1058072ce9b55b3

See more details on using hashes here.

Provenance

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