limbicdb 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.
- limbicdb-0.1.0/PKG-INFO +90 -0
- limbicdb-0.1.0/README.md +69 -0
- limbicdb-0.1.0/limbicdb/__init__.py +9 -0
- limbicdb-0.1.0/limbicdb/memory.py +164 -0
- limbicdb-0.1.0/limbicdb.egg-info/PKG-INFO +90 -0
- limbicdb-0.1.0/limbicdb.egg-info/SOURCES.txt +8 -0
- limbicdb-0.1.0/limbicdb.egg-info/dependency_links.txt +1 -0
- limbicdb-0.1.0/limbicdb.egg-info/top_level.txt +1 -0
- limbicdb-0.1.0/pyproject.toml +33 -0
- limbicdb-0.1.0/setup.cfg +4 -0
limbicdb-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: limbicdb
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Debuggable memory layer for AI agents
|
|
5
|
+
Author-email: Kousoyu <770668004@qq.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Kousoyu/limbicdb
|
|
8
|
+
Project-URL: Repository, https://github.com/Kousoyu/limbicdb
|
|
9
|
+
Project-URL: Documentation, https://github.com/Kousoyu/limbicdb
|
|
10
|
+
Keywords: ai,memory,debuggable,agents,llm
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# LimbicDB Python SDK
|
|
23
|
+
|
|
24
|
+
Debuggable memory layer for AI agents
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install limbicdb
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **Note**: This package requires [LimbicDB](https://github.com/Kousoyu/limbicdb) to be installed locally.
|
|
33
|
+
> The Python SDK is a thin wrapper around the LimbicDB CLI.
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from limbicdb import Memory
|
|
39
|
+
|
|
40
|
+
# Initialize memory with default path
|
|
41
|
+
memory = Memory()
|
|
42
|
+
|
|
43
|
+
# Explain memory retrieval decisions
|
|
44
|
+
explanation = memory.explain("anime")
|
|
45
|
+
print(explanation)
|
|
46
|
+
|
|
47
|
+
# Check for conflicts
|
|
48
|
+
if explanation["conflicts"]:
|
|
49
|
+
print("⚠️ Conflicting memories detected!")
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- **Explainable Memory**: See why your AI retrieved specific memories
|
|
55
|
+
- **Conflict Detection**: Identify contradictory information in your memory
|
|
56
|
+
- **Decision Tracing**: Understand the full retrieval process
|
|
57
|
+
- **LangChain Integration**: Use as a drop-in replacement for LangChain memory
|
|
58
|
+
|
|
59
|
+
## LangChain Integration
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from langchain.memory import ConversationBufferMemory
|
|
63
|
+
from limbicdb import Memory
|
|
64
|
+
|
|
65
|
+
# Create LimbicDB memory
|
|
66
|
+
limbic_memory = Memory()
|
|
67
|
+
|
|
68
|
+
# Use in LangChain agent
|
|
69
|
+
agent = Agent(
|
|
70
|
+
memory=limbic_memory,
|
|
71
|
+
# ... other agent configuration
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# After agent runs, explain decisions
|
|
75
|
+
explanation = limbic_memory.explain("user query")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Requirements
|
|
79
|
+
|
|
80
|
+
- Python 3.8+
|
|
81
|
+
- Node.js 18+
|
|
82
|
+
- LimbicDB installed locally
|
|
83
|
+
|
|
84
|
+
## Philosophy
|
|
85
|
+
|
|
86
|
+
Memory should not be a black box. LimbicDB makes AI memory observable, explainable, and controllable.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
limbicdb-0.1.0/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# LimbicDB Python SDK
|
|
2
|
+
|
|
3
|
+
Debuggable memory layer for AI agents
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install limbicdb
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> **Note**: This package requires [LimbicDB](https://github.com/Kousoyu/limbicdb) to be installed locally.
|
|
12
|
+
> The Python SDK is a thin wrapper around the LimbicDB CLI.
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from limbicdb import Memory
|
|
18
|
+
|
|
19
|
+
# Initialize memory with default path
|
|
20
|
+
memory = Memory()
|
|
21
|
+
|
|
22
|
+
# Explain memory retrieval decisions
|
|
23
|
+
explanation = memory.explain("anime")
|
|
24
|
+
print(explanation)
|
|
25
|
+
|
|
26
|
+
# Check for conflicts
|
|
27
|
+
if explanation["conflicts"]:
|
|
28
|
+
print("⚠️ Conflicting memories detected!")
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Explainable Memory**: See why your AI retrieved specific memories
|
|
34
|
+
- **Conflict Detection**: Identify contradictory information in your memory
|
|
35
|
+
- **Decision Tracing**: Understand the full retrieval process
|
|
36
|
+
- **LangChain Integration**: Use as a drop-in replacement for LangChain memory
|
|
37
|
+
|
|
38
|
+
## LangChain Integration
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from langchain.memory import ConversationBufferMemory
|
|
42
|
+
from limbicdb import Memory
|
|
43
|
+
|
|
44
|
+
# Create LimbicDB memory
|
|
45
|
+
limbic_memory = Memory()
|
|
46
|
+
|
|
47
|
+
# Use in LangChain agent
|
|
48
|
+
agent = Agent(
|
|
49
|
+
memory=limbic_memory,
|
|
50
|
+
# ... other agent configuration
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# After agent runs, explain decisions
|
|
54
|
+
explanation = limbic_memory.explain("user query")
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Requirements
|
|
58
|
+
|
|
59
|
+
- Python 3.8+
|
|
60
|
+
- Node.js 18+
|
|
61
|
+
- LimbicDB installed locally
|
|
62
|
+
|
|
63
|
+
## Philosophy
|
|
64
|
+
|
|
65
|
+
Memory should not be a black box. LimbicDB makes AI memory observable, explainable, and controllable.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""
|
|
2
|
+
LimbicDB Memory Class
|
|
3
|
+
Thin wrapper around LimbicDB CLI commands
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import subprocess
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
from typing import List, Dict, Any, Optional
|
|
10
|
+
|
|
11
|
+
class MemoryError(Exception):
|
|
12
|
+
"""Base exception for LimbicDB errors"""
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
class Memory:
|
|
16
|
+
"""
|
|
17
|
+
LimbicDB Memory interface for Python
|
|
18
|
+
|
|
19
|
+
This class provides a thin wrapper around the LimbicDB CLI,
|
|
20
|
+
allowing Python applications to use LimbicDB's debuggable memory features.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, path: str = ".limbic", limbicdb_path: Optional[str] = None):
|
|
24
|
+
"""
|
|
25
|
+
Initialize LimbicDB Memory
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
path: Path to the .limbic database file
|
|
29
|
+
limbicdb_path: Path to the LimbicDB installation directory
|
|
30
|
+
If not provided, will look for LIMBICDB_PATH env var
|
|
31
|
+
or default to current working directory
|
|
32
|
+
"""
|
|
33
|
+
self.path = path
|
|
34
|
+
self.limbicdb_path = limbicdb_path or os.environ.get('LIMBICDB_PATH', '.')
|
|
35
|
+
|
|
36
|
+
# Verify LimbicDB is available
|
|
37
|
+
if not self._check_limbicdb_available():
|
|
38
|
+
raise MemoryError(f"LimbicDB not found at {self.limbicdb_path}")
|
|
39
|
+
|
|
40
|
+
def _check_limbicdb_available(self) -> bool:
|
|
41
|
+
"""Check if LimbicDB CLI is available"""
|
|
42
|
+
try:
|
|
43
|
+
result = subprocess.run(
|
|
44
|
+
["npm", "list", "--depth=0"],
|
|
45
|
+
cwd=self.limbicdb_path,
|
|
46
|
+
capture_output=True,
|
|
47
|
+
text=True
|
|
48
|
+
)
|
|
49
|
+
return "limbicdb" in result.stdout
|
|
50
|
+
except (subprocess.SubprocessError, FileNotFoundError):
|
|
51
|
+
return False
|
|
52
|
+
|
|
53
|
+
def _run_cli(self, command: str, args: List[str]) -> Dict[str, Any]:
|
|
54
|
+
"""
|
|
55
|
+
Execute LimbicDB CLI command and return JSON result
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
command: CLI command name (e.g., "explain")
|
|
59
|
+
args: Command arguments
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
Parsed JSON output from CLI
|
|
63
|
+
|
|
64
|
+
Raises:
|
|
65
|
+
MemoryError: If CLI command fails
|
|
66
|
+
"""
|
|
67
|
+
# Build command - use npm run for better compatibility
|
|
68
|
+
cmd = ["npm", "run", command, "--"] + args + ["--json"]
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
result = subprocess.run(
|
|
72
|
+
cmd,
|
|
73
|
+
cwd=self.limbicdb_path,
|
|
74
|
+
capture_output=True,
|
|
75
|
+
text=True,
|
|
76
|
+
timeout=20 # 20 second timeout
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
if result.returncode != 0:
|
|
80
|
+
error_msg = result.stderr or result.stdout
|
|
81
|
+
raise MemoryError(f"CLI command failed: {error_msg}")
|
|
82
|
+
|
|
83
|
+
# Parse JSON output
|
|
84
|
+
try:
|
|
85
|
+
return json.loads(result.stdout)
|
|
86
|
+
except json.JSONDecodeError:
|
|
87
|
+
# If no JSON output, return empty dict
|
|
88
|
+
return {}
|
|
89
|
+
|
|
90
|
+
except subprocess.TimeoutExpired:
|
|
91
|
+
raise MemoryError("CLI command timed out")
|
|
92
|
+
except Exception as e:
|
|
93
|
+
raise MemoryError(f"CLI execution error: {str(e)}")
|
|
94
|
+
|
|
95
|
+
def explain(self, query: str) -> Dict[str, Any]:
|
|
96
|
+
"""
|
|
97
|
+
Explain memory retrieval decisions
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
query: Search query to explain
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
Dictionary containing explanation with structure:
|
|
104
|
+
{
|
|
105
|
+
"query": str,
|
|
106
|
+
"selectedMemory": Memory object or None,
|
|
107
|
+
"candidates": List[{
|
|
108
|
+
"memory": Memory object,
|
|
109
|
+
"score": float,
|
|
110
|
+
"reasons": List[str]
|
|
111
|
+
}],
|
|
112
|
+
"conflicts": bool,
|
|
113
|
+
"decisionTrace": List[str]
|
|
114
|
+
}
|
|
115
|
+
"""
|
|
116
|
+
return self._run_cli("explain", [query])
|
|
117
|
+
|
|
118
|
+
def remember(self, content: str) -> Dict[str, Any]:
|
|
119
|
+
"""
|
|
120
|
+
Add memory to database
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
content: Memory content to store
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
Dictionary with success status and content
|
|
127
|
+
"""
|
|
128
|
+
return self._run_cli("remember", [content])
|
|
129
|
+
|
|
130
|
+
def search(self, query: str) -> Dict[str, Any]:
|
|
131
|
+
"""
|
|
132
|
+
Search memories by query
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
query: Search query
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Dictionary containing query and results list
|
|
139
|
+
"""
|
|
140
|
+
return self._run_cli("search", [query])
|
|
141
|
+
|
|
142
|
+
def timeline(self, query: str) -> Dict[str, Any]:
|
|
143
|
+
"""
|
|
144
|
+
Get memory timeline for query
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
query: Query to filter timeline
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
Dictionary containing query and memories list
|
|
151
|
+
"""
|
|
152
|
+
return self._run_cli("timeline", [query])
|
|
153
|
+
|
|
154
|
+
def forget(self, content: str) -> Dict[str, Any]:
|
|
155
|
+
"""
|
|
156
|
+
Remove memory from database
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
content: Memory content to delete
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Dictionary with success status and deletion count
|
|
163
|
+
"""
|
|
164
|
+
return self._run_cli("forget", [content])
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: limbicdb
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Debuggable memory layer for AI agents
|
|
5
|
+
Author-email: Kousoyu <770668004@qq.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Kousoyu/limbicdb
|
|
8
|
+
Project-URL: Repository, https://github.com/Kousoyu/limbicdb
|
|
9
|
+
Project-URL: Documentation, https://github.com/Kousoyu/limbicdb
|
|
10
|
+
Keywords: ai,memory,debuggable,agents,llm
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# LimbicDB Python SDK
|
|
23
|
+
|
|
24
|
+
Debuggable memory layer for AI agents
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install limbicdb
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **Note**: This package requires [LimbicDB](https://github.com/Kousoyu/limbicdb) to be installed locally.
|
|
33
|
+
> The Python SDK is a thin wrapper around the LimbicDB CLI.
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from limbicdb import Memory
|
|
39
|
+
|
|
40
|
+
# Initialize memory with default path
|
|
41
|
+
memory = Memory()
|
|
42
|
+
|
|
43
|
+
# Explain memory retrieval decisions
|
|
44
|
+
explanation = memory.explain("anime")
|
|
45
|
+
print(explanation)
|
|
46
|
+
|
|
47
|
+
# Check for conflicts
|
|
48
|
+
if explanation["conflicts"]:
|
|
49
|
+
print("⚠️ Conflicting memories detected!")
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- **Explainable Memory**: See why your AI retrieved specific memories
|
|
55
|
+
- **Conflict Detection**: Identify contradictory information in your memory
|
|
56
|
+
- **Decision Tracing**: Understand the full retrieval process
|
|
57
|
+
- **LangChain Integration**: Use as a drop-in replacement for LangChain memory
|
|
58
|
+
|
|
59
|
+
## LangChain Integration
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from langchain.memory import ConversationBufferMemory
|
|
63
|
+
from limbicdb import Memory
|
|
64
|
+
|
|
65
|
+
# Create LimbicDB memory
|
|
66
|
+
limbic_memory = Memory()
|
|
67
|
+
|
|
68
|
+
# Use in LangChain agent
|
|
69
|
+
agent = Agent(
|
|
70
|
+
memory=limbic_memory,
|
|
71
|
+
# ... other agent configuration
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# After agent runs, explain decisions
|
|
75
|
+
explanation = limbic_memory.explain("user query")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Requirements
|
|
79
|
+
|
|
80
|
+
- Python 3.8+
|
|
81
|
+
- Node.js 18+
|
|
82
|
+
- LimbicDB installed locally
|
|
83
|
+
|
|
84
|
+
## Philosophy
|
|
85
|
+
|
|
86
|
+
Memory should not be a black box. LimbicDB makes AI memory observable, explainable, and controllable.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
limbicdb
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "limbicdb"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Debuggable memory layer for AI agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{name = "Kousoyu", email = "770668004@qq.com"}]
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.8",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
]
|
|
22
|
+
keywords = ["ai", "memory", "debuggable", "agents", "llm"]
|
|
23
|
+
dependencies = []
|
|
24
|
+
requires-python = ">=3.8"
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/Kousoyu/limbicdb"
|
|
28
|
+
Repository = "https://github.com/Kousoyu/limbicdb"
|
|
29
|
+
Documentation = "https://github.com/Kousoyu/limbicdb"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
where = ["."]
|
|
33
|
+
include = ["limbicdb*"]
|
limbicdb-0.1.0/setup.cfg
ADDED