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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f33f1547c5978a376f582ab1b052bac08396149c70544408b5954b97399700f
|
|
| MD5 |
b5d96e408df82f6bfdb7fcb1539b5570
|
|
| BLAKE2b-256 |
00f36f6eef570abc40c9b21992e6a7572a6455b9da20553cadfe351eb5f623b6
|
Provenance
The following attestation bundles were made for sutradb-0.3.5.tar.gz:
Publisher:
publish-sdks.yml on EmmaLeonhart/SutraDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sutradb-0.3.5.tar.gz -
Subject digest:
4f33f1547c5978a376f582ab1b052bac08396149c70544408b5954b97399700f - Sigstore transparency entry: 1154116109
- Sigstore integration time:
-
Permalink:
EmmaLeonhart/SutraDB@3e253f3e415dd01beca83bab483f1d3581ab7d1c -
Branch / Tag:
refs/tags/v0.3.5 - Owner: https://github.com/EmmaLeonhart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@3e253f3e415dd01beca83bab483f1d3581ab7d1c -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c37536de1af0de0255324d138a367d506664c3e2607d3bfc59abf290e494ba7a
|
|
| MD5 |
d1654426b1fbb0ac22d8874a17a55422
|
|
| BLAKE2b-256 |
b4ce3d4b2e0911c40cdb52a02e8eadb5c3f78f5545960c4d877bf473ad003887
|
Provenance
The following attestation bundles were made for sutradb-0.3.5-py3-none-any.whl:
Publisher:
publish-sdks.yml on EmmaLeonhart/SutraDB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sutradb-0.3.5-py3-none-any.whl -
Subject digest:
c37536de1af0de0255324d138a367d506664c3e2607d3bfc59abf290e494ba7a - Sigstore transparency entry: 1154116111
- Sigstore integration time:
-
Permalink:
EmmaLeonhart/SutraDB@3e253f3e415dd01beca83bab483f1d3581ab7d1c -
Branch / Tag:
refs/tags/v0.3.5 - Owner: https://github.com/EmmaLeonhart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@3e253f3e415dd01beca83bab483f1d3581ab7d1c -
Trigger Event:
push
-
Statement type: