tidevec 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tidevec-0.1.0/.gitignore +60 -0
- tidevec-0.1.0/PKG-INFO +159 -0
- tidevec-0.1.0/README.md +123 -0
- tidevec-0.1.0/pyproject.toml +44 -0
- tidevec-0.1.0/tidevec/__init__.py +20 -0
- tidevec-0.1.0/tidevec/client.py +602 -0
- tidevec-0.1.0/tidevec/cortexdb_pb2.py +123 -0
- tidevec-0.1.0/tidevec/cortexdb_pb2_grpc.py +635 -0
- tidevec-0.1.0/tidevec/tidevec_pb2.py +123 -0
- tidevec-0.1.0/tidevec/tidevec_pb2_grpc.py +635 -0
tidevec-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
cd ~/tidevec
|
|
2
|
+
|
|
3
|
+
cat > .gitignore << 'EOF'
|
|
4
|
+
# Build artifacts
|
|
5
|
+
build/
|
|
6
|
+
build_check/
|
|
7
|
+
cmake-build-*/
|
|
8
|
+
*.o
|
|
9
|
+
*.obj
|
|
10
|
+
*.so
|
|
11
|
+
*.dylib
|
|
12
|
+
*.dll
|
|
13
|
+
*.a
|
|
14
|
+
*.exe
|
|
15
|
+
|
|
16
|
+
# CMake
|
|
17
|
+
CMakeCache.txt
|
|
18
|
+
CMakeFiles/
|
|
19
|
+
cmake_install.cmake
|
|
20
|
+
CTestTestfile.cmake
|
|
21
|
+
Makefile
|
|
22
|
+
*.cmake
|
|
23
|
+
!cmake/*.cmake
|
|
24
|
+
!sdk/cpp/cmake/*.cmake.in
|
|
25
|
+
|
|
26
|
+
# Python
|
|
27
|
+
__pycache__/
|
|
28
|
+
*.pyc
|
|
29
|
+
*.pyo
|
|
30
|
+
*.egg-info/
|
|
31
|
+
dist/
|
|
32
|
+
.eggs/
|
|
33
|
+
*.whl
|
|
34
|
+
|
|
35
|
+
# Go
|
|
36
|
+
sdk/go/vendor/
|
|
37
|
+
|
|
38
|
+
# Java
|
|
39
|
+
sdk/java/target/
|
|
40
|
+
*.class
|
|
41
|
+
*.jar
|
|
42
|
+
|
|
43
|
+
# Node / website
|
|
44
|
+
node_modules/
|
|
45
|
+
website/dist/
|
|
46
|
+
*.log
|
|
47
|
+
|
|
48
|
+
# IDE
|
|
49
|
+
.vscode/
|
|
50
|
+
.idea/
|
|
51
|
+
*.swp
|
|
52
|
+
|
|
53
|
+
# OS
|
|
54
|
+
.DS_Store
|
|
55
|
+
Thumbs.db
|
|
56
|
+
EOF
|
|
57
|
+
|
|
58
|
+
# Verify it landed correctly
|
|
59
|
+
cat .gitignore
|
|
60
|
+
wc -l .gitignore
|
tidevec-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tidevec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for TideVec — temporally-aware causal vector database
|
|
5
|
+
Project-URL: Homepage, https://tidevec.io
|
|
6
|
+
Project-URL: Repository, https://github.com/ashishodu2023/TideVec
|
|
7
|
+
Project-URL: Documentation, https://tidevec.io/docs
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/ashishodu2023/TideVec/issues
|
|
9
|
+
Author-email: Ashish Verma <contact@getcortexops.com>
|
|
10
|
+
License: Apache-2.0
|
|
11
|
+
Keywords: ANN,RAG,agentic-AI,embeddings,vector-database
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Database
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: grpcio-tools>=1.54.0
|
|
24
|
+
Requires-Dist: grpcio>=1.54.0
|
|
25
|
+
Requires-Dist: protobuf>=4.0.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: black; extra == 'dev'
|
|
28
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
31
|
+
Provides-Extra: numpy
|
|
32
|
+
Requires-Dist: numpy>=1.24; extra == 'numpy'
|
|
33
|
+
Provides-Extra: pandas
|
|
34
|
+
Requires-Dist: pandas>=2.0; extra == 'pandas'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# tidevec-py
|
|
38
|
+
|
|
39
|
+
Python SDK for [TideVec](https://github.com/ashishodu2023/TideVec) — the world's first temporally-aware, causally-indexed vector database.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install tidevec-py
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from tidevec import TideVec, HalfLife
|
|
51
|
+
|
|
52
|
+
# Connect
|
|
53
|
+
db = TideVec("localhost:6399")
|
|
54
|
+
|
|
55
|
+
# Create a collection
|
|
56
|
+
db.create_collection(
|
|
57
|
+
"docs",
|
|
58
|
+
dim=768,
|
|
59
|
+
half_life_ms=HalfLife.ONE_WEEK, # fresh vectors rank higher
|
|
60
|
+
temporal_blend=0.3, # 30% time, 70% semantic
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Upsert vectors
|
|
64
|
+
db.upsert("docs", [
|
|
65
|
+
{
|
|
66
|
+
"id": "doc_001",
|
|
67
|
+
"embedding": [0.1, 0.2, ...], # 768-dim
|
|
68
|
+
"payload": {"source": "confluence", "team": "platform"},
|
|
69
|
+
"ttl_seconds": 86400, # expire in 24 hours
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "doc_002",
|
|
73
|
+
"embedding": [0.3, 0.4, ...],
|
|
74
|
+
"payload": {"source": "jira"},
|
|
75
|
+
"edges": [{"target_id": "doc_001", "type": "UPDATES", "weight": 0.9}],
|
|
76
|
+
},
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
# Search with temporal scoring
|
|
80
|
+
results = db.search(
|
|
81
|
+
"docs",
|
|
82
|
+
query_vector=[0.1, 0.2, ...],
|
|
83
|
+
top_k=10,
|
|
84
|
+
temporal_blend=0.3,
|
|
85
|
+
include_staleness_warnings=True,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
for hit in results:
|
|
89
|
+
print(f"{hit.id} score={hit.score:.4f} temporal={hit.temporal_score:.3f}")
|
|
90
|
+
if hit.staleness_warning:
|
|
91
|
+
print(f" ⚠️ {hit.staleness_reason}")
|
|
92
|
+
|
|
93
|
+
# Causal expansion
|
|
94
|
+
results = db.search(
|
|
95
|
+
"docs",
|
|
96
|
+
query_vector=[0.1, 0.2, ...],
|
|
97
|
+
mode="causal_expand",
|
|
98
|
+
causal_hops=2,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Contradiction detection
|
|
102
|
+
results = db.search(
|
|
103
|
+
"docs",
|
|
104
|
+
query_vector=[0.1, 0.2, ...],
|
|
105
|
+
mode="contradiction_check",
|
|
106
|
+
)
|
|
107
|
+
for hit in results:
|
|
108
|
+
if hit.contradicted_by:
|
|
109
|
+
print(f"{hit.id} is contradicted by {hit.contradicted_by}")
|
|
110
|
+
|
|
111
|
+
# Batch search (GPU/TPU accelerated)
|
|
112
|
+
responses = db.batch_search(
|
|
113
|
+
"docs",
|
|
114
|
+
query_vectors=[[0.1, ...], [0.5, ...], [0.9, ...]],
|
|
115
|
+
top_k=5,
|
|
116
|
+
device="gpu", # "auto" | "gpu" | "tpu" | "cpu"
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# With trace for observability (CortexOps integration)
|
|
120
|
+
results = db.search("docs", query_vector=[...], include_trace=True)
|
|
121
|
+
print(f"latency={results.latency_ms:.1f}ms strategy={results.strategy}")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Async
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
import asyncio
|
|
128
|
+
from tidevec import AsyncTideVec
|
|
129
|
+
|
|
130
|
+
async def main():
|
|
131
|
+
async with AsyncTideVec("localhost:6399") as db:
|
|
132
|
+
await db.upsert("docs", [{"id": "v1", "embedding": [...]}])
|
|
133
|
+
results = await db.search("docs", query_vector=[...], top_k=5)
|
|
134
|
+
for hit in results:
|
|
135
|
+
print(hit.id, hit.score)
|
|
136
|
+
|
|
137
|
+
asyncio.run(main())
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Context manager
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
with TideVec("localhost:6399", api_key="mykey") as db:
|
|
144
|
+
db.create_collection("agents", dim=1536, half_life_ms=HalfLife.ONE_HOUR)
|
|
145
|
+
# ... operations
|
|
146
|
+
# connection auto-closed
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## HalfLife presets
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from tidevec import HalfLife
|
|
153
|
+
|
|
154
|
+
HalfLife.AGENT_SESSION # 1 hour — per-session agent memory
|
|
155
|
+
HalfLife.ONE_DAY # 1 day — news / feeds
|
|
156
|
+
HalfLife.ONE_WEEK # 7 days — support tickets
|
|
157
|
+
HalfLife.ONE_MONTH # 30 days — documents (default)
|
|
158
|
+
HalfLife.ONE_YEAR # 365 days — long-term knowledge base
|
|
159
|
+
```
|
tidevec-0.1.0/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# tidevec-py
|
|
2
|
+
|
|
3
|
+
Python SDK for [TideVec](https://github.com/ashishodu2023/TideVec) — the world's first temporally-aware, causally-indexed vector database.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install tidevec-py
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from tidevec import TideVec, HalfLife
|
|
15
|
+
|
|
16
|
+
# Connect
|
|
17
|
+
db = TideVec("localhost:6399")
|
|
18
|
+
|
|
19
|
+
# Create a collection
|
|
20
|
+
db.create_collection(
|
|
21
|
+
"docs",
|
|
22
|
+
dim=768,
|
|
23
|
+
half_life_ms=HalfLife.ONE_WEEK, # fresh vectors rank higher
|
|
24
|
+
temporal_blend=0.3, # 30% time, 70% semantic
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Upsert vectors
|
|
28
|
+
db.upsert("docs", [
|
|
29
|
+
{
|
|
30
|
+
"id": "doc_001",
|
|
31
|
+
"embedding": [0.1, 0.2, ...], # 768-dim
|
|
32
|
+
"payload": {"source": "confluence", "team": "platform"},
|
|
33
|
+
"ttl_seconds": 86400, # expire in 24 hours
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "doc_002",
|
|
37
|
+
"embedding": [0.3, 0.4, ...],
|
|
38
|
+
"payload": {"source": "jira"},
|
|
39
|
+
"edges": [{"target_id": "doc_001", "type": "UPDATES", "weight": 0.9}],
|
|
40
|
+
},
|
|
41
|
+
])
|
|
42
|
+
|
|
43
|
+
# Search with temporal scoring
|
|
44
|
+
results = db.search(
|
|
45
|
+
"docs",
|
|
46
|
+
query_vector=[0.1, 0.2, ...],
|
|
47
|
+
top_k=10,
|
|
48
|
+
temporal_blend=0.3,
|
|
49
|
+
include_staleness_warnings=True,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
for hit in results:
|
|
53
|
+
print(f"{hit.id} score={hit.score:.4f} temporal={hit.temporal_score:.3f}")
|
|
54
|
+
if hit.staleness_warning:
|
|
55
|
+
print(f" ⚠️ {hit.staleness_reason}")
|
|
56
|
+
|
|
57
|
+
# Causal expansion
|
|
58
|
+
results = db.search(
|
|
59
|
+
"docs",
|
|
60
|
+
query_vector=[0.1, 0.2, ...],
|
|
61
|
+
mode="causal_expand",
|
|
62
|
+
causal_hops=2,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Contradiction detection
|
|
66
|
+
results = db.search(
|
|
67
|
+
"docs",
|
|
68
|
+
query_vector=[0.1, 0.2, ...],
|
|
69
|
+
mode="contradiction_check",
|
|
70
|
+
)
|
|
71
|
+
for hit in results:
|
|
72
|
+
if hit.contradicted_by:
|
|
73
|
+
print(f"{hit.id} is contradicted by {hit.contradicted_by}")
|
|
74
|
+
|
|
75
|
+
# Batch search (GPU/TPU accelerated)
|
|
76
|
+
responses = db.batch_search(
|
|
77
|
+
"docs",
|
|
78
|
+
query_vectors=[[0.1, ...], [0.5, ...], [0.9, ...]],
|
|
79
|
+
top_k=5,
|
|
80
|
+
device="gpu", # "auto" | "gpu" | "tpu" | "cpu"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# With trace for observability (CortexOps integration)
|
|
84
|
+
results = db.search("docs", query_vector=[...], include_trace=True)
|
|
85
|
+
print(f"latency={results.latency_ms:.1f}ms strategy={results.strategy}")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Async
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import asyncio
|
|
92
|
+
from tidevec import AsyncTideVec
|
|
93
|
+
|
|
94
|
+
async def main():
|
|
95
|
+
async with AsyncTideVec("localhost:6399") as db:
|
|
96
|
+
await db.upsert("docs", [{"id": "v1", "embedding": [...]}])
|
|
97
|
+
results = await db.search("docs", query_vector=[...], top_k=5)
|
|
98
|
+
for hit in results:
|
|
99
|
+
print(hit.id, hit.score)
|
|
100
|
+
|
|
101
|
+
asyncio.run(main())
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Context manager
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
with TideVec("localhost:6399", api_key="mykey") as db:
|
|
108
|
+
db.create_collection("agents", dim=1536, half_life_ms=HalfLife.ONE_HOUR)
|
|
109
|
+
# ... operations
|
|
110
|
+
# connection auto-closed
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## HalfLife presets
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from tidevec import HalfLife
|
|
117
|
+
|
|
118
|
+
HalfLife.AGENT_SESSION # 1 hour — per-session agent memory
|
|
119
|
+
HalfLife.ONE_DAY # 1 day — news / feeds
|
|
120
|
+
HalfLife.ONE_WEEK # 7 days — support tickets
|
|
121
|
+
HalfLife.ONE_MONTH # 30 days — documents (default)
|
|
122
|
+
HalfLife.ONE_YEAR # 365 days — long-term knowledge base
|
|
123
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tidevec"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for TideVec — temporally-aware causal vector database"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "Apache-2.0" }
|
|
11
|
+
authors = [{ name = "Ashish Verma", email = "contact@getcortexops.com" }]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
keywords = ["vector-database", "embeddings", "ANN", "RAG", "agentic-AI"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.9",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Database",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"grpcio>=1.54.0",
|
|
28
|
+
"grpcio-tools>=1.54.0",
|
|
29
|
+
"protobuf>=4.0.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
numpy = ["numpy>=1.24"]
|
|
34
|
+
pandas = ["pandas>=2.0"]
|
|
35
|
+
dev = ["pytest>=7", "pytest-asyncio", "black", "mypy"]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://tidevec.io"
|
|
39
|
+
Repository = "https://github.com/ashishodu2023/TideVec"
|
|
40
|
+
Documentation = "https://tidevec.io/docs"
|
|
41
|
+
"Bug Tracker" = "https://github.com/ashishodu2023/TideVec/issues"
|
|
42
|
+
|
|
43
|
+
[tool.hatch.build.targets.wheel]
|
|
44
|
+
packages = ["tidevec"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""TideVec Python SDK — Temporally-aware causal vector database."""
|
|
2
|
+
|
|
3
|
+
from .client import (
|
|
4
|
+
TideVec,
|
|
5
|
+
AsyncTideVec,
|
|
6
|
+
SearchHit,
|
|
7
|
+
SearchResponse,
|
|
8
|
+
CollectionInfo,
|
|
9
|
+
HalfLife,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0"
|
|
13
|
+
__all__ = [
|
|
14
|
+
"TideVec",
|
|
15
|
+
"AsyncTideVec",
|
|
16
|
+
"SearchHit",
|
|
17
|
+
"SearchResponse",
|
|
18
|
+
"CollectionInfo",
|
|
19
|
+
"HalfLife",
|
|
20
|
+
]
|