Skip to main content

Python client SDK for YantrikDB — the cognitive memory database

Project description

yantrikdb-client

Python SDK for YantrikDB — a cognitive memory database with persistent typed memory, contradiction handling, and reflection.

Install

# Base (bring your own embeddings)
pip install yantrikdb-client

# Default: sentence-transformers MiniLM (384 dim). Matches the default
# YantrikDB server HNSW dim. Works on Python <= 3.12 smoothly; on Python
# 3.13 may trigger a long onnxruntime source compile via the fastembed
# dep chain.
pip install 'yantrikdb-client[embed]'

# Lightweight: model2vec static embedding (~30MB, pure numpy, no torch,
# no onnxruntime, installs in seconds on Python 3.13+). Opt-in — the
# server must be configured with a matching [embedding] dim = 256.
pip install 'yantrikdb-client[embed-tiny]'

Python 3.13 opt-in (model2vec)

If Python 3.13 makes the default [embed] install impractical, use the lightweight path:

from yantrikdb import ALT_EMBEDDER_TINY, connect
client = connect(url, token=..., embedder=ALT_EMBEDDER_TINY)

And on the server:

[embedding]
strategy = "client_only"
dim = 256   # potion-base-8M outputs 256-dim vectors

Client embedder output dim MUST match the server's HNSW dim. Otherwise remember() will return a 500 on first insert (server panics on dimension mismatch — default server dim is 384).

Quick start

from yantrikdb import connect

client = connect("http://localhost:7438", token="ydb_...")

# Basic memory
client.remember("Alice prefers dark mode", domain="preference")
results = client.recall("what does Alice prefer?")

# Character-substrate primitives (v0.2.0+)
client.remember_self("I overtrust single-source reports under time pressure")
client.remember_rule(
    condition="single-source high-stakes claim",
    action="state uncertainty and request corroboration",
)
client.remember_constraint(
    label="truthfulness_over_pleasing",
    description="Disclose uncertainty even when unwelcome",
    priority=0.95,
)

# Reflect — compose a structured meta-state view for an LLM prompt
reflection = client.reflect(
    "How should I handle this high-stakes single-source claim?",
)
print(reflection.render())

What's in 0.3.0

  • [embed-tiny] extra: model2vec static embedding backend — ~30MB, pure numpy, no torch, no onnxruntime. Works on Python 3.13+. Now the default.
  • Auto-routing: embedder name selects the backend automatically (model2vec for minishlab/... and *potion* names, sentence-transformers otherwise).

What's in 0.2.0

  • Character-substrate primitives: remember_self, remember_rule, remember_hypothesis, remember_constraint, remember_goal, remember_arc, record_signal
  • Typed recall: recall_typed(query, memory_type) for filtered retrieval
  • Reflect API: reflect(question) composes parallel type-filtered recalls + open conflicts into a Reflection with .render() for LLM prompts
  • Auto-embedder: client-side embedding via sentence-transformers.

API surface

  • connect(url, *, token, embedder=...) — returns a YantrikClient
  • YantrikClient.remember(text, ...) — store a memory
  • YantrikClient.recall(query, ...) — semantic search
  • YantrikClient.relate(entity, target, relationship) — knowledge graph edge
  • YantrikClient.think(...) — trigger consolidation / conflict scan
  • YantrikClient.reflect(question, ...) — structured meta-state view
  • Typed helpers: remember_self/rule/hypothesis/constraint/goal/arc, record_signal, recall_typed
  • YantrikClient.session(...) — context manager for cognitive sessions

License

MIT

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

yantrikdb_client-0.3.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

yantrikdb_client-0.3.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file yantrikdb_client-0.3.0.tar.gz.

File metadata

  • Download URL: yantrikdb_client-0.3.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yantrikdb_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3e740e35852aa2ce956617fe9ebc96af86b960263a4cc6f07b44001eeb653046
MD5 1c53a84f92df10ebddbf5d9a664b3eb3
BLAKE2b-256 5dab5b38bc9d98dd47db5e476d211aa2bf5003bdbc49a37a282ac4e696260190

See more details on using hashes here.

Provenance

The following attestation bundles were made for yantrikdb_client-0.3.0.tar.gz:

Publisher: publish.yml on yantrikos/yantrikdb-client

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

File details

Details for the file yantrikdb_client-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for yantrikdb_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 336556deb7933f4969000297c345c45a2c6c3c15eb0fdc8a0cc1ee049daeb7c1
MD5 45e8b96bb075839b324bb0ae797aebdd
BLAKE2b-256 0773ed493698d284eedcd1bbf5bdb747d0ad8b80054cdfb94822d0ba239db89c

See more details on using hashes here.

Provenance

The following attestation bundles were made for yantrikdb_client-0.3.0-py3-none-any.whl:

Publisher: publish.yml on yantrikos/yantrikdb-client

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