Skip to main content

Shared utilities for VelesDB Python integrations (internal use)

Project description

velesdb-common

Shared utilities for VelesDB Python integrations.

This package is not a public API. End users should install and import from langchain-velesdb, llama-index-vector-stores-velesdb, or haystack-velesdb directly.

What it provides

velesdb-common centralizes code shared by all three Python RAG framework integration packages:

  • Security validators — input sanitization for collection names, dimensions, queries, URLs
  • ID generation — deterministic hashing and sequential ID counters
  • Graph helpers — REST payload builders and native graph bindings
  • Memory formatting — procedural memory result formatting

Public Exports

The following symbols form the stable internal API consumed by langchain-velesdb, llama-index-vector-stores-velesdb, and haystack-velesdb. They are not intended for direct use by end users.

Fusion

Export Type Description
build_fusion_strategy function Converts a strategy name + params dict into the native FusionStrategy object

Shared mixins / bases

Export Type Description
CollectionAdminMixin class Mixin providing shared admin operations (flush, get_collection_info, is_empty)
GraphOpsBase class Base class for graph query helpers used by both integrations

ID helpers

Export Type Description
stable_hash_id function Deterministic 64-bit hash of an input string (used as collection-stable ID)
make_initial_id_counter function Builds a thread-safe sequential ID counter seeded from existing collection state

Memory helpers

Export Type Description
format_procedural_results function Normalizes raw procedural-memory recall output into a stable result list
store_procedure function Inserts a procedural-memory entry with the canonical schema used by both integrations

Security: validators

Export Type Description
SecurityError exception Raised by every validate_* on rejected input
validate_url function Validates a server URL string
validate_text function Sanitizes free-text query strings against injection patterns
validate_query function Validates VelesQL query strings against length / character limits
validate_collection_name function Alphanumeric + underscore, ≤ 64 chars
validate_dimension function Within MIN_DIMENSION..=MAX_DIMENSION
validate_metric function Against ALLOWED_METRICS
validate_storage_mode function Against ALLOWED_STORAGE_MODES / STORAGE_MODE_ALIASES
validate_path function Filesystem path bounds + character rules
validate_k function k value in [1, MAX_K_VALUE]
validate_batch_size function Batch size in [1, MAX_BATCH_SIZE]
validate_timeout function Timeout ms within sane bounds
validate_weight function Fusion weight in [0.0, 1.0]
validate_sparse_vector function Sparse pair list bounds

Security: constants

Export Type Description
ALLOWED_METRICS set Canonical metric strings (cosine, euclidean, dot, …)
ALLOWED_STORAGE_MODES set Canonical storage modes (full, sq8, binary, pq, rabitq)
STORAGE_MODE_ALIASES dict Alias → canonical mapping (e.g. int8sq8)
DEFAULT_TIMEOUT_MS int Default timeout used when callers don't specify one
MIN_DIMENSION / MAX_DIMENSION int Vector dimension bounds
MAX_BATCH_SIZE int Hard cap on per-call batch operations
MAX_K_VALUE int Hard cap on retrieval k
MAX_PATH_LENGTH int Filesystem path length cap
MAX_QUERY_LENGTH int VelesQL query length cap
MAX_SPARSE_VECTOR_SIZE int Sparse vector non-zero entry cap
MAX_TEXT_LENGTH int Free-text query length cap

Graph helpers

Export Type Description
build_graph_rest_payload function Constructs the JSON body for REST-backed graph traversal calls
parse_graph_traverse_response function Decodes a graph traversal REST response into the shared result shape
open_native_graph function Opens (or attaches to) a native-backend graph collection
is_timeout_exception function Cross-backend timeout-error predicate

License

MIT License (this integration). See LICENSE for details.

VelesDB Core itself is licensed under the VelesDB Core License 1.0 (based on ELv2).

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

velesdb_common-2.0.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

velesdb_common-2.0.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file velesdb_common-2.0.0.tar.gz.

File metadata

  • Download URL: velesdb_common-2.0.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for velesdb_common-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e9e98866cbf55bc43cff10b5389c4966ea87cf845f78d4df07d7971a11c7943a
MD5 922a363ac1a9df896e9a036ed71b427f
BLAKE2b-256 77cf7d5beac920464a021fbc399a276939c3c93e11896391fb1772ef1e89def5

See more details on using hashes here.

File details

Details for the file velesdb_common-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: velesdb_common-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for velesdb_common-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16f8bf7008f87b93d22d2fcddc921ff5a1b2f5bb1fdecd040d3e753aaaf161d0
MD5 fa79f2d299333d6dadd592a0d9a2c159
BLAKE2b-256 84caad674bbff527ac3a93cdc9e5db03ce5c5872dff9d15c6e0477885234f677

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