evret 0.0.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.
Files changed (55) hide show
  1. evret-0.0.1/LICENSE +20 -0
  2. evret-0.0.1/PKG-INFO +348 -0
  3. evret-0.0.1/README.md +270 -0
  4. evret-0.0.1/pyproject.toml +100 -0
  5. evret-0.0.1/setup.cfg +4 -0
  6. evret-0.0.1/src/evret/__init__.py +57 -0
  7. evret-0.0.1/src/evret/errors.py +15 -0
  8. evret-0.0.1/src/evret/evaluation/__init__.py +13 -0
  9. evret-0.0.1/src/evret/evaluation/dataset.py +168 -0
  10. evret-0.0.1/src/evret/evaluation/evaluator.py +224 -0
  11. evret-0.0.1/src/evret/evaluation/judges.py +86 -0
  12. evret-0.0.1/src/evret/evaluation/results.py +63 -0
  13. evret-0.0.1/src/evret/integrations/__init__.py +6 -0
  14. evret-0.0.1/src/evret/integrations/langchain.py +111 -0
  15. evret-0.0.1/src/evret/integrations/llamaindex.py +66 -0
  16. evret-0.0.1/src/evret/judges/__init__.py +21 -0
  17. evret-0.0.1/src/evret/judges/base.py +63 -0
  18. evret-0.0.1/src/evret/judges/llm/__init__.py +7 -0
  19. evret-0.0.1/src/evret/judges/llm/base.py +142 -0
  20. evret-0.0.1/src/evret/judges/llm/factory.py +60 -0
  21. evret-0.0.1/src/evret/judges/llm/prompts.py +21 -0
  22. evret-0.0.1/src/evret/judges/llm/providers/__init__.py +5 -0
  23. evret-0.0.1/src/evret/judges/llm/providers/anthropic.py +80 -0
  24. evret-0.0.1/src/evret/judges/llm/providers/base.py +36 -0
  25. evret-0.0.1/src/evret/judges/llm/providers/google.py +86 -0
  26. evret-0.0.1/src/evret/judges/llm/providers/openai.py +80 -0
  27. evret-0.0.1/src/evret/judges/semantic.py +125 -0
  28. evret-0.0.1/src/evret/judges/token_overlap.py +108 -0
  29. evret-0.0.1/src/evret/judges/utils.py +37 -0
  30. evret-0.0.1/src/evret/metrics/__init__.py +19 -0
  31. evret-0.0.1/src/evret/metrics/_dcg.py +80 -0
  32. evret-0.0.1/src/evret/metrics/_ranking.py +66 -0
  33. evret-0.0.1/src/evret/metrics/_set_ops.py +44 -0
  34. evret-0.0.1/src/evret/metrics/_validation.py +62 -0
  35. evret-0.0.1/src/evret/metrics/average_precision.py +47 -0
  36. evret-0.0.1/src/evret/metrics/base.py +69 -0
  37. evret-0.0.1/src/evret/metrics/hit_rate.py +35 -0
  38. evret-0.0.1/src/evret/metrics/mrr.py +43 -0
  39. evret-0.0.1/src/evret/metrics/ndcg.py +51 -0
  40. evret-0.0.1/src/evret/metrics/precision.py +38 -0
  41. evret-0.0.1/src/evret/metrics/recall.py +39 -0
  42. evret-0.0.1/src/evret/py.typed +1 -0
  43. evret-0.0.1/src/evret/retrievers/__init__.py +16 -0
  44. evret-0.0.1/src/evret/retrievers/base.py +38 -0
  45. evret-0.0.1/src/evret/retrievers/chroma.py +108 -0
  46. evret-0.0.1/src/evret/retrievers/milvus.py +125 -0
  47. evret-0.0.1/src/evret/retrievers/qdrant.py +96 -0
  48. evret-0.0.1/src/evret/retrievers/weaviate.py +198 -0
  49. evret-0.0.1/src/evret/utils.py +91 -0
  50. evret-0.0.1/src/evret.egg-info/PKG-INFO +348 -0
  51. evret-0.0.1/src/evret.egg-info/SOURCES.txt +53 -0
  52. evret-0.0.1/src/evret.egg-info/dependency_links.txt +1 -0
  53. evret-0.0.1/src/evret.egg-info/requires.txt +70 -0
  54. evret-0.0.1/src/evret.egg-info/top_level.txt +1 -0
  55. evret-0.0.1/tests/test_utils.py +61 -0
