engram-search 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.
Files changed (35) hide show
  1. engram_search-0.1.0/.dockerignore +14 -0
  2. engram_search-0.1.0/.github/workflows/ci.yml +55 -0
  3. engram_search-0.1.0/.github/workflows/publish.yml +29 -0
  4. engram_search-0.1.0/.gitignore +214 -0
  5. engram_search-0.1.0/Dockerfile +27 -0
  6. engram_search-0.1.0/LICENSE +21 -0
  7. engram_search-0.1.0/PKG-INFO +166 -0
  8. engram_search-0.1.0/README.md +124 -0
  9. engram_search-0.1.0/benchmarks/__init__.py +0 -0
  10. engram_search-0.1.0/benchmarks/longmemeval_bench.py +348 -0
  11. engram_search-0.1.0/docker-compose.yml +35 -0
  12. engram_search-0.1.0/engram/__init__.py +3 -0
  13. engram_search-0.1.0/engram/backends/__init__.py +1 -0
  14. engram_search-0.1.0/engram/backends/base.py +54 -0
  15. engram_search-0.1.0/engram/backends/faiss_backend.py +162 -0
  16. engram_search-0.1.0/engram/backends/qdrant_backend.py +121 -0
  17. engram_search-0.1.0/engram/cli.py +158 -0
  18. engram_search-0.1.0/engram/config.py +77 -0
  19. engram_search-0.1.0/engram/ingestion/__init__.py +1 -0
  20. engram_search-0.1.0/engram/ingestion/parser.py +265 -0
  21. engram_search-0.1.0/engram/retrieval/__init__.py +1 -0
  22. engram_search-0.1.0/engram/retrieval/embedder.py +149 -0
  23. engram_search-0.1.0/engram/retrieval/pipeline.py +370 -0
  24. engram_search-0.1.0/engram/retrieval/reranker.py +58 -0
  25. engram_search-0.1.0/engram/retrieval/sparse.py +198 -0
  26. engram_search-0.1.0/engram/server.py +191 -0
  27. engram_search-0.1.0/logo.png +0 -0
  28. engram_search-0.1.0/logo.svg +120 -0
  29. engram_search-0.1.0/pyproject.toml +64 -0
  30. engram_search-0.1.0/social-preview.png +0 -0
  31. engram_search-0.1.0/tests/__init__.py +0 -0
  32. engram_search-0.1.0/tests/test_faiss_backend.py +117 -0
  33. engram_search-0.1.0/tests/test_parser.py +183 -0
  34. engram_search-0.1.0/tests/test_pipeline.py +164 -0
  35. engram_search-0.1.0/tests/test_sparse.py +101 -0
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ .git/
3
+ .github/
4
+ __pycache__/
5
+ *.pyc
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ benchmarks/
9
+ tests/
10
+ engram_store/
11
+ *.faiss
12
+ *.egg-info/
13
+ dist/
14
+ build/
@@ -0,0 +1,55 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install pytest ruff numpy faiss-cpu
28
+
29
+ - name: Install engram
30
+ run: pip install -e . --no-deps
31
+
32
+ - name: Lint with ruff
33
+ run: ruff check engram/ tests/
34
+
35
+ - name: Run tests
36
+ run: pytest tests/ -v -k "not test_persistence"
37
+
38
+ lint:
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+
43
+ - name: Set up Python
44
+ uses: actions/setup-python@v5
45
+ with:
46
+ python-version: "3.12"
47
+
48
+ - name: Install ruff
49
+ run: pip install ruff
50
+
51
+ - name: Lint check
52
+ run: ruff check engram/ tests/
53
+
54
+ - name: Format check
55
+ run: ruff format --check engram/ tests/
@@ -0,0 +1,29 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Install build tools
23
+ run: pip install build
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Publish to PyPI
29
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,214 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+
209
+ # Engram
210
+ engram_store/
211
+ *.faiss
212
+ engram_meta.db
213
+ benchmarks/results_*.json
214
+ /tmp/longmemeval_*.json
@@ -0,0 +1,27 @@
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system deps
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ build-essential \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy project files
11
+ COPY pyproject.toml README.md LICENSE ./
12
+ COPY engram/ engram/
13
+
14
+ # Install engram with cloud + server deps
15
+ RUN pip install --no-cache-dir -e ".[cloud]" fastapi uvicorn
16
+
17
+ # Pre-download the default embedding model
18
+ RUN python -c "from engram.retrieval.embedder import Embedder; Embedder('bge-large')._load()"
19
+
20
+ EXPOSE 8000
21
+
22
+ ENV ENGRAM_BACKEND=faiss
23
+ ENV ENGRAM_STORE_PATH=/data/engram_store
24
+
25
+ VOLUME ["/data"]
26
+
27
+ CMD ["uvicorn", "engram.server:app", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nitin Gupta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: engram-search
3
+ Version: 0.1.0
4
+ Summary: High-recall conversational memory retrieval. Local-first, cloud-ready. 98%+ R@5 on LongMemEval.
5
+ Author-email: Nitin Gupta <nmittal1109@gmail.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: bm25,conversational-ai,embeddings,faiss,memory,retrieval
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.9
19
+ Requires-Dist: faiss-cpu>=1.7
20
+ Requires-Dist: numpy>=1.24
21
+ Requires-Dist: rank-bm25>=0.2
22
+ Requires-Dist: sentence-transformers>=3.0
23
+ Provides-Extra: all
24
+ Requires-Dist: pytest>=7.0; extra == 'all'
25
+ Requires-Dist: qdrant-client>=1.9; extra == 'all'
26
+ Requires-Dist: ruff>=0.4; extra == 'all'
27
+ Requires-Dist: sentence-transformers>=3.0; extra == 'all'
28
+ Requires-Dist: tqdm>=4.60; extra == 'all'
29
+ Provides-Extra: bench
30
+ Requires-Dist: tqdm>=4.60; extra == 'bench'
31
+ Provides-Extra: cloud
32
+ Requires-Dist: qdrant-client>=1.9; extra == 'cloud'
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0; extra == 'dev'
35
+ Requires-Dist: qdrant-client>=1.9; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4; extra == 'dev'
37
+ Requires-Dist: sentence-transformers>=3.0; extra == 'dev'
38
+ Requires-Dist: tqdm>=4.60; extra == 'dev'
39
+ Provides-Extra: rerank
40
+ Requires-Dist: sentence-transformers>=3.0; extra == 'rerank'
41
+ Description-Content-Type: text/markdown
42
+
43
+ <p align="center">
44
+ <img src="logo.svg" width="180" alt="Engram logo">
45
+ </p>
46
+
47
+ <h1 align="center">Engram</h1>
48
+
49
+ <p align="center">High-recall conversational memory retrieval. Local-first, cloud-ready.</p>
50
+
51
+ **Target: 98%+ R@5 on LongMemEval — no LLM required.**
52
+
53
+ ## What It Is
54
+
55
+ Engram stores conversation history and retrieves it with state-of-the-art accuracy. It uses a three-stage retrieval pipeline — dense embeddings, sparse keyword matching, and cross-encoder reranking — to achieve higher recall than systems relying on LLM-based extraction or summarization.
56
+
57
+ Nothing is summarized. Nothing is paraphrased. Your exact words are stored and returned.
58
+
59
+ ## Why It's Better
60
+
61
+ | | Engram | MemPalace | Mem0 |
62
+ |---|---|---|---|
63
+ | Embedding model | bge-large (1024d) | all-MiniLM (384d) | Varies |
64
+ | Sparse retrieval | BM25 with RRF fusion | Ad-hoc keyword overlap | N/A |
65
+ | Reranking | Cross-encoder (free) | LLM call ($0.001/q) | N/A |
66
+ | Indexing | User + assistant turns | User turns only | LLM-extracted facts |
67
+ | Cloud deployment | Qdrant backend | No | Yes |
68
+ | LLM required | No | No (optional rerank) | Yes |
69
+
70
+ ## Install
71
+
72
+ ```bash
73
+ # Local mode (FAISS + SQLite)
74
+ pip install engram
75
+
76
+ # With cloud backend (Qdrant)
77
+ pip install engram[cloud]
78
+
79
+ # With cross-encoder reranker
80
+ pip install engram[rerank]
81
+
82
+ # Everything
83
+ pip install engram[all]
84
+ ```
85
+
86
+ ## Quickstart — Local Mode
87
+
88
+ ```bash
89
+ # Initialize a memory store
90
+ engram init ./my_memories
91
+
92
+ # Ingest conversations
93
+ engram ingest conversations.json --store ./my_memories
94
+
95
+ # Search
96
+ engram search "why did we switch to GraphQL" --store ./my_memories
97
+ ```
98
+
99
+ ## Quickstart — Cloud Mode (for companies)
100
+
101
+ ```bash
102
+ # Set up Qdrant (managed or self-hosted)
103
+ export ENGRAM_BACKEND=qdrant
104
+ export ENGRAM_QDRANT_URL=https://your-cluster.qdrant.io:6333
105
+ export ENGRAM_QDRANT_API_KEY=your-api-key
106
+
107
+ # Start the API server
108
+ pip install fastapi uvicorn
109
+ uvicorn engram.server:app --host 0.0.0.0 --port 8000
110
+ ```
111
+
112
+ API endpoints:
113
+ - `POST /ingest` — add conversations
114
+ - `POST /search` — search memories
115
+ - `GET /health` — health check
116
+ - `GET /stats` — store statistics
117
+
118
+ ## Benchmarks
119
+
120
+ ```bash
121
+ # Download LongMemEval dataset
122
+ mkdir -p /tmp/longmemeval-data
123
+ curl -fsSL -o /tmp/longmemeval-data/longmemeval_s_cleaned.json \
124
+ https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned/resolve/main/longmemeval_s_cleaned.json
125
+
126
+ # Run benchmark
127
+ pip install -e ".[dev]"
128
+
129
+ # Dense only (bge-large baseline)
130
+ python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode dense
131
+
132
+ # Hybrid (dense + BM25 via RRF) — default
133
+ python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode hybrid
134
+
135
+ # Full pipeline (hybrid + cross-encoder reranker)
136
+ python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode rerank
137
+ ```
138
+
139
+ ## Architecture
140
+
141
+ ```
142
+ ┌─────────────────────────────────────────────────────────────┐
143
+ │ Engram │
144
+ │ │
145
+ │ ┌────────────┐ ┌─────────────┐ ┌───────────────────┐ │
146
+ │ │ Ingestion │ │ Index │ │ Retrieval │ │
147
+ │ │ │→ │ │→ │ │ │
148
+ │ │ user+asst │ │ FAISS (local│ │ 1. Dense (bi-enc) │ │
149
+ │ │ turns │ │ or Qdrant │ │ 2. BM25 (sparse) │ │
150
+ │ │ preference │ │ (cloud) │ │ 3. RRF fusion │ │
151
+ │ │ extraction │ │ │ │ 4. Cross-encoder │ │
152
+ │ └────────────┘ └─────────────┘ └───────────────────┘ │
153
+ │ │
154
+ │ Local: FAISS + SQLite Cloud: Qdrant + REST API │
155
+ └─────────────────────────────────────────────────────────────┘
156
+ ```
157
+
158
+ ## Requirements
159
+
160
+ - Python 3.10+
161
+ - ~1.3 GB disk for bge-large embedding model (downloaded on first use)
162
+ - No API key required for local mode
163
+
164
+ ## License
165
+
166
+ MIT
@@ -0,0 +1,124 @@
1
+ <p align="center">
2
+ <img src="logo.svg" width="180" alt="Engram logo">
3
+ </p>
4
+
5
+ <h1 align="center">Engram</h1>
6
+
7
+ <p align="center">High-recall conversational memory retrieval. Local-first, cloud-ready.</p>
8
+
9
+ **Target: 98%+ R@5 on LongMemEval — no LLM required.**
10
+
11
+ ## What It Is
12
+
13
+ Engram stores conversation history and retrieves it with state-of-the-art accuracy. It uses a three-stage retrieval pipeline — dense embeddings, sparse keyword matching, and cross-encoder reranking — to achieve higher recall than systems relying on LLM-based extraction or summarization.
14
+
15
+ Nothing is summarized. Nothing is paraphrased. Your exact words are stored and returned.
16
+
17
+ ## Why It's Better
18
+
19
+ | | Engram | MemPalace | Mem0 |
20
+ |---|---|---|---|
21
+ | Embedding model | bge-large (1024d) | all-MiniLM (384d) | Varies |
22
+ | Sparse retrieval | BM25 with RRF fusion | Ad-hoc keyword overlap | N/A |
23
+ | Reranking | Cross-encoder (free) | LLM call ($0.001/q) | N/A |
24
+ | Indexing | User + assistant turns | User turns only | LLM-extracted facts |
25
+ | Cloud deployment | Qdrant backend | No | Yes |
26
+ | LLM required | No | No (optional rerank) | Yes |
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ # Local mode (FAISS + SQLite)
32
+ pip install engram
33
+
34
+ # With cloud backend (Qdrant)
35
+ pip install engram[cloud]
36
+
37
+ # With cross-encoder reranker
38
+ pip install engram[rerank]
39
+
40
+ # Everything
41
+ pip install engram[all]
42
+ ```
43
+
44
+ ## Quickstart — Local Mode
45
+
46
+ ```bash
47
+ # Initialize a memory store
48
+ engram init ./my_memories
49
+
50
+ # Ingest conversations
51
+ engram ingest conversations.json --store ./my_memories
52
+
53
+ # Search
54
+ engram search "why did we switch to GraphQL" --store ./my_memories
55
+ ```
56
+
57
+ ## Quickstart — Cloud Mode (for companies)
58
+
59
+ ```bash
60
+ # Set up Qdrant (managed or self-hosted)
61
+ export ENGRAM_BACKEND=qdrant
62
+ export ENGRAM_QDRANT_URL=https://your-cluster.qdrant.io:6333
63
+ export ENGRAM_QDRANT_API_KEY=your-api-key
64
+
65
+ # Start the API server
66
+ pip install fastapi uvicorn
67
+ uvicorn engram.server:app --host 0.0.0.0 --port 8000
68
+ ```
69
+
70
+ API endpoints:
71
+ - `POST /ingest` — add conversations
72
+ - `POST /search` — search memories
73
+ - `GET /health` — health check
74
+ - `GET /stats` — store statistics
75
+
76
+ ## Benchmarks
77
+
78
+ ```bash
79
+ # Download LongMemEval dataset
80
+ mkdir -p /tmp/longmemeval-data
81
+ curl -fsSL -o /tmp/longmemeval-data/longmemeval_s_cleaned.json \
82
+ https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned/resolve/main/longmemeval_s_cleaned.json
83
+
84
+ # Run benchmark
85
+ pip install -e ".[dev]"
86
+
87
+ # Dense only (bge-large baseline)
88
+ python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode dense
89
+
90
+ # Hybrid (dense + BM25 via RRF) — default
91
+ python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode hybrid
92
+
93
+ # Full pipeline (hybrid + cross-encoder reranker)
94
+ python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode rerank
95
+ ```
96
+
97
+ ## Architecture
98
+
99
+ ```
100
+ ┌─────────────────────────────────────────────────────────────┐
101
+ │ Engram │
102
+ │ │
103
+ │ ┌────────────┐ ┌─────────────┐ ┌───────────────────┐ │
104
+ │ │ Ingestion │ │ Index │ │ Retrieval │ │
105
+ │ │ │→ │ │→ │ │ │
106
+ │ │ user+asst │ │ FAISS (local│ │ 1. Dense (bi-enc) │ │
107
+ │ │ turns │ │ or Qdrant │ │ 2. BM25 (sparse) │ │
108
+ │ │ preference │ │ (cloud) │ │ 3. RRF fusion │ │
109
+ │ │ extraction │ │ │ │ 4. Cross-encoder │ │
110
+ │ └────────────┘ └─────────────┘ └───────────────────┘ │
111
+ │ │
112
+ │ Local: FAISS + SQLite Cloud: Qdrant + REST API │
113
+ └─────────────────────────────────────────────────────────────┘
114
+ ```
115
+
116
+ ## Requirements
117
+
118
+ - Python 3.10+
119
+ - ~1.3 GB disk for bge-large embedding model (downloaded on first use)
120
+ - No API key required for local mode
121
+
122
+ ## License
123
+
124
+ MIT
File without changes