retrievalloom 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.
- retrievalloom-0.1.0/LICENSE +201 -0
- retrievalloom-0.1.0/PKG-INFO +378 -0
- retrievalloom-0.1.0/README.md +320 -0
- retrievalloom-0.1.0/pyproject.toml +276 -0
- retrievalloom-0.1.0/pyproject.toml.orig +230 -0
- retrievalloom-0.1.0/src/retrievalloom/__init__.py +197 -0
- retrievalloom-0.1.0/src/retrievalloom/_logging.py +68 -0
- retrievalloom-0.1.0/src/retrievalloom/config.py +392 -0
- retrievalloom-0.1.0/src/retrievalloom/contracts/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/contracts/component.py +119 -0
- retrievalloom-0.1.0/src/retrievalloom/contracts/evidence.py +94 -0
- retrievalloom-0.1.0/src/retrievalloom/contracts/indexes.py +304 -0
- retrievalloom-0.1.0/src/retrievalloom/contracts/infra.py +76 -0
- retrievalloom-0.1.0/src/retrievalloom/contracts/models.py +188 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/base.py +92 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/filters.py +177 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/hashing.py +81 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/inputs.py +269 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/records.py +389 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/reports.py +139 -0
- retrievalloom-0.1.0/src/retrievalloom/domain/retrieval.py +355 -0
- retrievalloom-0.1.0/src/retrievalloom/engine.py +1035 -0
- retrievalloom-0.1.0/src/retrievalloom/errors.py +229 -0
- retrievalloom-0.1.0/src/retrievalloom/evidence/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/evidence/consolidation.py +355 -0
- retrievalloom-0.1.0/src/retrievalloom/evidence/dedup.py +113 -0
- retrievalloom-0.1.0/src/retrievalloom/evidence/fusion.py +243 -0
- retrievalloom-0.1.0/src/retrievalloom/evidence/normalizers.py +144 -0
- retrievalloom-0.1.0/src/retrievalloom/evidence/rerank.py +201 -0
- retrievalloom-0.1.0/src/retrievalloom/evidence/validation.py +102 -0
- retrievalloom-0.1.0/src/retrievalloom/graph/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/graph/ladybug_store.py +482 -0
- retrievalloom-0.1.0/src/retrievalloom/graph/normalizer.py +152 -0
- retrievalloom-0.1.0/src/retrievalloom/graph/retriever.py +125 -0
- retrievalloom-0.1.0/src/retrievalloom/index/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/index/embedding.py +98 -0
- retrievalloom-0.1.0/src/retrievalloom/index/fuzzy.py +318 -0
- retrievalloom-0.1.0/src/retrievalloom/index/keyword.py +159 -0
- retrievalloom-0.1.0/src/retrievalloom/index/memory.py +223 -0
- retrievalloom-0.1.0/src/retrievalloom/index/sparse.py +336 -0
- retrievalloom-0.1.0/src/retrievalloom/index/text.py +285 -0
- retrievalloom-0.1.0/src/retrievalloom/index/vector.py +565 -0
- retrievalloom-0.1.0/src/retrievalloom/infra/__init__.py +14 -0
- retrievalloom-0.1.0/src/retrievalloom/infra/access.py +41 -0
- retrievalloom-0.1.0/src/retrievalloom/infra/cache.py +108 -0
- retrievalloom-0.1.0/src/retrievalloom/infra/metrics.py +27 -0
- retrievalloom-0.1.0/src/retrievalloom/infra/recorders.py +31 -0
- retrievalloom-0.1.0/src/retrievalloom/integrations/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/integrations/agxai.py +160 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/__init__.py +17 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/canonical.py +198 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/coordinator.py +621 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/derivation.py +475 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/indexer.py +925 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/ingestion.py +870 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/purge.py +378 -0
- retrievalloom-0.1.0/src/retrievalloom/lifecycle/units.py +194 -0
- retrievalloom-0.1.0/src/retrievalloom/py.typed +0 -0
- retrievalloom-0.1.0/src/retrievalloom/retrieval/__init__.py +20 -0
- retrievalloom-0.1.0/src/retrievalloom/retrieval/candidates.py +282 -0
- retrievalloom-0.1.0/src/retrievalloom/retrieval/pipeline.py +841 -0
- retrievalloom-0.1.0/src/retrievalloom/retrieval/planning.py +278 -0
- retrievalloom-0.1.0/src/retrievalloom/retrieval/snapshot.py +330 -0
- retrievalloom-0.1.0/src/retrievalloom/runtime/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/runtime/offloader.py +301 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/__init__.py +27 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/base.py +740 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/env.py +31 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/script.py.mako +26 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/versions/0001_initial.py +335 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/versions/0002_retention_indexes.py +35 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/versions/0003_purge_log.py +36 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/versions/0004_incremental_indexing.py +48 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/versions/0005_snapshot_token.py +25 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/migrations/versions/0006_objects_kind_order.py +32 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/postgres.py +318 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/refresh_state.py +83 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/schema.py +398 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/sql.py +2574 -0
- retrievalloom-0.1.0/src/retrievalloom/storage/sqlite.py +182 -0
- retrievalloom-0.1.0/src/retrievalloom/structure/__init__.py +1 -0
- retrievalloom-0.1.0/src/retrievalloom/structure/treesearch_engine.py +438 -0
- retrievalloom-0.1.0/src/retrievalloom/testing/__init__.py +51 -0
- retrievalloom-0.1.0/src/retrievalloom/testing/_base.py +98 -0
- retrievalloom-0.1.0/src/retrievalloom/testing/evidence.py +294 -0
- retrievalloom-0.1.0/src/retrievalloom/testing/indexes.py +477 -0
- retrievalloom-0.1.0/src/retrievalloom/testing/infra.py +39 -0
- retrievalloom-0.1.0/src/retrievalloom/testing/models.py +160 -0
- retrievalloom-0.1.0/src/retrievalloom/testing/storage.py +831 -0
|
@@ -0,0 +1,201 @@
|
|
|
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 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
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: retrievalloom
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An async-first, provider-agnostic, multi-channel retrieval and evidence orchestration engine for Python applications.
|
|
5
|
+
Keywords: retrieval,rag,search,hybrid-search,bm25,vector-search,knowledge-graph,evidence,provenance,asyncio
|
|
6
|
+
Author: S MUNI HARISH
|
|
7
|
+
Author-email: S MUNI HARISH <samamuniharish@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Framework :: AsyncIO
|
|
12
|
+
Classifier: Framework :: Pydantic :: 2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Dist: agxai>=1.0.2,<2
|
|
25
|
+
Requires-Dist: ahocorasick-rs>=1.0.3,<2
|
|
26
|
+
Requires-Dist: aiosqlite>=0.22.1,<1
|
|
27
|
+
Requires-Dist: alembic>=1.20.1,<2
|
|
28
|
+
Requires-Dist: bm25s>=0.3.16,<0.4
|
|
29
|
+
Requires-Dist: cachetools>=6,<9
|
|
30
|
+
Requires-Dist: flashrank>=0.2.10,<0.3
|
|
31
|
+
Requires-Dist: numpy>=2.2
|
|
32
|
+
Requires-Dist: pydantic>=2.14.3,<3
|
|
33
|
+
Requires-Dist: qdrant-client>=1.20.0,<2
|
|
34
|
+
Requires-Dist: ranknexus>=0.1.0,<0.2
|
|
35
|
+
Requires-Dist: rapidfuzz>=3.14.6,<4
|
|
36
|
+
Requires-Dist: refresh-engine>=1.0.0,<2
|
|
37
|
+
Requires-Dist: resourcera>=0.2.0,<0.3
|
|
38
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.1.8,<2.2
|
|
39
|
+
Requires-Dist: structlog>=25.5.0
|
|
40
|
+
Requires-Dist: retrievalloom[graph,structure,postgres] ; extra == 'all'
|
|
41
|
+
Requires-Dist: ladybug>=0.22.3,<0.23 ; extra == 'graph'
|
|
42
|
+
Requires-Dist: asyncpg>=0.30 ; extra == 'postgres'
|
|
43
|
+
Requires-Dist: pytreesearch>=1.1.1,<2 ; extra == 'structure'
|
|
44
|
+
Requires-Dist: pytest>=9.2.0 ; extra == 'testing'
|
|
45
|
+
Requires-Dist: pytest-asyncio>=1.4.1.post1 ; extra == 'testing'
|
|
46
|
+
Requires-Python: >=3.12, <3.15
|
|
47
|
+
Project-URL: Homepage, https://github.com/smuniharish/retrievalloom
|
|
48
|
+
Project-URL: Documentation, https://retrievalloom.readthedocs.io/
|
|
49
|
+
Project-URL: Changelog, https://github.com/smuniharish/retrievalloom/blob/main/CHANGELOG.md
|
|
50
|
+
Project-URL: Issues, https://github.com/smuniharish/retrievalloom/issues
|
|
51
|
+
Project-URL: Repository, https://github.com/smuniharish/retrievalloom
|
|
52
|
+
Provides-Extra: all
|
|
53
|
+
Provides-Extra: graph
|
|
54
|
+
Provides-Extra: postgres
|
|
55
|
+
Provides-Extra: structure
|
|
56
|
+
Provides-Extra: testing
|
|
57
|
+
Description-Content-Type: text/markdown
|
|
58
|
+
|
|
59
|
+
<p align="center">
|
|
60
|
+
<img src="https://raw.githubusercontent.com/smuniharish/retrievalloom/main/docs/assets/logo.svg" alt="RetrievalLoom logo" width="96">
|
|
61
|
+
</p>
|
|
62
|
+
|
|
63
|
+
<h1 align="center">RetrievalLoom</h1>
|
|
64
|
+
|
|
65
|
+
<p align="center">
|
|
66
|
+
<a href="https://github.com/smuniharish/retrievalloom/actions/workflows/ci.yml"><img src="https://github.com/smuniharish/retrievalloom/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
67
|
+
<a href="https://retrievalloom.readthedocs.io/"><img src="https://readthedocs.org/projects/retrievalloom/badge/?version=latest" alt="Documentation"></a>
|
|
68
|
+
<a href="https://pypi.org/project/retrievalloom/"><img src="https://img.shields.io/pypi/v/retrievalloom.svg" alt="PyPI"></a>
|
|
69
|
+
<a href="https://pypi.org/project/retrievalloom/"><img src="https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-blue.svg" alt="Python 3.12 | 3.13 | 3.14"></a>
|
|
70
|
+
<img src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg" alt="Coverage 100%">
|
|
71
|
+
<img src="https://img.shields.io/badge/typing-typed-blue.svg" alt="Typed">
|
|
72
|
+
<a href="https://github.com/smuniharish/retrievalloom/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
|
|
73
|
+
</p>
|
|
74
|
+
|
|
75
|
+
**Find the right passage, whatever the user types, and prove where it came from.**
|
|
76
|
+
|
|
77
|
+
RetrievalLoom is a hybrid retrieval library for async Python applications. One
|
|
78
|
+
call searches your documents by exact keyword, by spelling-tolerant match, by
|
|
79
|
+
term relevance (BM25) and by meaning, and merges the results into one ranked
|
|
80
|
+
list. Every result tells you which document, which version and which passage it
|
|
81
|
+
came from. It runs inside your application: there is no separate service to
|
|
82
|
+
deploy.
|
|
83
|
+
|
|
84
|
+
<p align="center">
|
|
85
|
+
<img src="https://raw.githubusercontent.com/smuniharish/retrievalloom/main/docs/assets/diagrams/architecture-overview.png" alt="RetrievalLoom architecture: your application ingests documents and sends queries to the engine, which keeps the metadata store and the index, graph and structure channels in step and returns ranked, cited evidence" width="720">
|
|
86
|
+
</p>
|
|
87
|
+
|
|
88
|
+
## Why RetrievalLoom
|
|
89
|
+
|
|
90
|
+
Picture a support assistant for a software product. In one hour it has to
|
|
91
|
+
answer:
|
|
92
|
+
|
|
93
|
+
- "What does error `E1042` mean?" — an exact code that semantic search blurs.
|
|
94
|
+
- "How do I fix a conflcted copy?" — a typo that exact search misses.
|
|
95
|
+
- "How do I get my money back?" — a paraphrase of an article titled "Refunding
|
|
96
|
+
a card payment" that shares no words with it.
|
|
97
|
+
|
|
98
|
+
No single search method handles all three. Real deployments add more demands:
|
|
99
|
+
articles change every day, each customer must see only their own content, and
|
|
100
|
+
every answer must cite its source.
|
|
101
|
+
|
|
102
|
+
| What you need | What RetrievalLoom gives you |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| Match codes, typos and paraphrases | Keyword, fuzzy, BM25 and vector search run together, and their rankings are fused into one list. Optional graph and section-tree search join the same list. |
|
|
105
|
+
| Search results that stay correct as content changes | Edits and deletions reach every index automatically. A search never mixes an old and a new version of a document, and never reads a half-built index. |
|
|
106
|
+
| Answers you can cite and audit | Each result names its document and version, lists the search methods that found it, and carries the character span, pages and section path you supplied. |
|
|
107
|
+
| Many customers on one deployment | Every call is scoped to a tenant and collection. A result from another tenant is an error, never a silent leak. Per-tenant limits keep one busy customer from slowing the rest. |
|
|
108
|
+
| A responsive async service | Model inference and index work run in worker threads with admission control, so your event loop keeps serving requests. |
|
|
109
|
+
|
|
110
|
+
## Highlights
|
|
111
|
+
|
|
112
|
+
- **Useful with zero setup.** `RetrievalEngine()` runs in memory with keyword,
|
|
113
|
+
fuzzy and BM25 search. No model download, server or network access.
|
|
114
|
+
- **Add what you need.** Plug in an embedding model for semantic search, a
|
|
115
|
+
reranker for precision at the top, or an NLI model that flags passages which
|
|
116
|
+
contradict a claim.
|
|
117
|
+
- **Your content, your chunks.** Send plain text, your own chunks with spans and
|
|
118
|
+
pages, a section outline, or a knowledge graph.
|
|
119
|
+
- **Indexes that look after themselves.** New and edited documents are indexed
|
|
120
|
+
incrementally. Adding a search method backfills existing documents, and
|
|
121
|
+
changing an embedding model rebuilds its index without interrupting searches.
|
|
122
|
+
- **Durable when you need it.** Keep metadata in SQLite or PostgreSQL and
|
|
123
|
+
vectors in Qdrant (in memory, on disk, on a server or in Qdrant Cloud).
|
|
124
|
+
Several engines can share one store.
|
|
125
|
+
- **Your own components.** Swap in your own embedding model, reranker, vector
|
|
126
|
+
store or metadata store by subclassing a small base class. The pytest
|
|
127
|
+
contract kits in `retrievalloom.testing` check your implementation against
|
|
128
|
+
the same tests the built-in components pass.
|
|
129
|
+
- **Small and typed.** An async API with type hints throughout, structured
|
|
130
|
+
logging with structlog, and 100% branch coverage on Python 3.12 to 3.14.
|
|
131
|
+
|
|
132
|
+
## Installation
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip install retrievalloom # core: in-memory engine, Qdrant client, FlashRank
|
|
136
|
+
pip install "retrievalloom[all]" # plus the graph and structure channels and PostgreSQL
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
RetrievalLoom supports Python 3.12, 3.13 and 3.14. Optional extras:
|
|
140
|
+
|
|
141
|
+
| Extra | Adds |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| `graph` | The graph channel with LadybugDB (`LadybugGraphStore`) |
|
|
144
|
+
| `structure` | The structure channel with TreeSearch (`TreeSearchStructureEngine`) |
|
|
145
|
+
| `postgres` | The PostgreSQL metadata store (`PostgresMetadataStore`), shared by engines on several hosts |
|
|
146
|
+
| `testing` | The pytest contract kits in `retrievalloom.testing` |
|
|
147
|
+
| `all` | `graph`, `structure` and `postgres` |
|
|
148
|
+
|
|
149
|
+
The library prints nothing by default. To see its log events, call
|
|
150
|
+
`logging.basicConfig(level=logging.INFO)` or configure structlog; see
|
|
151
|
+
[Logging](https://retrievalloom.readthedocs.io/en/latest/getting-started/installation/#logging).
|
|
152
|
+
|
|
153
|
+
## Quickstart
|
|
154
|
+
|
|
155
|
+
Index three documents in memory and search them. No model or server is needed:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
import asyncio
|
|
159
|
+
|
|
160
|
+
from retrievalloom import (
|
|
161
|
+
DocumentInput,
|
|
162
|
+
RetrievalEngine,
|
|
163
|
+
Scope,
|
|
164
|
+
SourceDescriptor,
|
|
165
|
+
TextRepresentation,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
TEXTS = {
|
|
169
|
+
"asyncio": "asyncio runs coroutines on a single-threaded event loop.",
|
|
170
|
+
"bm25": "BM25 ranks documents by term frequency and inverse document frequency.",
|
|
171
|
+
"eiffel": "The Eiffel Tower in Paris was completed in 1889.",
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
async def main() -> None:
|
|
176
|
+
scope = Scope(tenant_id="acme")
|
|
177
|
+
documents = [
|
|
178
|
+
DocumentInput(
|
|
179
|
+
id=key,
|
|
180
|
+
source=SourceDescriptor(uri=f"kb://{key}"),
|
|
181
|
+
representations=[TextRepresentation(text=text)],
|
|
182
|
+
)
|
|
183
|
+
for key, text in TEXTS.items()
|
|
184
|
+
]
|
|
185
|
+
async with RetrievalEngine() as engine:
|
|
186
|
+
report = await engine.ingest(documents, scope=scope)
|
|
187
|
+
print("ingested:", [item.outcome.value for item in report.documents])
|
|
188
|
+
|
|
189
|
+
result = await engine.retrieve("event loop coroutines", scope=scope, top_k=3)
|
|
190
|
+
print("status:", result.status.value)
|
|
191
|
+
for item in result.evidence:
|
|
192
|
+
source = item.sources[0]
|
|
193
|
+
methods = sorted({hit.method.key for hit in item.provenance.hits})
|
|
194
|
+
print(f"{source.document_id} v{source.document_version} {item.score:.4f} {methods}")
|
|
195
|
+
print(" ", item.display_text)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
asyncio.run(main())
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Output:
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
ingested: ['created', 'created', 'created']
|
|
205
|
+
status: complete
|
|
206
|
+
asyncio v1 0.0164 ['index.fuzzy', 'index.sparse']
|
|
207
|
+
asyncio runs coroutines on a single-threaded event loop.
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Each result names the document and version it came from, and the search
|
|
211
|
+
methods that found it. Documents are searchable as soon as `ingest` returns.
|
|
212
|
+
`result.warnings` tells you about anything the engine skipped, such as semantic
|
|
213
|
+
search when no embedding model is configured. The
|
|
214
|
+
[Quickstart](https://retrievalloom.readthedocs.io/en/latest/getting-started/quickstart/)
|
|
215
|
+
walks through the program step by step.
|
|
216
|
+
|
|
217
|
+
### Your own embedding model
|
|
218
|
+
|
|
219
|
+
Add semantic search with any embedding model. Subclass `EmbeddingModelABC` and
|
|
220
|
+
hand the blocking model call to the worker pool the engine gives you
|
|
221
|
+
(`context.offloader`), so your event loop keeps serving requests:
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
from collections.abc import Callable, Sequence
|
|
225
|
+
|
|
226
|
+
from retrievalloom import Components, RetrievalEngine
|
|
227
|
+
from retrievalloom.contracts.component import ComponentContext, ComponentInfo, make_info
|
|
228
|
+
from retrievalloom.contracts.models import EmbeddingModelABC
|
|
229
|
+
from retrievalloom.runtime.offloader import WorkloadKind
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class MyEmbedding(EmbeddingModelABC):
|
|
233
|
+
def __init__(self, encode: Callable[[list[str]], list[list[float]]], dimensions: int) -> None:
|
|
234
|
+
self._encode = encode # a blocking call, such as your model's encode()
|
|
235
|
+
self._dimensions = dimensions
|
|
236
|
+
self._info = make_info(
|
|
237
|
+
component="embedding",
|
|
238
|
+
implementation="my-embedding",
|
|
239
|
+
version="1",
|
|
240
|
+
model_identity="my-org/my-model",
|
|
241
|
+
dimensions=dimensions,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
@property
|
|
245
|
+
def info(self) -> ComponentInfo:
|
|
246
|
+
return self._info
|
|
247
|
+
|
|
248
|
+
@property
|
|
249
|
+
def dimensions(self) -> int:
|
|
250
|
+
return self._dimensions
|
|
251
|
+
|
|
252
|
+
async def initialize(self, context: ComponentContext) -> None:
|
|
253
|
+
self._offloader = context.offloader
|
|
254
|
+
|
|
255
|
+
async def embed_documents(self, texts: Sequence[str]) -> Sequence[Sequence[float]]:
|
|
256
|
+
return await self._offloader.run(WorkloadKind.EMBEDDING, self._encode, list(texts))
|
|
257
|
+
|
|
258
|
+
async def embed_query(self, text: str) -> Sequence[float]:
|
|
259
|
+
(vector,) = await self._offloader.run(WorkloadKind.EMBEDDING, self._encode, [text])
|
|
260
|
+
return vector
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
engine = RetrievalEngine(components=Components(embedding=MyEmbedding(model.encode, 1024)))
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
With an embedding model configured, every search also runs a vector (dense)
|
|
267
|
+
search. When you later change `model_identity`, the engine builds a new vector
|
|
268
|
+
index and switches to it once it is complete. Searches keep using the old index
|
|
269
|
+
until then. See
|
|
270
|
+
[Use your own embedding model](https://retrievalloom.readthedocs.io/en/latest/guide/how-to/embedding-model/).
|
|
271
|
+
|
|
272
|
+
### Your own stores
|
|
273
|
+
|
|
274
|
+
By default everything lives in memory. Pass durable stores to keep your data
|
|
275
|
+
across restarts:
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
from retrievalloom import Components, RetrievalEngine
|
|
279
|
+
from retrievalloom.index.vector import QdrantVectorStore
|
|
280
|
+
from retrievalloom.storage.sqlite import SQLiteMetadataStore
|
|
281
|
+
|
|
282
|
+
components = Components(
|
|
283
|
+
embedding=MyEmbedding(model.encode, 1024),
|
|
284
|
+
metadata_store=SQLiteMetadataStore("var/metadata.db"),
|
|
285
|
+
vector_store=QdrantVectorStore(url="http://localhost:6333"),
|
|
286
|
+
)
|
|
287
|
+
engine = RetrievalEngine(components=components)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
To run engines on several hosts, use `PostgresMetadataStore` (`postgres` extra)
|
|
291
|
+
instead of a SQLite file. To use another database, subclass
|
|
292
|
+
`DocumentMetadataStoreABC` or `VectorStoreABC` and check your class with
|
|
293
|
+
`MetadataStoreContract` or `VectorStoreContract` from `retrievalloom.testing`.
|
|
294
|
+
The engine opens the components you pass in but leaves closing them to you. See
|
|
295
|
+
[Keep data on disk](https://retrievalloom.readthedocs.io/en/latest/guide/how-to/durable-storage/)
|
|
296
|
+
and [Write your own backend](https://retrievalloom.readthedocs.io/en/latest/guide/how-to/custom-backends/).
|
|
297
|
+
|
|
298
|
+
## Benchmarks
|
|
299
|
+
|
|
300
|
+
`scripts/benchmark.py` measures ingest throughput, search latency and
|
|
301
|
+
event-loop lag with the default in-memory components. See
|
|
302
|
+
[Benchmarks](https://retrievalloom.readthedocs.io/en/latest/benchmarks/)
|
|
303
|
+
for the method, the results and how to reproduce them.
|
|
304
|
+
|
|
305
|
+
## Examples
|
|
306
|
+
|
|
307
|
+
Each program in [`examples/`](https://github.com/smuniharish/retrievalloom/tree/main/examples)
|
|
308
|
+
models a real deployment, and the test suite runs it and checks its output.
|
|
309
|
+
[`examples/adapters/`](https://retrievalloom.readthedocs.io/en/latest/examples/adapters/)
|
|
310
|
+
holds production-style custom components you can copy, from bge-m3 embeddings
|
|
311
|
+
to a Neo4j graph store:
|
|
312
|
+
|
|
313
|
+
| Example | Shows | Needs |
|
|
314
|
+
| --- | --- | --- |
|
|
315
|
+
| [`quickstart.py`](https://retrievalloom.readthedocs.io/en/latest/examples/quickstart/) | Index and search three documents in memory | Base install |
|
|
316
|
+
| [`customer_support.py`](https://retrievalloom.readthedocs.io/en/latest/examples/customer-support/) | Help-center search that handles typos, jargon, German and paraphrases, with reranking and filters | Local models, Qdrant |
|
|
317
|
+
| [`multi_tenant_saas.py`](https://retrievalloom.readthedocs.io/en/latest/examples/multi-tenant-saas/) | One engine for many customers: isolation, role-based access, quotas and an audit log | Base install |
|
|
318
|
+
| [`document_lifecycle.py`](https://retrievalloom.readthedocs.io/en/latest/examples/document-lifecycle/) | Edit, delete and erase documents, add semantic search later, and change models | Local models, pgvector |
|
|
319
|
+
| [`knowledge_graph.py`](https://retrievalloom.readthedocs.io/en/latest/examples/knowledge-graph/) | Answer relationship questions from a knowledge graph built at ingest, on Neo4j or LadybugDB | `graph` extra; Neo4j optional |
|
|
320
|
+
| [`policy_manual.py`](https://retrievalloom.readthedocs.io/en/latest/examples/policy-manual/) | Search a long policy by section and cite the section path | `structure` extra |
|
|
321
|
+
| [`fact_checking.py`](https://retrievalloom.readthedocs.io/en/latest/examples/fact-checking/) | Check a claim against your documents and flag contradicting passages | Local models |
|
|
322
|
+
| [`http_service.py`](https://retrievalloom.readthedocs.io/en/latest/examples/http-service/) | Serve search over HTTP with FastAPI, with a Postman collection | `examples` group |
|
|
323
|
+
| [`observability_jaeger.py`](https://retrievalloom.readthedocs.io/en/latest/examples/observability-jaeger/) | Trace each request in Jaeger and find its log lines by trace id | `examples` group; Jaeger optional |
|
|
324
|
+
| [`durable_restart.py`](https://retrievalloom.readthedocs.io/en/latest/examples/durable-restart/) | Restart a service without re-ingesting or re-embedding | Local models, Qdrant |
|
|
325
|
+
| [`prechunked_and_multi_representation.py`](https://retrievalloom.readthedocs.io/en/latest/examples/prechunked-and-multi-representation/) | Index your own chunks with spans and pages, plus a section outline | `structure` extra |
|
|
326
|
+
| [`agxai_provenance.py`](https://retrievalloom.readthedocs.io/en/latest/examples/agxai-provenance/) | Record every ingestion, deletion and search in an agxai audit trail | Base install |
|
|
327
|
+
|
|
328
|
+
## Documentation
|
|
329
|
+
|
|
330
|
+
Full documentation: **[retrievalloom.readthedocs.io](https://retrievalloom.readthedocs.io/)**
|
|
331
|
+
|
|
332
|
+
- [Getting started](https://retrievalloom.readthedocs.io/en/latest/getting-started/)
|
|
333
|
+
- [User guide](https://retrievalloom.readthedocs.io/en/latest/guide/)
|
|
334
|
+
- [Integrations](https://retrievalloom.readthedocs.io/en/latest/integrations/)
|
|
335
|
+
- [Examples](https://retrievalloom.readthedocs.io/en/latest/examples/)
|
|
336
|
+
- [Architecture](https://retrievalloom.readthedocs.io/en/latest/architecture/)
|
|
337
|
+
- [API reference](https://retrievalloom.readthedocs.io/en/latest/api/)
|
|
338
|
+
|
|
339
|
+
Changes are listed in the
|
|
340
|
+
[changelog](https://github.com/smuniharish/retrievalloom/blob/main/CHANGELOG.md).
|
|
341
|
+
|
|
342
|
+
## Agent skills
|
|
343
|
+
|
|
344
|
+
Let your AI coding assistant build with RetrievalLoom correctly. Two
|
|
345
|
+
[Agent Skills](https://retrievalloom.readthedocs.io/en/latest/agent-skills/) teach
|
|
346
|
+
Claude Code, Codex, Cursor, GitHub Copilot and other compatible agents how to
|
|
347
|
+
use the library: `retrievalloom` adds it to your application, and
|
|
348
|
+
`retrievalloom-extend` helps you connect your own models and stores. Install
|
|
349
|
+
them with the [skills CLI](https://github.com/vercel-labs/skills):
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
npx skills add smuniharish/retrievalloom # choose interactively
|
|
353
|
+
npx skills add smuniharish/retrievalloom --skill retrievalloom # only the core skill
|
|
354
|
+
npx skills add smuniharish/retrievalloom --skill retrievalloom-extend # only the extension skill
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
See [Install the skills](https://retrievalloom.readthedocs.io/en/latest/agent-skills/install/)
|
|
358
|
+
for manual and per-agent installation.
|
|
359
|
+
|
|
360
|
+
## Scope
|
|
361
|
+
|
|
362
|
+
RetrievalLoom is a retrieval library. It does not parse files, split text into
|
|
363
|
+
chunks, host models or orchestrate agents; use it alongside the tools you
|
|
364
|
+
already have for those jobs. It does not depend on LangChain, LlamaIndex or any
|
|
365
|
+
other framework.
|
|
366
|
+
|
|
367
|
+
## Contributing
|
|
368
|
+
|
|
369
|
+
Contributions are welcome. See
|
|
370
|
+
[CONTRIBUTING.md](https://github.com/smuniharish/retrievalloom/blob/main/CONTRIBUTING.md)
|
|
371
|
+
for the development setup and checks, and
|
|
372
|
+
[SECURITY.md](https://github.com/smuniharish/retrievalloom/blob/main/SECURITY.md)
|
|
373
|
+
to report a vulnerability.
|
|
374
|
+
|
|
375
|
+
## License
|
|
376
|
+
|
|
377
|
+
Apache License 2.0. See
|
|
378
|
+
[LICENSE](https://github.com/smuniharish/retrievalloom/blob/main/LICENSE).
|