evret-0.0.1/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kaivid Labs
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 copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
evret-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,348 @@
1
+ Metadata-Version: 2.4
2
+ Name: evret
3
+ Version: 0.0.1
4
+ Summary: A focused retriever evaluation framework with standard ranking metrics.
5
+ Author: Evret Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/kaivid-labs/evret
8
+ Project-URL: Repository, https://github.com/kaivid-labs/evret
9
+ Keywords: retrieval,rag,evaluation,metrics,information-retrieval
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
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
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: qdrant-client>=1.17.1
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
25
+ Provides-Extra: qdrant
26
+ Requires-Dist: qdrant-client>=1.9.0; extra == "qdrant"
27
+ Provides-Extra: chroma
28
+ Requires-Dist: chromadb>=0.5.0; extra == "chroma"
29
+ Provides-Extra: weaviate
30
+ Requires-Dist: weaviate-client>=4.16.0; extra == "weaviate"
31
+ Provides-Extra: milvus
32
+ Requires-Dist: pymilvus>=2.4.0; extra == "milvus"
33
+ Provides-Extra: langchain
34
+ Requires-Dist: langchain>=0.2.0; extra == "langchain"
35
+ Requires-Dist: langchain-community==0.4.1; extra == "langchain"
36
+ Provides-Extra: llamaindex
37
+ Requires-Dist: llama-index-core>=0.10.0; extra == "llamaindex"
38
+ Provides-Extra: semantic
39
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "semantic"
40
+ Provides-Extra: llm-openai
41
+ Requires-Dist: openai>=1.0.0; extra == "llm-openai"
42
+ Provides-Extra: llm-anthropic
43
+ Requires-Dist: anthropic>=0.18.0; extra == "llm-anthropic"
44
+ Provides-Extra: llm-google
45
+ Requires-Dist: google-genai>=1.0.0; extra == "llm-google"
46
+ Provides-Extra: judges
47
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "judges"
48
+ Requires-Dist: openai>=1.0.0; extra == "judges"
49
+ Requires-Dist: anthropic>=0.18.0; extra == "judges"
50
+ Requires-Dist: google-genai>=1.0.0; extra == "judges"
51
+ Provides-Extra: docs
52
+ Requires-Dist: mkdocs>=1.5.0; extra == "docs"
53
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
54
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
55
+ Provides-Extra: all
56
+ Requires-Dist: qdrant-client>=1.9.0; extra == "all"
57
+ Requires-Dist: chromadb>=0.5.0; extra == "all"
58
+ Requires-Dist: weaviate-client>=4.16.0; extra == "all"
59
+ Requires-Dist: pymilvus>=2.4.0; extra == "all"
60
+ Requires-Dist: langchain>=0.2.0; extra == "all"
61
+ Requires-Dist: langchain-community==0.4.1; extra == "all"
62
+ Requires-Dist: llama-index-core>=0.10.0; extra == "all"
63
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "all"
64
+ Requires-Dist: openai>=1.0.0; extra == "all"
65
+ Requires-Dist: anthropic>=0.18.0; extra == "all"
66
+ Requires-Dist: google-genai>=1.0.0; extra == "all"
67
+ Provides-Extra: integration
68
+ Requires-Dist: pytest>=8.0.0; extra == "integration"
69
+ Requires-Dist: qdrant-client>=1.9.0; extra == "integration"
70
+ Requires-Dist: chromadb>=0.5.0; extra == "integration"
71
+ Requires-Dist: weaviate-client>=4.16.0; extra == "integration"
72
+ Requires-Dist: pymilvus>=2.4.0; extra == "integration"
73
+ Requires-Dist: langchain>=0.2.0; extra == "integration"
74
+ Requires-Dist: langchain-community==0.4.1; extra == "integration"
75
+ Requires-Dist: llama-index-core>=0.10.0; extra == "integration"
76
+ Requires-Dist: testcontainers>=4.8.0; extra == "integration"
77
+ Dynamic: license-file
78
+
79
+ <div align="center">
80
+
81
+ # ๐ŸŽฏ Evret
82
+
83
+ **A focused, lightweight retriever evaluation framework with standard Information Retrieval metrics**
84
+
85
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
86
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
87
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
88
+ [![PyPI version](https://img.shields.io/pypi/v/evret)](https://pypi.org/project/evret/)
89
+ [![Tests](https://img.shields.io/badge/tests-passing-brightgreen.svg)](https://github.com/kaivid-labs/evret/actions)
90
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
91
+
92
+ Evret brings standard Information Retrieval metrics to your RAG and search systems. Evaluate retrievers with Hit Rate, Recall, Precision, MRR, NDCG, and Average Precision in just a few lines of code. Built for simplicity, extensibility, and seamless integration with vector databases and AI frameworks.
93
+
94
+ </div>
95
+
96
+ ---
97
+
98
+ ## ๐ŸŒŸ Overview
99
+
100
+ **Evret** is a modern Python framework designed for evaluating retrieval systems in Information Retrieval pipelines and search applications. It provides:
101
+
102
+ - **Standard IR Metrics**: Hit Rate, Recall, Precision, MRR, NDCG, and Average Precision
103
+ - **Judge-Based Matching**: Token overlap, semantic, and LLM judges for text relevance
104
+ - **Vector Database Support**: Native adapters for Qdrant and other vector databases
105
+ - **Framework Integration**: Adapters for LangChain and LlamaIndex
106
+
107
+ ---
108
+
109
+ ## ๐Ÿš€ Quick Start
110
+
111
+ ### Installation
112
+
113
+ ```bash
114
+ pip install evret
115
+ ```
116
+
117
+ For optional integrations:
118
+
119
+ ```bash
120
+ pip install evret[all]
121
+
122
+ # Install specific integrations
123
+ pip install "evret[qdrant]"
124
+ pip install "evret[langchain]"
125
+ pip install "evret[semantic]"
126
+ ```
127
+
128
+ ### 5-Minute Evaluation
129
+
130
+ ```python
131
+ from evret import EvaluationDataset, Evaluator, HitRate, MRR, NDCG, TokenOverlapJudge
132
+
133
+ dataset = EvaluationDataset.from_json("eval_data.json")
134
+
135
+ evaluator = Evaluator(
136
+ retriever=my_retriever,
137
+ metrics=[HitRate(k=4), MRR(k=4), NDCG(k=4)],
138
+ judge=TokenOverlapJudge(min_tokens=2, overlap_ratio=0.6),
139
+ )
140
+
141
+ results = evaluator.evaluate(dataset)
142
+ print(results.summary())
143
+
144
+ # Optional: Export results
145
+ results.to_json("results.json")
146
+ results.to_csv("results.csv")
147
+ ```
148
+
149
+ ---
150
+
151
+ ## ๐Ÿ›  Local Development Setup
152
+
153
+ Use `uv` for local development:
154
+
155
+ ```bash
156
+ uv venv
157
+ source .venv/bin/activate
158
+ uv pip install -e .
159
+ ```
160
+
161
+ Install all optional integrations:
162
+
163
+ ```bash
164
+ uv pip install -e ".[all]"
165
+ ```
166
+
167
+ Run the default test suite:
168
+
169
+ ```bash
170
+ pytest
171
+ ```
172
+
173
+ See [tests/README.md](tests/README.md) for coverage areas, optional integration tests, and test setup notes.
174
+
175
+ ---
176
+
177
+ ## ๐Ÿ“Š Metrics
178
+
179
+ Evret supports all standard Information Retrieval metrics:
180
+
181
+ | Metric | Description | Use Case |
182
+ |--------|-------------|----------|
183
+ | **Hit Rate@k** | % of queries with at least one relevant doc in top-k | Binary relevance, recall-focused |
184
+ | **Recall@k** | % of relevant docs found in top-k | Comprehensive retrieval |
185
+ | **Precision@k** | % of top-k results that are relevant | Precision-focused systems |
186
+ | **MRR@k** | Mean Reciprocal Rank of first relevant doc | Single-answer retrieval |
187
+ | **NDCG@k** | Normalized Discounted Cumulative Gain | Rank-aware binary relevance quality |
188
+ | **Average Precision@k** | Area under precision-recall curve | Overall ranking quality |
189
+
190
+ ---
191
+
192
+ ## ๐Ÿ“‹ Evaluation Datasets
193
+
194
+ Create evaluation datasets with queries and expected answers for judge-based evaluation:
195
+
196
+ ```python
197
+ from evret import EvaluationDataset, QueryExample, DocumentExample
198
+
199
+ dataset = EvaluationDataset(
200
+ documents=[
201
+ DocumentExample(doc_id="doc_1", text="Python uses pip for packages."),
202
+ DocumentExample(doc_id="doc_2", text="Virtual environments isolate dependencies."),
203
+ ],
204
+ queries=[
205
+ QueryExample(
206
+ query_id="q1",
207
+ query_text="How to install Python packages?",
208
+ expected_answers=["pip install"] # Judge matches this against retrieved text
209
+ )
210
+ ]
211
+ )
212
+ ```
213
+
214
+ Load datasets from JSON or CSV files:
215
+
216
+ ```python
217
+ dataset = EvaluationDataset.from_json("eval_data.json")
218
+ dataset = EvaluationDataset.from_csv("eval_data.csv")
219
+ ```
220
+
221
+ For detailed dataset format documentation, classic IR evaluation with document IDs, and more examples, see the [Dataset Format Guide](https://github.com/kaivid-labs/evret/blob/main/docs/evaluation/dataset-format.md)
222
+
223
+ ---
224
+
225
+ ## โš–๏ธ Judges
226
+
227
+ Judges decide whether retrieved text matches the expected text in your evaluation dataset. `Evaluator` uses `TokenOverlapJudge()` by default, and you can pass `judge=` when you want explicit matching behavior.
228
+
229
+ ```python
230
+ from evret import Evaluator, HitRate, Recall
231
+ from evret.judges import TokenOverlapJudge
232
+
233
+ evaluator = Evaluator(
234
+ retriever=my_retriever,
235
+ metrics=[HitRate(k=4), Recall(k=4)],
236
+ judge=TokenOverlapJudge(min_tokens=2, overlap_ratio=0.6),
237
+ )
238
+ ```
239
+
240
+ Use `SemanticJudge` for embedding similarity and `LLMJudge` for LLM-provider based judgment.
241
+
242
+ ```python
243
+ from evret.judges import LLMJudge, SemanticJudge
244
+
245
+ semantic_judge = SemanticJudge(threshold=0.75)
246
+ llm_judge = LLMJudge(provider="openai", model="gpt-4o-mini")
247
+ ```
248
+
249
+ ---
250
+
251
+ ## ๐Ÿ”Œ Integrations
252
+
253
+ ### Qdrant Vector Database
254
+
255
+ ```python
256
+ from evret.retrievers import QdrantRetriever
257
+
258
+ retriever = QdrantRetriever(
259
+ collection_name="docs",
260
+ query_encoder=embed_query,
261
+ url="http://localhost:6333",
262
+ id_field="doc_id",
263
+ )
264
+ ```
265
+
266
+ ### LangChain Integration
267
+
268
+ ```python
269
+ from evret.integrations import LangChainRetrieverAdapter
270
+
271
+ # Wrap any Evret retriever for use in LangChain
272
+ lc_retriever = LangChainRetrieverAdapter(evret_retriever=retriever, k=5)
273
+ docs = lc_retriever.invoke("what is RAG?")
274
+ ```
275
+
276
+ ---
277
+
278
+ ## ๐Ÿงช Testing
279
+
280
+ Run the default suite:
281
+
282
+ ```bash
283
+ pytest
284
+ ```
285
+
286
+ Run Docker-backed integration tests:
287
+
288
+ ```bash
289
+ EVRET_RUN_INTEGRATION=1 pytest -m integration
290
+ ```
291
+
292
+ More details are in [tests/README.md](tests/README.md).
293
+
294
+ ---
295
+
296
+ ## ๐Ÿ“š Documentation
297
+
298
+ Evret docs use MkDocs with Material theme.
299
+
300
+ Install docs dependencies:
301
+
302
+ ```bash
303
+ uv pip install -e ".[docs]"
304
+ ```
305
+
306
+ Run docs locally:
307
+
308
+ ```bash
309
+ mkdocs serve
310
+ ```
311
+
312
+ Build static docs:
313
+
314
+ ```bash
315
+ mkdocs build
316
+ ```
317
+
318
+ ---
319
+
320
+ ## ๐Ÿ“„ License
321
+
322
+ MIT License - see [LICENSE](LICENSE) for details.
323
+
324
+ ---
325
+
326
+ ## ๐Ÿค Contributing
327
+
328
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
329
+
330
+ ---
331
+
332
+ ## ๐Ÿ“š Citation
333
+
334
+ If you use Evret in your research, please cite:
335
+
336
+ ```bibtex
337
+ @software{evret2026,
338
+ title={Evret: A Focused Retriever Evaluation Framework},
339
+ author={lucifertrj},
340
+ year={2026},
341
+ }
342
+ ```
343
+
344
+ ---
345
+
346
+ <div align="center">
347
+ **Built with โค๏ธ for the RAG and IR community**
348
+ </div>
evret-0.0.1/README.md ADDED
@@ -0,0 +1,270 @@
1
+ <div align="center">
2
+
3
+ # ๐ŸŽฏ Evret
4
+
5
+ **A focused, lightweight retriever evaluation framework with standard Information Retrieval metrics**
6
+
7
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
10
+ [![PyPI version](https://img.shields.io/pypi/v/evret)](https://pypi.org/project/evret/)
11
+ [![Tests](https://img.shields.io/badge/tests-passing-brightgreen.svg)](https://github.com/kaivid-labs/evret/actions)
12
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
13
+
14
+ Evret brings standard Information Retrieval metrics to your RAG and search systems. Evaluate retrievers with Hit Rate, Recall, Precision, MRR, NDCG, and Average Precision in just a few lines of code. Built for simplicity, extensibility, and seamless integration with vector databases and AI frameworks.
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## ๐ŸŒŸ Overview
21
+
22
+ **Evret** is a modern Python framework designed for evaluating retrieval systems in Information Retrieval pipelines and search applications. It provides:
23
+
24
+ - **Standard IR Metrics**: Hit Rate, Recall, Precision, MRR, NDCG, and Average Precision
25
+ - **Judge-Based Matching**: Token overlap, semantic, and LLM judges for text relevance
26
+ - **Vector Database Support**: Native adapters for Qdrant and other vector databases
27
+ - **Framework Integration**: Adapters for LangChain and LlamaIndex
28
+
29
+ ---
30
+
31
+ ## ๐Ÿš€ Quick Start
32
+
33
+ ### Installation
34
+
35
+ ```bash
36
+ pip install evret
37
+ ```
38
+
39
+ For optional integrations:
40
+
41
+ ```bash
42
+ pip install evret[all]
43
+
44
+ # Install specific integrations
45
+ pip install "evret[qdrant]"
46
+ pip install "evret[langchain]"
47
+ pip install "evret[semantic]"
48
+ ```
49
+
50
+ ### 5-Minute Evaluation
51
+
52
+ ```python
53
+ from evret import EvaluationDataset, Evaluator, HitRate, MRR, NDCG, TokenOverlapJudge
54
+
55
+ dataset = EvaluationDataset.from_json("eval_data.json")
56
+
57
+ evaluator = Evaluator(
58
+ retriever=my_retriever,
59
+ metrics=[HitRate(k=4), MRR(k=4), NDCG(k=4)],
60
+ judge=TokenOverlapJudge(min_tokens=2, overlap_ratio=0.6),
61
+ )
62
+
63
+ results = evaluator.evaluate(dataset)
64
+ print(results.summary())
65
+
66
+ # Optional: Export results
67
+ results.to_json("results.json")
68
+ results.to_csv("results.csv")
69
+ ```
70
+
71
+ ---
72
+
73
+ ## ๐Ÿ›  Local Development Setup
74
+
75
+ Use `uv` for local development:
76
+
77
+ ```bash
78
+ uv venv
79
+ source .venv/bin/activate
80
+ uv pip install -e .
81
+ ```
82
+
83
+ Install all optional integrations:
84
+
85
+ ```bash
86
+ uv pip install -e ".[all]"
87
+ ```
88
+
89
+ Run the default test suite:
90
+
91
+ ```bash
92
+ pytest
93
+ ```
94
+
95
+ See [tests/README.md](tests/README.md) for coverage areas, optional integration tests, and test setup notes.
96
+
97
+ ---
98
+
99
+ ## ๐Ÿ“Š Metrics
100
+
101
+ Evret supports all standard Information Retrieval metrics:
102
+
103
+ | Metric | Description | Use Case |
104
+ |--------|-------------|----------|
105
+ | **Hit Rate@k** | % of queries with at least one relevant doc in top-k | Binary relevance, recall-focused |
106
+ | **Recall@k** | % of relevant docs found in top-k | Comprehensive retrieval |
107
+ | **Precision@k** | % of top-k results that are relevant | Precision-focused systems |
108
+ | **MRR@k** | Mean Reciprocal Rank of first relevant doc | Single-answer retrieval |
109
+ | **NDCG@k** | Normalized Discounted Cumulative Gain | Rank-aware binary relevance quality |
110
+ | **Average Precision@k** | Area under precision-recall curve | Overall ranking quality |
111
+
112
+ ---
113
+
114
+ ## ๐Ÿ“‹ Evaluation Datasets
115
+
116
+ Create evaluation datasets with queries and expected answers for judge-based evaluation:
117
+
118
+ ```python
119
+ from evret import EvaluationDataset, QueryExample, DocumentExample
120
+
121
+ dataset = EvaluationDataset(
122
+ documents=[
123
+ DocumentExample(doc_id="doc_1", text="Python uses pip for packages."),
124
+ DocumentExample(doc_id="doc_2", text="Virtual environments isolate dependencies."),
125
+ ],
126
+ queries=[
127
+ QueryExample(
128
+ query_id="q1",
129
+ query_text="How to install Python packages?",
130
+ expected_answers=["pip install"] # Judge matches this against retrieved text
131
+ )
132
+ ]
133
+ )
134
+ ```
135
+
136
+ Load datasets from JSON or CSV files:
137
+
138
+ ```python
139
+ dataset = EvaluationDataset.from_json("eval_data.json")
140
+ dataset = EvaluationDataset.from_csv("eval_data.csv")
141
+ ```
142
+
143
+ For detailed dataset format documentation, classic IR evaluation with document IDs, and more examples, see the [Dataset Format Guide](https://github.com/kaivid-labs/evret/blob/main/docs/evaluation/dataset-format.md)
144
+
145
+ ---
146
+
147
+ ## โš–๏ธ Judges
148
+
149
+ Judges decide whether retrieved text matches the expected text in your evaluation dataset. `Evaluator` uses `TokenOverlapJudge()` by default, and you can pass `judge=` when you want explicit matching behavior.
150
+
151
+ ```python
152
+ from evret import Evaluator, HitRate, Recall
153
+ from evret.judges import TokenOverlapJudge
154
+
155
+ evaluator = Evaluator(
156
+ retriever=my_retriever,
157
+ metrics=[HitRate(k=4), Recall(k=4)],
158
+ judge=TokenOverlapJudge(min_tokens=2, overlap_ratio=0.6),
159
+ )
160
+ ```
161
+
162
+ Use `SemanticJudge` for embedding similarity and `LLMJudge` for LLM-provider based judgment.
163
+
164
+ ```python
165
+ from evret.judges import LLMJudge, SemanticJudge
166
+
167
+ semantic_judge = SemanticJudge(threshold=0.75)
168
+ llm_judge = LLMJudge(provider="openai", model="gpt-4o-mini")
169
+ ```
170
+
171
+ ---
172
+
173
+ ## ๐Ÿ”Œ Integrations
174
+
175
+ ### Qdrant Vector Database
176
+
177
+ ```python
178
+ from evret.retrievers import QdrantRetriever
179
+
180
+ retriever = QdrantRetriever(
181
+ collection_name="docs",
182
+ query_encoder=embed_query,
183
+ url="http://localhost:6333",
184
+ id_field="doc_id",
185
+ )
186
+ ```
187
+
188
+ ### LangChain Integration
189
+
190
+ ```python
191
+ from evret.integrations import LangChainRetrieverAdapter
192
+
193
+ # Wrap any Evret retriever for use in LangChain
194
+ lc_retriever = LangChainRetrieverAdapter(evret_retriever=retriever, k=5)
195
+ docs = lc_retriever.invoke("what is RAG?")
196
+ ```
197
+
198
+ ---
199
+
200
+ ## ๐Ÿงช Testing
201
+
202
+ Run the default suite:
203
+
204
+ ```bash
205
+ pytest
206
+ ```
207
+
208
+ Run Docker-backed integration tests:
209
+
210
+ ```bash
211
+ EVRET_RUN_INTEGRATION=1 pytest -m integration
212
+ ```
213
+
214
+ More details are in [tests/README.md](tests/README.md).
215
+
216
+ ---
217
+
218
+ ## ๐Ÿ“š Documentation
219
+
220
+ Evret docs use MkDocs with Material theme.
221
+
222
+ Install docs dependencies:
223
+
224
+ ```bash
225
+ uv pip install -e ".[docs]"
226
+ ```
227
+
228
+ Run docs locally:
229
+
230
+ ```bash
231
+ mkdocs serve
232
+ ```
233
+
234
+ Build static docs:
235
+
236
+ ```bash
237
+ mkdocs build
238
+ ```
239
+
240
+ ---
241
+
242
+ ## ๐Ÿ“„ License
243
+
244
+ MIT License - see [LICENSE](LICENSE) for details.
245
+
246
+ ---
247
+
248
+ ## ๐Ÿค Contributing
249
+
250
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
251
+
252
+ ---
253
+
254
+ ## ๐Ÿ“š Citation
255
+
256
+ If you use Evret in your research, please cite:
257
+
258
+ ```bibtex
259
+ @software{evret2026,
260
+ title={Evret: A Focused Retriever Evaluation Framework},
261
+ author={lucifertrj},
262
+ year={2026},
263
+ }
264
+ ```
265
+
266
+ ---
267
+
268
+ <div align="center">
269
+ **Built with โค๏ธ for the RAG and IR community**
270
+ </div>