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.1.0.tar.gz (18.1 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.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tidevec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af0a81c01f09e1e3153c100e810b68711485d79e0d8edfd8efefe099d95cd751
MD5 5c9d0daa3b1bfd3f5da8ad049835ba51
BLAKE2b-256 0ff2b367860b3edadd8877e7ad64ad5e75c16ae72477151c099229061ac1f8b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tidevec-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a6387d3cbd2d723213bf37d8456032d22729143cfe2f8a774ac590b710105be
MD5 4fb73473f73b6259cb39d8d9ecb92b95
BLAKE2b-256 a4962a81a8dad99a2643f84364b42acede6aa0b4e754014b78b0befe9da19d67

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