Skip to main content

Python client for SutraDB — RDF-star triplestore with native vector indexing

Project description

sutradb

Python client for SutraDB — an RDF-star triplestore with native HNSW vector indexing.

Installation

pip install sutradb

Quick Start

from sutradb import SutraClient

client = SutraClient("http://localhost:3030")

# Check server health
if client.health():
    print("SutraDB is running")

# Run a SPARQL query
results = client.sparql("""
    SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10
""")
for binding in results["results"]["bindings"]:
    print(binding["s"]["value"], binding["p"]["value"], binding["o"]["value"])

# Insert triples
client.insert_triples("""
    <http://example.org/paper/1> <http://example.org/title> "Attention Is All You Need" .
    <http://example.org/paper/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Paper> .
""")

# Declare a vector predicate
client.declare_vector(
    predicate="http://example.org/hasEmbedding",
    dimensions=1536,
)

# Insert a vector
client.insert_vector(
    predicate="http://example.org/hasEmbedding",
    subject="http://example.org/paper/1",
    vector=[0.23, -0.11, 0.87, ...],  # 1536-dimensional vector
)

# Batch insert vectors
entries = [
    ("http://example.org/paper/1", [0.23, -0.11, ...]),
    ("http://example.org/paper/2", [0.45, 0.02, ...]),
]
result = client.insert_vectors_batch("http://example.org/hasEmbedding", entries)
print(f"Inserted {result['inserted']} vectors")

License

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

sutradb-0.3.5.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

sutradb-0.3.5-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file sutradb-0.3.5.tar.gz.

File metadata

  • Download URL: sutradb-0.3.5.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sutradb-0.3.5.tar.gz
Algorithm Hash digest
SHA256 4f33f1547c5978a376f582ab1b052bac08396149c70544408b5954b97399700f
MD5 b5d96e408df82f6bfdb7fcb1539b5570
BLAKE2b-256 00f36f6eef570abc40c9b21992e6a7572a6455b9da20553cadfe351eb5f623b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for sutradb-0.3.5.tar.gz:

Publisher: publish-sdks.yml on EmmaLeonhart/SutraDB

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

File details

Details for the file sutradb-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: sutradb-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sutradb-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c37536de1af0de0255324d138a367d506664c3e2607d3bfc59abf290e494ba7a
MD5 d1654426b1fbb0ac22d8874a17a55422
BLAKE2b-256 b4ce3d4b2e0911c40cdb52a02e8eadb5c3f78f5545960c4d877bf473ad003887

See more details on using hashes here.

Provenance

The following attestation bundles were made for sutradb-0.3.5-py3-none-any.whl:

Publisher: publish-sdks.yml on EmmaLeonhart/SutraDB

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