Skip to main content

Victor Native Extensions

High-performance Rust implementations of CPU-intensive operations for the Victor agentic AI framework.

Features

  • Deduplication (dedup): Rolling hash-based content deduplication using xxHash3
  • Similarity (similarity): SIMD-optimized cosine similarity for embeddings
  • JSON Repair (json_repair): Fast JSON repair with streaming parser
  • Hashing (hashing): High-performance signature hashing for loop detection

Performance

Operation Python Rust Speedup
Block deduplication 1.0ms 0.02ms ~50x
Cosine similarity (384d, 100 vectors) 5.0ms 1.0ms ~5x
JSON repair 0.5ms 0.05ms ~10x
Signature hashing 0.2ms 0.02ms ~10x

Building

Prerequisites

  • Rust 1.70+ (install via rustup)
  • Python 3.10+
  • maturin (pip install maturin)

Development Build

cd rust

# Build and install in development mode
maturin develop

# Build with optimizations
maturin develop --release

# Build wheel for distribution
maturin build --release

Install Pre-built Wheel

# From the rust directory after building
pip install target/wheels/victor_native-*.whl

Usage

The native extensions are automatically used when available:

from victor.processing.native import (
    rolling_hash_blocks,
    batch_cosine_similarity,
    repair_json,
    compute_signature,
    is_native_available,
)

# Check if native extensions are loaded
print(f"Native available: {is_native_available()}")

# Deduplication
blocks = rolling_hash_blocks(content, min_block_length=50)
for hash_str, block, is_duplicate in blocks:
    if is_duplicate:
        print(f"Duplicate block: {block[:50]}...")

# Similarity
query = [0.1, 0.2, ...]  # 384-dim embedding
corpus = [[...], [...], ...]  # List of embeddings
similarities = batch_cosine_similarity(query, corpus)

# JSON repair
fixed = repair_json("{'key': 'value', 'active': True}")
# '{"key": "value", "active": true}'

# Signature hashing
sig = compute_signature("read_file", {"path": "/test.py"})

Fallback Behavior

If the native extension is not available (not installed or incompatible platform), the victor.processing.native module automatically falls back to pure Python implementations with equivalent functionality.

from victor.processing.native import is_native_available

if is_native_available():
    print("Using Rust implementation (fast)")
else:
    print("Using Python fallback (compatible)")

Architecture

rust/
├── Cargo.toml          # Rust package configuration
├── pyproject.toml      # maturin build configuration
├── README.md           # This file
└── src/
    ├── lib.rs          # PyO3 module definition
    ├── dedup.rs        # Deduplication module
    ├── similarity.rs   # Cosine similarity module
    ├── json_repair.rs  # JSON repair module
    └── hashing.rs      # Signature hashing module

Testing

# Run Rust tests
cargo test

# Run Python integration tests
pytest ../tests/unit/test_native.py -v

License

Apache License 2.0

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

victor_native-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

victor_native-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

victor_native-0.8.0-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86-64

victor_native-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

victor_native-0.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

victor_native-0.8.0-cp312-cp312-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

victor_native-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

victor_native-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

victor_native-0.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

File details

Details for the file victor_native-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4069109b6e015f06f725b5260b48c4645887b76e84d4ab14e596ced116940db1
MD5 abec3905ab6551ee9a8de1be5bd250e0
BLAKE2b-256 3a44dd23f2f1a13fd5cfc403bfe05f41aa3b5692a74bd27da13eaeb74d3d4b32

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7cd4cde9dc4291140ba64f47664ebf56f23b3516291b639c87a06b1291f1a1ae
MD5 00e94a5faaa7064543a2c5bab94f9139
BLAKE2b-256 275c8ddcaa5b3aba801e4d957a50c501e2032e89b1a9187814d706638afe6316

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 41fcd36616175a8e5de2a39ac6029b7c6e899a1201c851dce4aae28689116312
MD5 f84aba35421d48b636889f46cf0504f8
BLAKE2b-256 175788eb944a2f77a1ab698aa85b45a9948e66ce028cf55d0c5f1d862e91606b

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a1c9b9084f6116582b5865c3638a0cee5086d645365e404225331c58fe4494a
MD5 97549fd0a2f15937f5fed8ea6b10f87e
BLAKE2b-256 6563382ccbb2cccbc8fc0624a02a25566df83260c927c0351d8ca6e17097de2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9bb7e3dcd462a4c52bb411f833ea165771a63747379ec14cb8ddf057360f761e
MD5 a29a0c9a709d44619edd382ca730ca55
BLAKE2b-256 79c85b70d3f9d6423133098352a6257ff87e1095452c30d9dd26fc4e7d39ffcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cbc9e82c522650e74565a3bf855320fce1c76099fecdf16bd209a66aeb39de10
MD5 4b51536808084f8d63d87e4a358105e3
BLAKE2b-256 a5de24c33bb88dd2b1927d2179d5e5672fa607e09605033a85af917acca58533

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 780ed140f8886b2011909555e729129bb6f5facb1c894ad324752ced9da97282
MD5 ec31e5cd752c21d6dcb23b232b2785c7
BLAKE2b-256 d384be5b30de8fbc13bc8f0f05a5cb1893fe4ff308d1e28d8a271b6d402f7c5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 690bccb84c6a6011ba982235d46941446b24e6f434d1b05f7224ec93c6746463
MD5 c8b589e71d6e70eec7848e9920510afd
BLAKE2b-256 76f4c5b49c493eada2baee7685354e72f17d25f881168e926fb7cceb30bd269e

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on anvai-labs/victor

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

File details

Details for the file victor_native-0.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for victor_native-0.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 106cc3b9942a3084d0eb1e704f1eff7c122ea500f23083651646605c79cb96c6
MD5 e8c8c39fc9f1a575da6765aea0050351
BLAKE2b-256 5f44f1e8129ff31b77d8dd86d909ee200b101acd7ebf608c018ab67d6f1fe4a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for victor_native-0.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on anvai-labs/victor

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 Sentry Error logging StatusPage Status page