Skip to main content

Python SDK for TideVec — temporally-aware causal vector database

Project description

tidevec-py

Python SDK for TideVec — the world's first temporally-aware, causally-indexed vector database.

Install

pip install tidevec-py

Quick Start

from tidevec import TideVec, HalfLife

# Connect
db = TideVec("localhost:6399")

# Create a collection
db.create_collection(
    "docs",
    dim=768,
    half_life_ms=HalfLife.ONE_WEEK,   # fresh vectors rank higher
    temporal_blend=0.3,               # 30% time, 70% semantic
)

# Upsert vectors
db.upsert("docs", [
    {
        "id":        "doc_001",
        "embedding": [0.1, 0.2, ...],  # 768-dim
        "payload":   {"source": "confluence", "team": "platform"},
        "ttl_seconds": 86400,          # expire in 24 hours
    },
    {
        "id":        "doc_002",
        "embedding": [0.3, 0.4, ...],
        "payload":   {"source": "jira"},
        "edges":     [{"target_id": "doc_001", "type": "UPDATES", "weight": 0.9}],
    },
])

# Search with temporal scoring
results = db.search(
    "docs",
    query_vector=[0.1, 0.2, ...],
    top_k=10,
    temporal_blend=0.3,
    include_staleness_warnings=True,
)

for hit in results:
    print(f"{hit.id}  score={hit.score:.4f}  temporal={hit.temporal_score:.3f}")
    if hit.staleness_warning:
        print(f"  ⚠️  {hit.staleness_reason}")

# Causal expansion
results = db.search(
    "docs",
    query_vector=[0.1, 0.2, ...],
    mode="causal_expand",
    causal_hops=2,
)

# Contradiction detection
results = db.search(
    "docs",
    query_vector=[0.1, 0.2, ...],
    mode="contradiction_check",
)
for hit in results:
    if hit.contradicted_by:
        print(f"{hit.id} is contradicted by {hit.contradicted_by}")

# Batch search (GPU/TPU accelerated)
responses = db.batch_search(
    "docs",
    query_vectors=[[0.1, ...], [0.5, ...], [0.9, ...]],
    top_k=5,
    device="gpu",   # "auto" | "gpu" | "tpu" | "cpu"
)

# With trace for observability (CortexOps integration)
results = db.search("docs", query_vector=[...], include_trace=True)
print(f"latency={results.latency_ms:.1f}ms  strategy={results.strategy}")

Async

import asyncio
from tidevec import AsyncTideVec

async def main():
    async with AsyncTideVec("localhost:6399") as db:
        await db.upsert("docs", [{"id": "v1", "embedding": [...]}])
        results = await db.search("docs", query_vector=[...], top_k=5)
        for hit in results:
            print(hit.id, hit.score)

asyncio.run(main())

Context manager

with TideVec("localhost:6399", api_key="mykey") as db:
    db.create_collection("agents", dim=1536, half_life_ms=HalfLife.ONE_HOUR)
    # ... operations
# connection auto-closed

HalfLife presets

from tidevec import HalfLife

HalfLife.AGENT_SESSION  # 1 hour   — per-session agent memory
HalfLife.ONE_DAY        # 1 day    — news / feeds
HalfLife.ONE_WEEK       # 7 days   — support tickets
HalfLife.ONE_MONTH      # 30 days  — documents (default)
HalfLife.ONE_YEAR       # 365 days — long-term knowledge base

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

tidevec-0.2.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

tidevec-0.2.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file tidevec-0.2.0.tar.gz.

File metadata

  • Download URL: tidevec-0.2.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tidevec-0.2.0.tar.gz
Algorithm Hash digest
SHA256 37d03f074a71102a2da9986814c5d11ca4b2a7c53b93caafaa35defe535e620f
MD5 cbb09d82463d7aa0da67f08c088b2222
BLAKE2b-256 d8458c93ce2964e405daefa9e9e53fab179f2638f360b9cfe27cc0d774354452

See more details on using hashes here.

File details

Details for the file tidevec-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tidevec-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tidevec-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54fc1f408457f4fec141f1dd68c39a8f890f0a62234ed093a1990a86a76c860a
MD5 61204c387c5899b7c20f5a1d02bae25a
BLAKE2b-256 e0d558052b2c81e49181501f53085b1a2ea5bb4bbce64235856e4f0192a20f53

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