cuemap 0.2.0__tar.gz → 0.2.2__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.
- {cuemap-0.2.0 → cuemap-0.2.2}/LICENSE +1 -1
- cuemap-0.2.2/MANIFEST.in +8 -0
- {cuemap-0.2.0/cuemap.egg-info → cuemap-0.2.2}/PKG-INFO +64 -14
- cuemap-0.2.0/PKG-INFO → cuemap-0.2.2/README.md +43 -28
- cuemap-0.2.0/README.md → cuemap-0.2.2/cuemap.egg-info/PKG-INFO +78 -9
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap.egg-info/SOURCES.txt +5 -1
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap.egg-info/requires.txt +2 -0
- cuemap-0.2.2/examples/pure_usage.py +96 -0
- cuemap-0.2.2/examples/with_local_llm.py +85 -0
- cuemap-0.2.2/examples/with_openai.py +131 -0
- cuemap-0.2.2/pyproject.toml +48 -0
- cuemap-0.2.0/pyproject.toml +0 -28
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap/__init__.py +0 -0
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap/client.py +0 -0
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap/exceptions.py +0 -0
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap/models.py +0 -0
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap.egg-info/dependency_links.txt +0 -0
- {cuemap-0.2.0 → cuemap-0.2.2}/cuemap.egg-info/top_level.txt +0 -0
- {cuemap-0.2.0 → cuemap-0.2.2}/setup.cfg +0 -0
cuemap-0.2.2/MANIFEST.in
ADDED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cuemap
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Redis for AI Agents - High-performance temporal-associative memory
|
|
5
|
+
Author-email: CueMap Team <hello@cuemap.dev>
|
|
5
6
|
License: MIT
|
|
6
|
-
Project-URL: Homepage, https://cuemap
|
|
7
|
-
Project-URL: Documentation, https://
|
|
8
|
-
Project-URL: Repository, https://github.com/cuemap/
|
|
9
|
-
|
|
7
|
+
Project-URL: Homepage, https://github.com/cuemap-dev/sdks
|
|
8
|
+
Project-URL: Documentation, https://github.com/cuemap-dev/sdks/blob/main/python/README.md
|
|
9
|
+
Project-URL: Repository, https://github.com/cuemap-dev/sdks
|
|
10
|
+
Project-URL: Issues, https://github.com/cuemap-dev/sdks/issues
|
|
11
|
+
Project-URL: Engine, https://github.com/cuemap-dev/engine
|
|
12
|
+
Keywords: ai,memory,agents,redis,temporal,associative,llm,rag
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
10
24
|
Requires-Python: >=3.8
|
|
11
25
|
Description-Content-Type: text/markdown
|
|
12
26
|
License-File: LICENSE
|
|
@@ -15,6 +29,8 @@ Requires-Dist: pydantic>=2.0.0
|
|
|
15
29
|
Provides-Extra: dev
|
|
16
30
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
17
31
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
32
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
18
34
|
Dynamic: license-file
|
|
19
35
|
|
|
20
36
|
# CueMap: Redis for AI Agents
|
|
@@ -43,6 +59,14 @@ That's it. No ML models. No transformers. Just pure speed.
|
|
|
43
59
|
|
|
44
60
|
## Quick Start
|
|
45
61
|
|
|
62
|
+
### 1. Start the Engine
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
docker run -p 8080:8080 cuemap/engine:latest
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Use the SDK
|
|
69
|
+
|
|
46
70
|
```python
|
|
47
71
|
from cuemap import CueMap
|
|
48
72
|
|
|
@@ -112,7 +136,7 @@ results = client.recall(["food", "italian"])
|
|
|
112
136
|
# Sushi is filtered out (only matches 1 cue)
|
|
113
137
|
```
|
|
114
138
|
|
|
115
|
-
### Performance
|
|
139
|
+
### Performance (~1M memories)
|
|
116
140
|
|
|
117
141
|
- **Write P99**: 0.33ms
|
|
118
142
|
- **Read P99**: 0.37ms
|
|
@@ -193,23 +217,49 @@ client.recall(["deployment", "kubernetes"])
|
|
|
193
217
|
client.recall(["api", "users"])
|
|
194
218
|
```
|
|
195
219
|
|
|
220
|
+
## Running the Engine
|
|
221
|
+
|
|
222
|
+
CueMap requires a running engine. Choose your deployment:
|
|
223
|
+
|
|
224
|
+
### Option 1: Docker (Recommended)
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
docker run -p 8080:8080 cuemap/engine:latest
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Option 2: From Source
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
git clone https://github.com/cuemap-dev/engine
|
|
234
|
+
cd engine
|
|
235
|
+
cargo build --release
|
|
236
|
+
./target/release/cuemap-rust --port 8080
|
|
237
|
+
```
|
|
238
|
+
|
|
196
239
|
## Configuration
|
|
197
240
|
|
|
198
|
-
###
|
|
241
|
+
### Connect to Engine
|
|
199
242
|
|
|
200
243
|
```python
|
|
244
|
+
# Default (localhost)
|
|
245
|
+
client = CueMap()
|
|
246
|
+
|
|
247
|
+
# Custom URL
|
|
248
|
+
client = CueMap(url="http://your-server:8080")
|
|
249
|
+
|
|
250
|
+
# With authentication
|
|
201
251
|
client = CueMap(
|
|
202
|
-
url="
|
|
203
|
-
api_key="your-
|
|
252
|
+
url="http://your-server:8080",
|
|
253
|
+
api_key="your-secret-key"
|
|
204
254
|
)
|
|
205
255
|
```
|
|
206
256
|
|
|
207
257
|
### Multi-tenancy
|
|
208
258
|
|
|
209
259
|
```python
|
|
260
|
+
# Use project isolation
|
|
210
261
|
client = CueMap(
|
|
211
|
-
url="
|
|
212
|
-
api_key="your-api-key",
|
|
262
|
+
url="http://your-server:8080",
|
|
213
263
|
project_id="my-project"
|
|
214
264
|
)
|
|
215
265
|
```
|
|
@@ -265,9 +315,9 @@ async with AsyncCueMap() as client:
|
|
|
265
315
|
|
|
266
316
|
## Documentation
|
|
267
317
|
|
|
268
|
-
- [
|
|
269
|
-
- [
|
|
270
|
-
- [
|
|
318
|
+
- [Engine Repository](https://github.com/cuemap-dev/engine)
|
|
319
|
+
- [SDKs Repository](https://github.com/cuemap-dev/sdks)
|
|
320
|
+
- [Examples](https://github.com/cuemap-dev/sdks/tree/main/python/examples)
|
|
271
321
|
|
|
272
322
|
## License
|
|
273
323
|
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: cuemap
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Redis for AI Agents - High-performance temporal-associative memory
|
|
5
|
-
License: MIT
|
|
6
|
-
Project-URL: Homepage, https://cuemap.dev
|
|
7
|
-
Project-URL: Documentation, https://docs.cuemap.dev
|
|
8
|
-
Project-URL: Repository, https://github.com/cuemap/cuemap
|
|
9
|
-
Keywords: ai,memory,agents,redis,temporal
|
|
10
|
-
Requires-Python: >=3.8
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Requires-Dist: httpx>=0.25.0
|
|
14
|
-
Requires-Dist: pydantic>=2.0.0
|
|
15
|
-
Provides-Extra: dev
|
|
16
|
-
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
17
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
18
|
-
Dynamic: license-file
|
|
19
|
-
|
|
20
1
|
# CueMap: Redis for AI Agents
|
|
21
2
|
|
|
22
3
|
**High-performance, temporal-associative memory store.**
|
|
@@ -43,6 +24,14 @@ That's it. No ML models. No transformers. Just pure speed.
|
|
|
43
24
|
|
|
44
25
|
## Quick Start
|
|
45
26
|
|
|
27
|
+
### 1. Start the Engine
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
docker run -p 8080:8080 cuemap/engine:latest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. Use the SDK
|
|
34
|
+
|
|
46
35
|
```python
|
|
47
36
|
from cuemap import CueMap
|
|
48
37
|
|
|
@@ -112,7 +101,7 @@ results = client.recall(["food", "italian"])
|
|
|
112
101
|
# Sushi is filtered out (only matches 1 cue)
|
|
113
102
|
```
|
|
114
103
|
|
|
115
|
-
### Performance
|
|
104
|
+
### Performance (~1M memories)
|
|
116
105
|
|
|
117
106
|
- **Write P99**: 0.33ms
|
|
118
107
|
- **Read P99**: 0.37ms
|
|
@@ -193,23 +182,49 @@ client.recall(["deployment", "kubernetes"])
|
|
|
193
182
|
client.recall(["api", "users"])
|
|
194
183
|
```
|
|
195
184
|
|
|
185
|
+
## Running the Engine
|
|
186
|
+
|
|
187
|
+
CueMap requires a running engine. Choose your deployment:
|
|
188
|
+
|
|
189
|
+
### Option 1: Docker (Recommended)
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
docker run -p 8080:8080 cuemap/engine:latest
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Option 2: From Source
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
git clone https://github.com/cuemap-dev/engine
|
|
199
|
+
cd engine
|
|
200
|
+
cargo build --release
|
|
201
|
+
./target/release/cuemap-rust --port 8080
|
|
202
|
+
```
|
|
203
|
+
|
|
196
204
|
## Configuration
|
|
197
205
|
|
|
198
|
-
###
|
|
206
|
+
### Connect to Engine
|
|
199
207
|
|
|
200
208
|
```python
|
|
209
|
+
# Default (localhost)
|
|
210
|
+
client = CueMap()
|
|
211
|
+
|
|
212
|
+
# Custom URL
|
|
213
|
+
client = CueMap(url="http://your-server:8080")
|
|
214
|
+
|
|
215
|
+
# With authentication
|
|
201
216
|
client = CueMap(
|
|
202
|
-
url="
|
|
203
|
-
api_key="your-
|
|
217
|
+
url="http://your-server:8080",
|
|
218
|
+
api_key="your-secret-key"
|
|
204
219
|
)
|
|
205
220
|
```
|
|
206
221
|
|
|
207
222
|
### Multi-tenancy
|
|
208
223
|
|
|
209
224
|
```python
|
|
225
|
+
# Use project isolation
|
|
210
226
|
client = CueMap(
|
|
211
|
-
url="
|
|
212
|
-
api_key="your-api-key",
|
|
227
|
+
url="http://your-server:8080",
|
|
213
228
|
project_id="my-project"
|
|
214
229
|
)
|
|
215
230
|
```
|
|
@@ -265,9 +280,9 @@ async with AsyncCueMap() as client:
|
|
|
265
280
|
|
|
266
281
|
## Documentation
|
|
267
282
|
|
|
268
|
-
- [
|
|
269
|
-
- [
|
|
270
|
-
- [
|
|
283
|
+
- [Engine Repository](https://github.com/cuemap-dev/engine)
|
|
284
|
+
- [SDKs Repository](https://github.com/cuemap-dev/sdks)
|
|
285
|
+
- [Examples](https://github.com/cuemap-dev/sdks/tree/main/python/examples)
|
|
271
286
|
|
|
272
287
|
## License
|
|
273
288
|
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cuemap
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Redis for AI Agents - High-performance temporal-associative memory
|
|
5
|
+
Author-email: CueMap Team <hello@cuemap.dev>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/cuemap-dev/sdks
|
|
8
|
+
Project-URL: Documentation, https://github.com/cuemap-dev/sdks/blob/main/python/README.md
|
|
9
|
+
Project-URL: Repository, https://github.com/cuemap-dev/sdks
|
|
10
|
+
Project-URL: Issues, https://github.com/cuemap-dev/sdks/issues
|
|
11
|
+
Project-URL: Engine, https://github.com/cuemap-dev/engine
|
|
12
|
+
Keywords: ai,memory,agents,redis,temporal,associative,llm,rag
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: httpx>=0.25.0
|
|
28
|
+
Requires-Dist: pydantic>=2.0.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
32
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
1
36
|
# CueMap: Redis for AI Agents
|
|
2
37
|
|
|
3
38
|
**High-performance, temporal-associative memory store.**
|
|
@@ -24,6 +59,14 @@ That's it. No ML models. No transformers. Just pure speed.
|
|
|
24
59
|
|
|
25
60
|
## Quick Start
|
|
26
61
|
|
|
62
|
+
### 1. Start the Engine
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
docker run -p 8080:8080 cuemap/engine:latest
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Use the SDK
|
|
69
|
+
|
|
27
70
|
```python
|
|
28
71
|
from cuemap import CueMap
|
|
29
72
|
|
|
@@ -93,7 +136,7 @@ results = client.recall(["food", "italian"])
|
|
|
93
136
|
# Sushi is filtered out (only matches 1 cue)
|
|
94
137
|
```
|
|
95
138
|
|
|
96
|
-
### Performance
|
|
139
|
+
### Performance (~1M memories)
|
|
97
140
|
|
|
98
141
|
- **Write P99**: 0.33ms
|
|
99
142
|
- **Read P99**: 0.37ms
|
|
@@ -174,23 +217,49 @@ client.recall(["deployment", "kubernetes"])
|
|
|
174
217
|
client.recall(["api", "users"])
|
|
175
218
|
```
|
|
176
219
|
|
|
220
|
+
## Running the Engine
|
|
221
|
+
|
|
222
|
+
CueMap requires a running engine. Choose your deployment:
|
|
223
|
+
|
|
224
|
+
### Option 1: Docker (Recommended)
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
docker run -p 8080:8080 cuemap/engine:latest
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Option 2: From Source
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
git clone https://github.com/cuemap-dev/engine
|
|
234
|
+
cd engine
|
|
235
|
+
cargo build --release
|
|
236
|
+
./target/release/cuemap-rust --port 8080
|
|
237
|
+
```
|
|
238
|
+
|
|
177
239
|
## Configuration
|
|
178
240
|
|
|
179
|
-
###
|
|
241
|
+
### Connect to Engine
|
|
180
242
|
|
|
181
243
|
```python
|
|
244
|
+
# Default (localhost)
|
|
245
|
+
client = CueMap()
|
|
246
|
+
|
|
247
|
+
# Custom URL
|
|
248
|
+
client = CueMap(url="http://your-server:8080")
|
|
249
|
+
|
|
250
|
+
# With authentication
|
|
182
251
|
client = CueMap(
|
|
183
|
-
url="
|
|
184
|
-
api_key="your-
|
|
252
|
+
url="http://your-server:8080",
|
|
253
|
+
api_key="your-secret-key"
|
|
185
254
|
)
|
|
186
255
|
```
|
|
187
256
|
|
|
188
257
|
### Multi-tenancy
|
|
189
258
|
|
|
190
259
|
```python
|
|
260
|
+
# Use project isolation
|
|
191
261
|
client = CueMap(
|
|
192
|
-
url="
|
|
193
|
-
api_key="your-api-key",
|
|
262
|
+
url="http://your-server:8080",
|
|
194
263
|
project_id="my-project"
|
|
195
264
|
)
|
|
196
265
|
```
|
|
@@ -246,9 +315,9 @@ async with AsyncCueMap() as client:
|
|
|
246
315
|
|
|
247
316
|
## Documentation
|
|
248
317
|
|
|
249
|
-
- [
|
|
250
|
-
- [
|
|
251
|
-
- [
|
|
318
|
+
- [Engine Repository](https://github.com/cuemap-dev/engine)
|
|
319
|
+
- [SDKs Repository](https://github.com/cuemap-dev/sdks)
|
|
320
|
+
- [Examples](https://github.com/cuemap-dev/sdks/tree/main/python/examples)
|
|
252
321
|
|
|
253
322
|
## License
|
|
254
323
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
2
3
|
README.md
|
|
3
4
|
pyproject.toml
|
|
4
5
|
cuemap/__init__.py
|
|
@@ -9,4 +10,7 @@ cuemap.egg-info/PKG-INFO
|
|
|
9
10
|
cuemap.egg-info/SOURCES.txt
|
|
10
11
|
cuemap.egg-info/dependency_links.txt
|
|
11
12
|
cuemap.egg-info/requires.txt
|
|
12
|
-
cuemap.egg-info/top_level.txt
|
|
13
|
+
cuemap.egg-info/top_level.txt
|
|
14
|
+
examples/pure_usage.py
|
|
15
|
+
examples/with_local_llm.py
|
|
16
|
+
examples/with_openai.py
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Pure CueMap usage - no magic, just speed."""
|
|
2
|
+
|
|
3
|
+
from cuemap import CueMap
|
|
4
|
+
|
|
5
|
+
def main():
|
|
6
|
+
print("="*70)
|
|
7
|
+
print("CUEMAP: REDIS FOR AI AGENTS")
|
|
8
|
+
print("Pure, Fast, Predictable")
|
|
9
|
+
print("="*70)
|
|
10
|
+
|
|
11
|
+
client = CueMap()
|
|
12
|
+
|
|
13
|
+
# Add memories with explicit cues
|
|
14
|
+
print("\nAdding memories with explicit cues...")
|
|
15
|
+
|
|
16
|
+
client.add(
|
|
17
|
+
"I love Italian food, especially pizza and pasta",
|
|
18
|
+
cues=["food", "italian", "pizza", "pasta", "preferences"]
|
|
19
|
+
)
|
|
20
|
+
print("✓ Food memory")
|
|
21
|
+
|
|
22
|
+
client.add(
|
|
23
|
+
"My favorite color is blue, like the ocean",
|
|
24
|
+
cues=["color", "blue", "favorite", "preferences"]
|
|
25
|
+
)
|
|
26
|
+
print("✓ Color memory")
|
|
27
|
+
|
|
28
|
+
client.add(
|
|
29
|
+
"I work as a software engineer at a tech startup",
|
|
30
|
+
cues=["work", "job", "engineer", "software", "career"]
|
|
31
|
+
)
|
|
32
|
+
print("✓ Work memory")
|
|
33
|
+
|
|
34
|
+
client.add(
|
|
35
|
+
"I enjoy hiking in the mountains on weekends",
|
|
36
|
+
cues=["hobbies", "hiking", "mountains", "outdoor", "recreation"]
|
|
37
|
+
)
|
|
38
|
+
print("✓ Hobbies memory")
|
|
39
|
+
|
|
40
|
+
# Query with explicit cues
|
|
41
|
+
print("\n" + "="*70)
|
|
42
|
+
print("QUERYING WITH EXPLICIT CUES")
|
|
43
|
+
print("="*70)
|
|
44
|
+
|
|
45
|
+
queries = [
|
|
46
|
+
(["food"], "Food preferences"),
|
|
47
|
+
(["color", "favorite"], "Favorite color"),
|
|
48
|
+
(["work"], "Work information"),
|
|
49
|
+
(["hobbies"], "Hobbies")
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
for cues, description in queries:
|
|
53
|
+
print(f"\nQuery: {description}")
|
|
54
|
+
print(f"Cues: {cues}")
|
|
55
|
+
|
|
56
|
+
results = client.recall(cues, limit=1)
|
|
57
|
+
|
|
58
|
+
if results:
|
|
59
|
+
print(f"✅ {results[0].content}")
|
|
60
|
+
print(f" Score: {results[0].score:.2f}")
|
|
61
|
+
print(f" Intersection: {results[0].intersection_count}")
|
|
62
|
+
else:
|
|
63
|
+
print("❌ No results")
|
|
64
|
+
|
|
65
|
+
# Show the power of intersection
|
|
66
|
+
print("\n" + "="*70)
|
|
67
|
+
print("INTERSECTION SCORING DEMO")
|
|
68
|
+
print("="*70)
|
|
69
|
+
|
|
70
|
+
print("\nQuery with 1 cue: ['food']")
|
|
71
|
+
results = client.recall(["food"], limit=3)
|
|
72
|
+
print(f"Found {len(results)} results")
|
|
73
|
+
for r in results:
|
|
74
|
+
print(f" - {r.content[:50]}... (intersection: {r.intersection_count})")
|
|
75
|
+
|
|
76
|
+
print("\nQuery with 2 cues: ['food', 'italian']")
|
|
77
|
+
results = client.recall(["food", "italian"], limit=3)
|
|
78
|
+
print(f"Found {len(results)} results")
|
|
79
|
+
for r in results:
|
|
80
|
+
print(f" - {r.content[:50]}... (intersection: {r.intersection_count})")
|
|
81
|
+
|
|
82
|
+
# Stats
|
|
83
|
+
print("\n" + "="*70)
|
|
84
|
+
print("STATISTICS")
|
|
85
|
+
print("="*70)
|
|
86
|
+
|
|
87
|
+
stats = client.stats()
|
|
88
|
+
print(f"Total memories: {stats['total_memories']}")
|
|
89
|
+
print(f"Total cues: {stats['total_cues']}")
|
|
90
|
+
|
|
91
|
+
client.close()
|
|
92
|
+
print("\n✓ Done!")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
main()
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Recipe: Using CueMap with local LLM (Ollama/llama.cpp)."""
|
|
2
|
+
|
|
3
|
+
from cuemap import CueMap
|
|
4
|
+
|
|
5
|
+
def extract_cues_with_llm(content: str) -> list[str]:
|
|
6
|
+
"""
|
|
7
|
+
Extract cues using local LLM.
|
|
8
|
+
|
|
9
|
+
In real usage, call Ollama or llama.cpp:
|
|
10
|
+
- ollama run llama2 "Extract tags: {content}"
|
|
11
|
+
- Or use llama-cpp-python
|
|
12
|
+
"""
|
|
13
|
+
# Mock for demonstration
|
|
14
|
+
# In real usage: call your local LLM
|
|
15
|
+
|
|
16
|
+
content_lower = content.lower()
|
|
17
|
+
cues = []
|
|
18
|
+
|
|
19
|
+
# Simple extraction (replace with LLM call)
|
|
20
|
+
words = content_lower.split()
|
|
21
|
+
keywords = [w for w in words if len(w) > 4]
|
|
22
|
+
|
|
23
|
+
return keywords[:5]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def main():
|
|
27
|
+
print("="*70)
|
|
28
|
+
print("RECIPE: CUEMAP + LOCAL LLM")
|
|
29
|
+
print("="*70)
|
|
30
|
+
|
|
31
|
+
client = CueMap()
|
|
32
|
+
|
|
33
|
+
print("\nExample with Ollama:")
|
|
34
|
+
print("""
|
|
35
|
+
# Install Ollama: https://ollama.ai
|
|
36
|
+
# Run: ollama run llama2
|
|
37
|
+
|
|
38
|
+
import subprocess
|
|
39
|
+
import json
|
|
40
|
+
|
|
41
|
+
def extract_cues_ollama(content: str) -> list[str]:
|
|
42
|
+
prompt = f'''Extract 3-5 search tags from this text.
|
|
43
|
+
Return only a JSON array.
|
|
44
|
+
|
|
45
|
+
Text: {content}
|
|
46
|
+
|
|
47
|
+
Tags:'''
|
|
48
|
+
|
|
49
|
+
result = subprocess.run(
|
|
50
|
+
["ollama", "run", "llama2", prompt],
|
|
51
|
+
capture_output=True,
|
|
52
|
+
text=True
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Parse JSON response
|
|
56
|
+
tags = json.loads(result.stdout.strip())
|
|
57
|
+
return tags
|
|
58
|
+
|
|
59
|
+
# Use with CueMap
|
|
60
|
+
cues = extract_cues_ollama("I love hiking")
|
|
61
|
+
client.add("I love hiking", cues=cues)
|
|
62
|
+
""")
|
|
63
|
+
|
|
64
|
+
print("\n" + "="*70)
|
|
65
|
+
print("DEMO WITH MOCK LLM")
|
|
66
|
+
print("="*70)
|
|
67
|
+
|
|
68
|
+
# Demo with mock
|
|
69
|
+
memories = [
|
|
70
|
+
"I love Italian food, especially pizza and pasta",
|
|
71
|
+
"My favorite color is blue, like the ocean",
|
|
72
|
+
"I work as a software engineer at a tech startup"
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
for memory in memories:
|
|
76
|
+
cues = extract_cues_with_llm(memory)
|
|
77
|
+
client.add(memory, cues=cues)
|
|
78
|
+
print(f"\n✓ Added: {memory[:50]}...")
|
|
79
|
+
print(f" Cues: {cues}")
|
|
80
|
+
|
|
81
|
+
client.close()
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if __name__ == "__main__":
|
|
85
|
+
main()
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""Recipe: Using CueMap with OpenAI for auto-tagging."""
|
|
2
|
+
|
|
3
|
+
from cuemap import CueMap
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
# Mock OpenAI for demonstration
|
|
7
|
+
class MockOpenAI:
|
|
8
|
+
"""Mock OpenAI client for demonstration."""
|
|
9
|
+
|
|
10
|
+
@staticmethod
|
|
11
|
+
def extract_tags(content: str) -> list[str]:
|
|
12
|
+
"""Extract tags using 'AI' (mocked for demo)."""
|
|
13
|
+
# In real usage, this would call OpenAI API
|
|
14
|
+
# For demo, we'll use simple rules
|
|
15
|
+
|
|
16
|
+
content_lower = content.lower()
|
|
17
|
+
tags = []
|
|
18
|
+
|
|
19
|
+
# Category detection
|
|
20
|
+
if any(word in content_lower for word in ["love", "like", "enjoy", "favorite"]):
|
|
21
|
+
tags.append("preferences")
|
|
22
|
+
|
|
23
|
+
if any(word in content_lower for word in ["work", "job", "career", "engineer"]):
|
|
24
|
+
tags.append("work")
|
|
25
|
+
|
|
26
|
+
if any(word in content_lower for word in ["hobby", "hobbies", "recreation", "fun"]):
|
|
27
|
+
tags.append("hobbies")
|
|
28
|
+
|
|
29
|
+
# Extract nouns (simple approach)
|
|
30
|
+
words = content_lower.split()
|
|
31
|
+
nouns = [w for w in words if len(w) > 4 and w not in [
|
|
32
|
+
"especially", "really", "about", "would", "could", "should"
|
|
33
|
+
]]
|
|
34
|
+
|
|
35
|
+
tags.extend(nouns[:5])
|
|
36
|
+
|
|
37
|
+
return list(set(tags))[:7] # Max 7 tags
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def main():
|
|
41
|
+
print("="*70)
|
|
42
|
+
print("RECIPE: CUEMAP + OPENAI AUTO-TAGGING")
|
|
43
|
+
print("="*70)
|
|
44
|
+
|
|
45
|
+
client = CueMap()
|
|
46
|
+
openai = MockOpenAI() # Replace with real OpenAI client
|
|
47
|
+
|
|
48
|
+
# Helper function
|
|
49
|
+
def smart_add(content: str) -> str:
|
|
50
|
+
"""Add memory with AI-generated tags."""
|
|
51
|
+
# Step 1: Ask AI for tags
|
|
52
|
+
cues = openai.extract_tags(content)
|
|
53
|
+
|
|
54
|
+
print(f"\nContent: {content}")
|
|
55
|
+
print(f"AI-extracted cues: {cues}")
|
|
56
|
+
|
|
57
|
+
# Step 2: Store in CueMap
|
|
58
|
+
memory_id = client.add(content, cues=cues)
|
|
59
|
+
print(f"✓ Stored: {memory_id}")
|
|
60
|
+
|
|
61
|
+
return memory_id
|
|
62
|
+
|
|
63
|
+
# Add memories with AI tagging
|
|
64
|
+
print("\nAdding memories with AI-generated tags...")
|
|
65
|
+
|
|
66
|
+
smart_add("I love Italian food, especially pizza and pasta")
|
|
67
|
+
smart_add("My favorite color is blue, like the ocean")
|
|
68
|
+
smart_add("I work as a software engineer at a tech startup")
|
|
69
|
+
smart_add("I enjoy hiking in the mountains on weekends")
|
|
70
|
+
|
|
71
|
+
# Query
|
|
72
|
+
print("\n" + "="*70)
|
|
73
|
+
print("QUERYING")
|
|
74
|
+
print("="*70)
|
|
75
|
+
|
|
76
|
+
queries = [
|
|
77
|
+
["preferences", "italian"],
|
|
78
|
+
["work", "engineer"],
|
|
79
|
+
["hobbies", "hiking"]
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
for cues in queries:
|
|
83
|
+
print(f"\nCues: {cues}")
|
|
84
|
+
results = client.recall(cues, limit=1)
|
|
85
|
+
|
|
86
|
+
if results:
|
|
87
|
+
print(f"✅ {results[0].content}")
|
|
88
|
+
else:
|
|
89
|
+
print("❌ No results")
|
|
90
|
+
|
|
91
|
+
print("\n" + "="*70)
|
|
92
|
+
print("REAL OPENAI INTEGRATION")
|
|
93
|
+
print("="*70)
|
|
94
|
+
|
|
95
|
+
print("""
|
|
96
|
+
# Real implementation with OpenAI:
|
|
97
|
+
|
|
98
|
+
import openai
|
|
99
|
+
from cuemap import CueMap
|
|
100
|
+
|
|
101
|
+
client = CueMap()
|
|
102
|
+
|
|
103
|
+
def extract_cues_with_openai(content: str) -> list[str]:
|
|
104
|
+
response = openai.chat.completions.create(
|
|
105
|
+
model="gpt-4",
|
|
106
|
+
messages=[
|
|
107
|
+
{
|
|
108
|
+
"role": "system",
|
|
109
|
+
"content": "Extract 3-5 search tags from the text. "
|
|
110
|
+
"Return only a JSON array of strings."
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"role": "user",
|
|
114
|
+
"content": content
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
response_format={"type": "json_object"}
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return json.loads(response.choices[0].message.content)["tags"]
|
|
121
|
+
|
|
122
|
+
# Use it
|
|
123
|
+
cues = extract_cues_with_openai("I love hiking in the mountains")
|
|
124
|
+
client.add("I love hiking in the mountains", cues=cues)
|
|
125
|
+
""")
|
|
126
|
+
|
|
127
|
+
client.close()
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if __name__ == "__main__":
|
|
131
|
+
main()
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cuemap"
|
|
7
|
+
version = "0.2.2"
|
|
8
|
+
description = "Redis for AI Agents - High-performance temporal-associative memory"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
keywords = ["ai", "memory", "agents", "redis", "temporal", "associative", "llm", "rag"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "CueMap Team", email = "hello@cuemap.dev"}
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.8",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
dependencies = [
|
|
31
|
+
"httpx>=0.25.0",
|
|
32
|
+
"pydantic>=2.0.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=7.0.0",
|
|
38
|
+
"pytest-asyncio>=0.21.0",
|
|
39
|
+
"build>=1.0.0",
|
|
40
|
+
"twine>=4.0.0",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://github.com/cuemap-dev/sdks"
|
|
45
|
+
Documentation = "https://github.com/cuemap-dev/sdks/blob/main/python/README.md"
|
|
46
|
+
Repository = "https://github.com/cuemap-dev/sdks"
|
|
47
|
+
Issues = "https://github.com/cuemap-dev/sdks/issues"
|
|
48
|
+
Engine = "https://github.com/cuemap-dev/engine"
|
cuemap-0.2.0/pyproject.toml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "cuemap"
|
|
7
|
-
version = "0.2.0"
|
|
8
|
-
description = "Redis for AI Agents - High-performance temporal-associative memory"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.8"
|
|
11
|
-
license = {text = "MIT"}
|
|
12
|
-
keywords = ["ai", "memory", "agents", "redis", "temporal"]
|
|
13
|
-
|
|
14
|
-
dependencies = [
|
|
15
|
-
"httpx>=0.25.0",
|
|
16
|
-
"pydantic>=2.0.0",
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
[project.optional-dependencies]
|
|
20
|
-
dev = [
|
|
21
|
-
"pytest>=7.0.0",
|
|
22
|
-
"pytest-asyncio>=0.21.0",
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
[project.urls]
|
|
26
|
-
Homepage = "https://cuemap.dev"
|
|
27
|
-
Documentation = "https://docs.cuemap.dev"
|
|
28
|
-
Repository = "https://github.com/cuemap/cuemap"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|