pyomnibrain 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.
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyomnibrain
3
+ Version: 0.1.0
4
+ Summary: Python bindings and SDK for OmniBrain: Embedded Local-First Temporal Semantic Knowledge Graph & Reader Engine
5
+ Author-email: "Shah Md. Mahi" <shahmdmahi15@gmail.com>
6
+ Project-URL: Homepage, https://github.com/shahmdmahi15/omnibrain
7
+ Project-URL: Bug Tracker, https://github.com/shahmdmahi15/omnibrain/issues
8
+ Project-URL: Website, https://shahmdmahi.dpdns.org
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
13
+ Classifier: Topic :: Database :: Database Engines/Servers
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: requests>=2.28.0
17
+
18
+ # pyomnibrain
19
+
20
+ **Python SDK & Client for OmniBrain (ChronoCache)**
21
+ *Embedded Local-First Temporal Semantic Knowledge Graph & Reader Engine*
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ pip install pyomnibrain
27
+ ```
28
+
29
+ ## Quickstart
30
+
31
+ ```python
32
+ from pyomnibrain import OmniBrainClient
33
+
34
+ # Connect to local OmniBrain daemon
35
+ client = OmniBrainClient(host="127.0.0.1", port=4821)
36
+
37
+ # Check daemon health
38
+ health = client.health()
39
+ print(f"Connected to OmniBrain v{health['version']}")
40
+
41
+ # Snapshot an article into offline memory
42
+ capture_result = client.capture(
43
+ url="https://example.com/rust-architecture",
44
+ title="High-Performance Rust Architectures",
45
+ content="""
46
+ <article>
47
+ <h1>High-Performance Rust Architectures</h1>
48
+ <p>Rust empowers developers to build reliable, high-throughput systems with zero-cost abstractions.</p>
49
+ </article>
50
+ """
51
+ )
52
+ print(f"Captured: {capture_result['title']} | Compression: {capture_result['compression']['compression_ratio']}x")
53
+
54
+ # Search offline memory with hybrid fusion
55
+ results = client.search("high-performance reliable systems", limit=5, mode="hybrid")
56
+ for r in results:
57
+ print(f"[{r['match_type'].upper()}] {r['title']} (Score: {r['score']:.4f})")
58
+ print(f" Snippet: {r['snippet']}")
59
+ ```
@@ -0,0 +1,42 @@
1
+ # pyomnibrain
2
+
3
+ **Python SDK & Client for OmniBrain (ChronoCache)**
4
+ *Embedded Local-First Temporal Semantic Knowledge Graph & Reader Engine*
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pip install pyomnibrain
10
+ ```
11
+
12
+ ## Quickstart
13
+
14
+ ```python
15
+ from pyomnibrain import OmniBrainClient
16
+
17
+ # Connect to local OmniBrain daemon
18
+ client = OmniBrainClient(host="127.0.0.1", port=4821)
19
+
20
+ # Check daemon health
21
+ health = client.health()
22
+ print(f"Connected to OmniBrain v{health['version']}")
23
+
24
+ # Snapshot an article into offline memory
25
+ capture_result = client.capture(
26
+ url="https://example.com/rust-architecture",
27
+ title="High-Performance Rust Architectures",
28
+ content="""
29
+ <article>
30
+ <h1>High-Performance Rust Architectures</h1>
31
+ <p>Rust empowers developers to build reliable, high-throughput systems with zero-cost abstractions.</p>
32
+ </article>
33
+ """
34
+ )
35
+ print(f"Captured: {capture_result['title']} | Compression: {capture_result['compression']['compression_ratio']}x")
36
+
37
+ # Search offline memory with hybrid fusion
38
+ results = client.search("high-performance reliable systems", limit=5, mode="hybrid")
39
+ for r in results:
40
+ print(f"[{r['match_type'].upper()}] {r['title']} (Score: {r['score']:.4f})")
41
+ print(f" Snippet: {r['snippet']}")
42
+ ```
@@ -0,0 +1,107 @@
1
+ """
2
+ pyomnibrain: Python Client and Data Science Interface for OmniBrain.
3
+ Embedded Local-First Temporal Semantic Knowledge Graph & Reader Engine.
4
+ """
5
+
6
+ from typing import Any, Dict, List, Optional
7
+ import json
8
+ import urllib.error
9
+ import urllib.parse
10
+ import urllib.request
11
+
12
+
13
+ class OmniBrainError(Exception):
14
+ """Base exception for OmniBrain client errors."""
15
+ pass
16
+
17
+
18
+ class OmniBrainClient:
19
+ """Client for interacting with local or remote OmniBrain daemon."""
20
+
21
+ def __init__(self, host: str = "127.0.0.1", port: int = 4821, timeout: float = 10.0):
22
+ self.base_url = f"http://{host}:{port}"
23
+ self.timeout = timeout
24
+
25
+ def _request(self, method: str, path: str, data: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None) -> Any:
26
+ url = f"{self.base_url}{path}"
27
+ if params:
28
+ query_string = urllib.parse.urlencode({k: v for k, v in params.items() if v is not None})
29
+ url = f"{url}?{query_string}"
30
+
31
+ headers = {
32
+ "Accept": "application/json",
33
+ "User-Agent": "pyomnibrain/0.1.0",
34
+ }
35
+ body = None
36
+ if data is not None:
37
+ body = json.dumps(data).encode("utf-8")
38
+ headers["Content-Type"] = "application/json"
39
+
40
+ req = urllib.request.Request(url, data=body, headers=headers, method=method)
41
+ try:
42
+ with urllib.request.urlopen(req, timeout=self.timeout) as response:
43
+ resp_bytes = response.read()
44
+ if not resp_bytes:
45
+ return None
46
+ return json.loads(resp_bytes.decode("utf-8"))
47
+ except urllib.error.HTTPError as e:
48
+ error_body = e.read().decode("utf-8", errors="replace")
49
+ raise OmniBrainError(f"HTTP {e.code}: {error_body}") from e
50
+ except Exception as e:
51
+ raise OmniBrainError(f"Connection failed to {url}: {e}") from e
52
+
53
+ def health(self) -> Dict[str, Any]:
54
+ """Check status of OmniBrain daemon."""
55
+ return self._request("GET", "/health")
56
+
57
+ def capture(
58
+ self,
59
+ url: str,
60
+ content: str,
61
+ title: Optional[str] = None,
62
+ raw_html: Optional[str] = None,
63
+ ) -> Dict[str, Any]:
64
+ """
65
+ Capture a web page or article into offline memory.
66
+ Runs readability extraction, Zstd compression, and HNSW embedding indexing.
67
+ """
68
+ payload = {
69
+ "url": url,
70
+ "title": title,
71
+ "content": content,
72
+ "raw_html": raw_html,
73
+ }
74
+ return self._request("POST", "/api/capture", data=payload)
75
+
76
+ def search(
77
+ self,
78
+ query: str,
79
+ limit: int = 10,
80
+ mode: str = "hybrid",
81
+ ) -> List[Dict[str, Any]]:
82
+ """
83
+ Execute search across offline personal web memory.
84
+ Modes: 'hybrid' (RRF BM25 + HNSW), 'lexical' (BM25), 'semantic' (HNSW Cosine).
85
+ """
86
+ params = {
87
+ "q": query,
88
+ "limit": limit,
89
+ "mode": mode,
90
+ }
91
+ return self._request("GET", "/api/search", params=params)
92
+
93
+ def get_doc(self, doc_id: str) -> Dict[str, Any]:
94
+ """Retrieve full uncompressed document by ID."""
95
+ return self._request("GET", f"/api/doc/{doc_id}")
96
+
97
+ def delete_doc(self, doc_id: str) -> bool:
98
+ """Delete document from store and search indexes."""
99
+ res = self._request("DELETE", f"/api/doc/{doc_id}")
100
+ return res.get("success", False)
101
+
102
+ def stats(self) -> Dict[str, Any]:
103
+ """Get knowledge graph and compression telemetry."""
104
+ return self._request("GET", "/api/stats")
105
+
106
+
107
+ __all__ = ["OmniBrainClient", "OmniBrainError"]
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyomnibrain
3
+ Version: 0.1.0
4
+ Summary: Python bindings and SDK for OmniBrain: Embedded Local-First Temporal Semantic Knowledge Graph & Reader Engine
5
+ Author-email: "Shah Md. Mahi" <shahmdmahi15@gmail.com>
6
+ Project-URL: Homepage, https://github.com/shahmdmahi15/omnibrain
7
+ Project-URL: Bug Tracker, https://github.com/shahmdmahi15/omnibrain/issues
8
+ Project-URL: Website, https://shahmdmahi.dpdns.org
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
13
+ Classifier: Topic :: Database :: Database Engines/Servers
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: requests>=2.28.0
17
+
18
+ # pyomnibrain
19
+
20
+ **Python SDK & Client for OmniBrain (ChronoCache)**
21
+ *Embedded Local-First Temporal Semantic Knowledge Graph & Reader Engine*
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ pip install pyomnibrain
27
+ ```
28
+
29
+ ## Quickstart
30
+
31
+ ```python
32
+ from pyomnibrain import OmniBrainClient
33
+
34
+ # Connect to local OmniBrain daemon
35
+ client = OmniBrainClient(host="127.0.0.1", port=4821)
36
+
37
+ # Check daemon health
38
+ health = client.health()
39
+ print(f"Connected to OmniBrain v{health['version']}")
40
+
41
+ # Snapshot an article into offline memory
42
+ capture_result = client.capture(
43
+ url="https://example.com/rust-architecture",
44
+ title="High-Performance Rust Architectures",
45
+ content="""
46
+ <article>
47
+ <h1>High-Performance Rust Architectures</h1>
48
+ <p>Rust empowers developers to build reliable, high-throughput systems with zero-cost abstractions.</p>
49
+ </article>
50
+ """
51
+ )
52
+ print(f"Captured: {capture_result['title']} | Compression: {capture_result['compression']['compression_ratio']}x")
53
+
54
+ # Search offline memory with hybrid fusion
55
+ results = client.search("high-performance reliable systems", limit=5, mode="hybrid")
56
+ for r in results:
57
+ print(f"[{r['match_type'].upper()}] {r['title']} (Score: {r['score']:.4f})")
58
+ print(f" Snippet: {r['snippet']}")
59
+ ```
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ pyomnibrain/__init__.py
4
+ pyomnibrain.egg-info/PKG-INFO
5
+ pyomnibrain.egg-info/SOURCES.txt
6
+ pyomnibrain.egg-info/dependency_links.txt
7
+ pyomnibrain.egg-info/requires.txt
8
+ pyomnibrain.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.28.0
@@ -0,0 +1 @@
1
+ pyomnibrain
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pyomnibrain"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Shah Md. Mahi", email="shahmdmahi15@gmail.com" },
10
+ ]
11
+ description = "Python bindings and SDK for OmniBrain: Embedded Local-First Temporal Semantic Knowledge Graph & Reader Engine"
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ "Topic :: Scientific/Engineering :: Information Analysis",
19
+ "Topic :: Database :: Database Engines/Servers",
20
+ ]
21
+ dependencies = [
22
+ "requests>=2.28.0",
23
+ ]
24
+
25
+ [project.urls]
26
+ "Homepage" = "https://github.com/shahmdmahi15/omnibrain"
27
+ "Bug Tracker" = "https://github.com/shahmdmahi15/omnibrain/issues"
28
+ "Website" = "https://shahmdmahi.dpdns.org"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+