mnemosyne-rag 0.6.1__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.
- mnemosyne_rag-0.6.1/LICENSE +190 -0
- mnemosyne_rag-0.6.1/PKG-INFO +310 -0
- mnemosyne_rag-0.6.1/README.md +269 -0
- mnemosyne_rag-0.6.1/pyproject.toml +77 -0
- mnemosyne_rag-0.6.1/setup.cfg +4 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/__init__.py +22 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/chunking.py +30 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/cli.py +384 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/config.py +108 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/embeddings.py +24 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/eval.py +773 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/http_server.py +101 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/index.py +150 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/llm.py +51 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/loaders.py +161 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/mcp_server.py +61 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/__init__.py +14 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/base.py +146 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/general/__init__.py +7 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/general/manifest.yaml +25 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/general/pack.py +15 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/general/sources/operating-principles.md +72 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/general/sources/sources.yaml +8 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/opnsense/__init__.py +7 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/opnsense/eval/questions.yaml +90 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/opnsense/manifest.yaml +30 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/opnsense/sources/opnsense-core-concepts.md +45 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/opnsense/sources/opnsense-firewall-ids.md +31 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/opnsense/sources/opnsense-plugins.md +32 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/opnsense/sources/sources.yaml +17 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/__init__.py +6 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/eval/questions.yaml +185 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/manifest.yaml +29 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-aliases-advanced-rules.md +32 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-core-concepts.md +33 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-diagnostics-backup.md +24 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-firewall-rules.md +33 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-high-availability.md +27 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-multiwan-traffic.md +34 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-nat-vpn.md +24 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-packages.md +19 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/pfsense-services.md +15 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/pfsense/sources/sources.yaml +22 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/registry.py +85 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/__init__.py +7 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/eval/questions.yaml +219 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/manifest.yaml +29 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/seed-unifi-concepts.md +64 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/sources.yaml +23 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/unifi-dns.md +38 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/unifi-network-security.md +88 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/unifi-operations.md +63 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/unifi-qos-traffic.md +40 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/unifi-vpn.md +51 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/packs/ubiquiti/sources/unifi-wifi-rf.md +60 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/pipeline.py +216 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/prompts.py +53 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/service.py +103 -0
- mnemosyne_rag-0.6.1/src/mnemosyne/static/mnemosyne_icon.svg +36 -0
- mnemosyne_rag-0.6.1/src/mnemosyne_rag.egg-info/PKG-INFO +310 -0
- mnemosyne_rag-0.6.1/src/mnemosyne_rag.egg-info/SOURCES.txt +76 -0
- mnemosyne_rag-0.6.1/src/mnemosyne_rag.egg-info/dependency_links.txt +1 -0
- mnemosyne_rag-0.6.1/src/mnemosyne_rag.egg-info/entry_points.txt +4 -0
- mnemosyne_rag-0.6.1/src/mnemosyne_rag.egg-info/requires.txt +24 -0
- mnemosyne_rag-0.6.1/src/mnemosyne_rag.egg-info/top_level.txt +1 -0
- mnemosyne_rag-0.6.1/tests/test_chunking.py +49 -0
- mnemosyne_rag-0.6.1/tests/test_cli.py +53 -0
- mnemosyne_rag-0.6.1/tests/test_config.py +47 -0
- mnemosyne_rag-0.6.1/tests/test_eval.py +1157 -0
- mnemosyne_rag-0.6.1/tests/test_http.py +33 -0
- mnemosyne_rag-0.6.1/tests/test_index.py +162 -0
- mnemosyne_rag-0.6.1/tests/test_llm.py +72 -0
- mnemosyne_rag-0.6.1/tests/test_loaders.py +48 -0
- mnemosyne_rag-0.6.1/tests/test_mcp.py +27 -0
- mnemosyne_rag-0.6.1/tests/test_packs.py +295 -0
- mnemosyne_rag-0.6.1/tests/test_pipeline.py +101 -0
- mnemosyne_rag-0.6.1/tests/test_prompts.py +34 -0
- mnemosyne_rag-0.6.1/tests/test_service.py +159 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2024 Jonathan Freed
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mnemosyne-rag
|
|
3
|
+
Version: 0.6.1
|
|
4
|
+
Summary: A local, teaching-first RAG pipeline (Ollama + LangChain + FAISS) that turns any model into an instant expert.
|
|
5
|
+
Author: Jonathan Freed
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/freed-dev-llc/mnemosyne
|
|
8
|
+
Project-URL: Repository, https://github.com/freed-dev-llc/mnemosyne
|
|
9
|
+
Keywords: rag,ollama,langchain,faiss,retrieval,embeddings,local-llm
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: langchain-core<2,>=1
|
|
19
|
+
Requires-Dist: langchain-community<0.5,>=0.4
|
|
20
|
+
Requires-Dist: langchain-ollama<2,>=1
|
|
21
|
+
Requires-Dist: langchain-openai<2,>=1
|
|
22
|
+
Requires-Dist: langchain-text-splitters<2,>=1
|
|
23
|
+
Requires-Dist: pypdf>=4.2
|
|
24
|
+
Requires-Dist: pydantic-settings>=2.4
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
|
+
Requires-Dist: typer>=0.12
|
|
27
|
+
Requires-Dist: rich>=13.7
|
|
28
|
+
Requires-Dist: mcp>=1.28.0
|
|
29
|
+
Requires-Dist: fastapi>=0.110
|
|
30
|
+
Requires-Dist: uvicorn>=0.29
|
|
31
|
+
Provides-Extra: cpu
|
|
32
|
+
Requires-Dist: faiss-cpu>=1.8; extra == "cpu"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest>=8.2; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.11; extra == "dev"
|
|
38
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
39
|
+
Requires-Dist: httpx>=0.27; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# Mnemosyne
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
[](https://github.com/freed-dev-llc/mnemosyne/actions/workflows/ci.yml)
|
|
47
|
+
[](https://codecov.io/gh/freed-dev-llc/mnemosyne)
|
|
48
|
+
[](https://www.python.org/downloads/)
|
|
49
|
+
[](LICENSE)
|
|
50
|
+
[](https://github.com/astral-sh/ruff)
|
|
51
|
+
[](#3-technology)
|
|
52
|
+
|
|
53
|
+
> **Mnemosyne** (*nee-MAH-suh-nee*): Titaness of memory, mother of the nine Muses. A
|
|
54
|
+
> local Retrieval-Augmented Generation (RAG) pipeline that turns any model into an instant
|
|
55
|
+
> expert on documents it has never seen, no fine-tuning required.
|
|
56
|
+
|
|
57
|
+
Mnemosyne is a **teaching-first RAG pipeline** built on
|
|
58
|
+
**[Ollama](https://ollama.com) + [LangChain](https://www.langchain.com) +
|
|
59
|
+
[FAISS](https://github.com/facebookresearch/faiss)**: entirely local, no API keys, no
|
|
60
|
+
data leaving the box. Point it at a corpus and it embeds and indexes that corpus; a small
|
|
61
|
+
local model then answers questions about it *with citations*, as if it had read every
|
|
62
|
+
page. In Greek myth, Mnemosyne was memory itself, the wellspring the Muses drew knowledge
|
|
63
|
+
from. That's the job here: be the memory a model retrieves from.
|
|
64
|
+
|
|
65
|
+
**Part of the freed-dev-llc family.** Mnemosyne is the **knowledge brain**: its first real use
|
|
66
|
+
case is being a **local expert for [Argus](https://github.com/freed-dev-llc/argus)** (a network
|
|
67
|
+
source-of-truth), fed by the same vendors Argus discovers, starting with **Ubiquiti**.
|
|
68
|
+
|
|
69
|
+
[](https://github.com/freed-dev-llc/argus)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Start Here
|
|
74
|
+
|
|
75
|
+
| Need | Read | Tokens (~) |
|
|
76
|
+
|------|------|------------|
|
|
77
|
+
| **What RAG is, from first principles** | [`docs/RAG-101.md`](docs/RAG-101.md): the teaching core (chunk → embed → index → retrieve → generate) | ~4k |
|
|
78
|
+
| **How the pipeline is wired** | [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md): modules, data flow, where to change things | ~3k |
|
|
79
|
+
| **Knowledge packs (the plugin model)** | [`docs/KNOWLEDGE_PACKS.md`](docs/KNOWLEDGE_PACKS.md): how a corpus becomes an expert; build your own | ~2k |
|
|
80
|
+
| **What's planned** | [`docs/ROADMAP.md`](docs/ROADMAP.md): Ubiquiti corpus maturity, then vendor-pack parity with Argus | ~1k |
|
|
81
|
+
| **Design decisions** | [`docs/architecture/adr/`](docs/architecture/adr/): why Ollama/LangChain/FAISS, why packs | ~2k |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Table of Contents
|
|
86
|
+
|
|
87
|
+
1. [The idea](#1-the-idea)
|
|
88
|
+
2. [How it works](#2-how-it-works)
|
|
89
|
+
3. [Technology](#3-technology)
|
|
90
|
+
4. [Quickstart](#4-quickstart)
|
|
91
|
+
5. [Knowledge packs](#5-knowledge-packs)
|
|
92
|
+
6. [Use case: a local brain for Argus](#6-use-case-a-local-brain-for-argus)
|
|
93
|
+
7. [Repository layout](#7-repository-layout)
|
|
94
|
+
8. [Roadmap](#8-roadmap)
|
|
95
|
+
9. [Contributing](#9-contributing)
|
|
96
|
+
10. [License](#10-license)
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 1. The idea
|
|
101
|
+
|
|
102
|
+
A base model knows a lot of *general* things and very few of *your* things. Fine-tuning to
|
|
103
|
+
fix that is slow, expensive, and stale the moment your docs change. **Retrieval-Augmented
|
|
104
|
+
Generation** takes the other road: leave the model's weights alone and, at question time,
|
|
105
|
+
*retrieve* the few passages that actually matter and hand them to the model as context.
|
|
106
|
+
The model doesn't need to have *memorized* the Ubiquiti switching guide; it just needs it
|
|
107
|
+
in front of it for the next 4,000 tokens.
|
|
108
|
+
|
|
109
|
+
Mnemosyne exists to make that loop **legible**. Every stage is a small, readable module
|
|
110
|
+
you can open, change, and measure. It is a repo to *learn RAG by building it*, not a
|
|
111
|
+
black box, and to grow into something useful for the family.
|
|
112
|
+
|
|
113
|
+
> **Credit.** The pipeline shape and defaults follow Mariya Sha's excellent
|
|
114
|
+
> [rag_ollama](https://github.com/MariyaSha/rag_ollama) tutorial
|
|
115
|
+
> ([video](https://youtu.be/oZYlrooPgvs)): Mnemosyne reworks that notebook crash-course
|
|
116
|
+
> into an installable, knowledge-pack-based package (no notebook), keeps its Ollama +
|
|
117
|
+
> LangChain + FAISS stack and tiny-model defaults, and adds the pack framework, CLI, and
|
|
118
|
+
> family scaffolding. Her demo corpus (a delightful "is Lord Elrond secretly Agent Smith?"
|
|
119
|
+
> investigation) lives in her repo; Mnemosyne ships its own Ubiquiti example instead.
|
|
120
|
+
|
|
121
|
+
## 2. How it works
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
INGEST (build the memory)
|
|
125
|
+
documents ─► load ─► chunk ─► embed (Ollama) ─► FAISS index ─► knowledge/<pack>/index.faiss
|
|
126
|
+
(md/pdf/html/txt) (bge-m3) (saved to disk, reusable)
|
|
127
|
+
|
|
128
|
+
ASK (retrieve + generate)
|
|
129
|
+
question ─► embed ─► FAISS top-k search ─► stuff context + question into prompt
|
|
130
|
+
│
|
|
131
|
+
▼
|
|
132
|
+
Ollama LLM (llama3.1 / qwen2.5 …) ─► answer + citations
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Two paths, one index. **Ingest** is run once per corpus (and re-run when docs change);
|
|
136
|
+
it is the slow, expensive part. **Ask** is cheap and local: embed the question, pull the
|
|
137
|
+
nearest chunks out of FAISS, and let a small Ollama model write the answer grounded in
|
|
138
|
+
exactly those chunks. Nothing leaves the machine. If nothing in the index is close enough
|
|
139
|
+
to the question, Ask answers "not in the knowledge base" rather than reaching for unrelated
|
|
140
|
+
chunks: a relevance floor (`MNEMOSYNE_SCORE_FLOOR`, on by default; set it to `none` to
|
|
141
|
+
disable) keeps off-topic questions from getting confident, ungrounded answers.
|
|
142
|
+
|
|
143
|
+
See [`docs/RAG-101.md`](docs/RAG-101.md) for the *why* behind every box, and
|
|
144
|
+
[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for which module owns each one.
|
|
145
|
+
|
|
146
|
+
## 3. Technology
|
|
147
|
+
|
|
148
|
+
| Layer | Choice | Why |
|
|
149
|
+
| --- | --- | --- |
|
|
150
|
+
| **LLM + embeddings** | [Ollama](https://ollama.com) | Local, free, swappable models; one runtime for chat (`qwen2.5:1.5b`) *and* `bge-m3` embeddings. |
|
|
151
|
+
| **Orchestration** | [LangChain](https://www.langchain.com) | Batteries-included loaders, splitters, retrievers, and prompt plumbing: the teaching scaffold. |
|
|
152
|
+
| **Vector store** | [FAISS](https://github.com/facebookresearch/faiss) | Fast, file-based, zero-service similarity search; the index is just a file you can ship. |
|
|
153
|
+
| **Environment** | [mamba](https://github.com/mamba-org/mamba) / conda | Reproducible env that ships FAISS (CPU *and* GPU) from conda-forge; swap one file to go GPU. |
|
|
154
|
+
| **Packaging** | Python 3.11+, `pyproject.toml`, `ruff` | Installable `mnemosyne` package + `mnemosyne` CLI; family lint/CI baseline. |
|
|
155
|
+
|
|
156
|
+
The chat backend is also swappable: set `chat_provider=openai` (env `MNEMOSYNE_CHAT_PROVIDER`)
|
|
157
|
+
and generation can target any OpenAI-compatible server, such as vLLM, llama.cpp's server, or
|
|
158
|
+
LM Studio ([ADR-0009](docs/architecture/adr/0009-selectable-chat-backend.md)). Embeddings stay
|
|
159
|
+
Ollama-only, and the default (`chat_provider=ollama`) is unchanged, so the Ollama row above
|
|
160
|
+
stays accurate as written.
|
|
161
|
+
|
|
162
|
+
> Defaults are tiny and CPU-friendly, following the [rag_ollama](https://github.com/MariyaSha/rag_ollama)
|
|
163
|
+
> tutorial this project is based on: `bge-m3` for embeddings and `qwen2.5:1.5b` for
|
|
164
|
+
> generation, with `chunk_size=500 / chunk_overlap=150 / k=5`. Override per-pack (in a
|
|
165
|
+
> pack's `manifest.yaml`) or globally via `.env`; see [`.env.example`](.env.example).
|
|
166
|
+
|
|
167
|
+
## 4. Quickstart
|
|
168
|
+
|
|
169
|
+
**Prerequisites:** [Ollama](https://ollama.com/download) running locally, and `mamba`:
|
|
170
|
+
the simplest way to get it is [Miniforge](https://github.com/conda-forge/miniforge), which
|
|
171
|
+
bundles conda + mamba with conda-forge preconfigured (plain conda works too).
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# 0. Pull the default models (once)
|
|
175
|
+
ollama pull bge-m3 # embeddings
|
|
176
|
+
ollama pull qwen2.5:1.5b # tiny chat model
|
|
177
|
+
|
|
178
|
+
# 1. Create the environment with mamba and install Mnemosyne
|
|
179
|
+
mamba env create -f environment.yml # GPU? use environment-gpu.yml instead
|
|
180
|
+
mamba activate mnemosyne
|
|
181
|
+
|
|
182
|
+
# 2. Build the memory for a knowledge pack (embeds + indexes its corpus)
|
|
183
|
+
mnemosyne ingest ubiquiti
|
|
184
|
+
|
|
185
|
+
# 3. Ask the expert
|
|
186
|
+
mnemosyne ask ubiquiti "How do I adopt a UniFi switch to a remote controller?"
|
|
187
|
+
|
|
188
|
+
# Or explore interactively (with chat history)
|
|
189
|
+
mnemosyne chat ubiquiti
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
> **No conda?** A bare-pip path works too: `pip install -e ".[dev,cpu]"` (the `cpu` extra
|
|
193
|
+
> pulls `faiss-cpu` from PyPI). The mamba path is preferred because it also unlocks GPU
|
|
194
|
+
> FAISS by swapping in `environment-gpu.yml`; see [ADR-0004](docs/architecture/adr/0004-conda-mamba-environment.md).
|
|
195
|
+
|
|
196
|
+
`ingest` writes a reusable FAISS index under `knowledge/`; `ask` and `chat` load it and
|
|
197
|
+
answer with inline `[source]` citations. List what's available with `mnemosyne packs`.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
mnemosyne packs # list installed knowledge packs and index status
|
|
201
|
+
mnemosyne ingest --help # chunking / embedding-model overrides
|
|
202
|
+
mnemosyne ask --help # top-k, model, show-sources flags
|
|
203
|
+
mnemosyne eval --help # retrieval hit-rate + answer faithfulness against a labelled question set
|
|
204
|
+
mnemosyne sweep --help # chunk-size / k / model sweeps to pick defaults from data
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Use from a coding agent (MCP)
|
|
208
|
+
|
|
209
|
+
Mnemosyne ships an MCP stdio server (`mnemosyne-mcp`) so MCP clients (Claude Code, and the
|
|
210
|
+
agents behind Argus) can ground answers in its packs. A local
|
|
211
|
+
`.mcp.json` registers it; the tools are:
|
|
212
|
+
|
|
213
|
+
- `list_packs`: packs + whether each has a built index
|
|
214
|
+
- `ask(pack, question, k?)`: a grounded answer with cited sources
|
|
215
|
+
- `search(pack, query, k?)`: the top-k raw chunks, to reason over yourself
|
|
216
|
+
|
|
217
|
+
The server honors `MNEMOSYNE_OLLAMA_HOST` from its environment. Because some MCP clients spawn
|
|
218
|
+
servers with a stripped environment, set it explicitly when needed:
|
|
219
|
+
|
|
220
|
+
```jsonc
|
|
221
|
+
// .mcp.json
|
|
222
|
+
{ "mcpServers": { "mnemosyne": { "type": "stdio", "command": "mnemosyne-mcp",
|
|
223
|
+
"env": { "MNEMOSYNE_OLLAMA_HOST": "http://localhost:11434" } } } }
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Use from a web UI or service (HTTP)
|
|
227
|
+
|
|
228
|
+
Web UIs (e.g. an "ask the brain" box in the Argus dashboard) can't speak MCP, so Mnemosyne
|
|
229
|
+
also ships a FastAPI server (`mnemosyne-http`, default `127.0.0.1:8088`):
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
mnemosyne-http # GET /health · GET /packs · POST /ask · POST /search
|
|
233
|
+
curl -s localhost:8088/ask -H 'content-type: application/json' \
|
|
234
|
+
-d '{"pack":"ubiquiti","question":"How do I adopt a switch remotely?"}'
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
`POST /ask` → `{answer, sources[]}`; `POST /search` → `{results[]}`. Intended to be called
|
|
238
|
+
**server-to-server** (e.g. an Argus backend proxies to it), so there's no browser CORS to
|
|
239
|
+
manage. Bind address is `MNEMOSYNE_HTTP_HOST` / `MNEMOSYNE_HTTP_PORT`. Interactive API docs are
|
|
240
|
+
at `/docs`, and the service serves its app icon at `/favicon.svg`.
|
|
241
|
+
|
|
242
|
+
To run it as a managed service (systemd) and let a remote consumer such as Argus reach it over a mesh network, see [`deploy/README.md`](deploy/README.md).
|
|
243
|
+
|
|
244
|
+
## 5. Knowledge packs
|
|
245
|
+
|
|
246
|
+
A **knowledge pack** is a self-contained expert: a corpus plus a small manifest describing
|
|
247
|
+
how to load, chunk, and prompt it. The design deliberately mirrors **Argus vendor packs**
|
|
248
|
+
([ADR-0005](https://github.com/freed-dev-llc/argus/blob/main/docs/architecture/adr/0005-vendor-packs.md)):
|
|
249
|
+
each pack is discovered via a `mnemosyne.knowledge_packs` entry point, so packs can live
|
|
250
|
+
in-tree or ship out-of-tree and independently.
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
src/mnemosyne/packs/ubiquiti/
|
|
254
|
+
├── manifest.yaml # name, models, chunking, sources, system prompt
|
|
255
|
+
├── pack.py # the KnowledgePack implementation (loaders + metadata)
|
|
256
|
+
└── sources/ # URLs / local docs that make up the corpus
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Two packs ship in-tree: **`ubiquiti`** (the technical worked example) and **`general`**, a
|
|
260
|
+
curated corpus of operating principles and decision heuristics, the project-agnostic
|
|
261
|
+
counterpart that grounds *how to decide* rather than *how a technology works*. To build your
|
|
262
|
+
own, copy a pack directory, edit
|
|
263
|
+
the manifest, point it at your docs, and `mnemosyne ingest <yourpack>`. See
|
|
264
|
+
[`docs/KNOWLEDGE_PACKS.md`](docs/KNOWLEDGE_PACKS.md).
|
|
265
|
+
|
|
266
|
+
## 6. Use case: a local brain for Argus
|
|
267
|
+
|
|
268
|
+
[Argus](https://github.com/freed-dev-llc/argus) keeps a network's *truth* in NetBox by
|
|
269
|
+
discovering devices through **vendor packs** (UniFi in-tree today). But discovery answers
|
|
270
|
+
*"what is on the network."* It doesn't answer *"how does this technology actually work,
|
|
271
|
+
and what should I do about it?"* That second question needs an **expert**, and that expert
|
|
272
|
+
needs the vendor's documentation at its fingertips.
|
|
273
|
+
|
|
274
|
+
Mnemosyne is that expert. The plan is to **mirror Argus's vendor packs as Mnemosyne
|
|
275
|
+
knowledge packs**: Argus discovers Ubiquiti, Mnemosyne *explains* Ubiquiti, so an MCP
|
|
276
|
+
agent can ask "Argus, what's on the network?" and "Mnemosyne, how do I fix this UniFi
|
|
277
|
+
adoption loop?" and get grounded answers to both. Ubiquiti is the shared starting point;
|
|
278
|
+
the two repos expand vendor coverage in step. See [`docs/ROADMAP.md`](docs/ROADMAP.md).
|
|
279
|
+
|
|
280
|
+
## 7. Repository layout
|
|
281
|
+
|
|
282
|
+
| Path | What |
|
|
283
|
+
| --- | --- |
|
|
284
|
+
| `src/mnemosyne/` | The pipeline: `loaders`, `chunking`, `embeddings`, `index`, `pipeline`, `prompts`, `cli` |
|
|
285
|
+
| `src/mnemosyne/packs/` | Knowledge-pack framework (`base`, `registry`) + the in-tree `ubiquiti` pack |
|
|
286
|
+
| `docs/` | `RAG-101` (teaching), `ARCHITECTURE`, `KNOWLEDGE_PACKS`, `ROADMAP`, and ADRs |
|
|
287
|
+
| `knowledge/` | Built FAISS indices + raw corpora (gitignored; rebuilt by `ingest`) |
|
|
288
|
+
| `examples/` | Minimal scripts showing the API end-to-end |
|
|
289
|
+
| `tests/` | Pytest suite (chunking, index, pack discovery) |
|
|
290
|
+
| `.github/` | CI, Dependabot, issue/PR templates, CODEOWNERS |
|
|
291
|
+
|
|
292
|
+
## 8. Roadmap
|
|
293
|
+
|
|
294
|
+
Mnemosyne started as a *teaching* pipeline and is growing toward a *useful* one. Full
|
|
295
|
+
detail in [`docs/ROADMAP.md`](docs/ROADMAP.md):
|
|
296
|
+
|
|
297
|
+
- **v0.1: the loop works (shipped).** `ingest` → `ask`/`chat` end-to-end on the Ubiquiti pack with citations.
|
|
298
|
+
- **v0.2: measure it (shipped).** Eval harness (`mnemosyne eval`): retrieval hit-rate and answer faithfulness, with a CI regression gate.
|
|
299
|
+
- **v0.3: serve it (shipped).** MCP (`mnemosyne-mcp`) and HTTP (`mnemosyne-http`) transports so coding agents (e.g. Argus) can call Mnemosyne as a tool.
|
|
300
|
+
- **v0.x: vendor-pack parity with Argus (current).** Maturing the Ubiquiti corpus and expanding knowledge packs in lockstep with Argus discovery.
|
|
301
|
+
|
|
302
|
+
## 9. Contributing
|
|
303
|
+
|
|
304
|
+
This is a personal project run with the discipline of a shared one: changes land via
|
|
305
|
+
**signed-commit pull requests** with a CHANGELOG entry, decisions are captured as
|
|
306
|
+
**ADRs**, and work is tracked in **issues**. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
307
|
+
|
|
308
|
+
## 10. License
|
|
309
|
+
|
|
310
|
+
[Apache-2.0](LICENSE).
|