Spaces:
Paused
Paused
Commit ·
ca19369
1
Parent(s): a886455
fix: increase top_k to 10 and remove last [N] from verification prompt
Browse filesTwo fixes:
1. Increased default top_k from 5 to 10. With top_k=5, short queries
like "China in 2024?" missed the relevant page (e.g., page 410)
because generic intro pages ranked higher. More chunks = better
chance of retrieving the right content.
2. Removed the last literal [N] from the verification prompt template
(checklist item 1) to prevent any residual [N] in output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- README.md +1 -1
- setup.py +1 -1
- src/prompts.py +1 -1
- src/retriever.py +1 -1
README.md
CHANGED
|
@@ -346,7 +346,7 @@ embeddings:
|
|
| 346 |
retrieval:
|
| 347 |
chunk_size: 1000 # Characters per chunk (when splitting documents)
|
| 348 |
chunk_overlap: 100 # Overlap between chunks (preserves context)
|
| 349 |
-
top_k:
|
| 350 |
|
| 351 |
web_search:
|
| 352 |
enabled: true # true | false
|
|
|
|
| 346 |
retrieval:
|
| 347 |
chunk_size: 1000 # Characters per chunk (when splitting documents)
|
| 348 |
chunk_overlap: 100 # Overlap between chunks (preserves context)
|
| 349 |
+
top_k: 10 # Number of chunks to retrieve per query
|
| 350 |
|
| 351 |
web_search:
|
| 352 |
enabled: true # true | false
|
setup.py
CHANGED
|
@@ -48,7 +48,7 @@ def generate_config(
|
|
| 48 |
"retrieval": {
|
| 49 |
"chunk_size": 1000,
|
| 50 |
"chunk_overlap": 100,
|
| 51 |
-
"top_k":
|
| 52 |
},
|
| 53 |
"web_search": {
|
| 54 |
"enabled": web_search,
|
|
|
|
| 48 |
"retrieval": {
|
| 49 |
"chunk_size": 1000,
|
| 50 |
"chunk_overlap": 100,
|
| 51 |
+
"top_k": 10,
|
| 52 |
},
|
| 53 |
"web_search": {
|
| 54 |
"enabled": web_search,
|
src/prompts.py
CHANGED
|
@@ -94,7 +94,7 @@ problems.
|
|
| 94 |
|
| 95 |
Run through this 9-point verification checklist and report results:
|
| 96 |
|
| 97 |
-
1. Does every factual claim have a citation [
|
| 98 |
2. Are all citations grounded in the provided context?
|
| 99 |
3. Are there any claims that appear fabricated or hallucinated?
|
| 100 |
4. Are direct quotes accurately reproduced from the context?
|
|
|
|
| 94 |
|
| 95 |
Run through this 9-point verification checklist and report results:
|
| 96 |
|
| 97 |
+
1. Does every factual claim have a numbered citation endnote (e.g. [1], [2])?
|
| 98 |
2. Are all citations grounded in the provided context?
|
| 99 |
3. Are there any claims that appear fabricated or hallucinated?
|
| 100 |
4. Are direct quotes accurately reproduced from the context?
|
src/retriever.py
CHANGED
|
@@ -14,7 +14,7 @@ def retrieve_from_vectordb(query: str, cfg: dict) -> list[dict]:
|
|
| 14 |
"""Retrieve relevant chunks from ChromaDB."""
|
| 15 |
from src.ingest import get_chroma_collection
|
| 16 |
|
| 17 |
-
top_k = cfg.get("retrieval", {}).get("top_k",
|
| 18 |
collection = get_chroma_collection(cfg)
|
| 19 |
|
| 20 |
if collection.count() == 0:
|
|
|
|
| 14 |
"""Retrieve relevant chunks from ChromaDB."""
|
| 15 |
from src.ingest import get_chroma_collection
|
| 16 |
|
| 17 |
+
top_k = cfg.get("retrieval", {}).get("top_k", 10)
|
| 18 |
collection = get_chroma_collection(cfg)
|
| 19 |
|
| 20 |
if collection.count() == 0:
|