diff --git a/CHANGELOG.md b/CHANGELOG.md index 55fd690f..e583a592 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Changed - Unknown `reranking.model.provider` raises `ValueError` instead of silently disabling reranking. +- `search.max_context_chars` default lowered from 10000 to 5000. ### Removed diff --git a/docs/configuration/index.md b/docs/configuration/index.md index 5fc39eb7..a7e37d1f 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -110,7 +110,7 @@ qa: search: limit: 10 # Default number of results to return - max_context_chars: 10000 # Maximum characters in expanded context + max_context_chars: 5000 # Maximum characters in expanded context vector_index_metric: cosine # cosine, l2, or dot vector_refine_factor: 30 diff --git a/docs/configuration/qa.md b/docs/configuration/qa.md index ac7e61d9..0e7fd94b 100644 --- a/docs/configuration/qa.md +++ b/docs/configuration/qa.md @@ -7,11 +7,11 @@ Configure search behavior and context expansion: ```yaml search: limit: 10 # Default number of results to return - max_context_chars: 10000 # Maximum characters in expanded context + max_context_chars: 5000 # Maximum characters in expanded context ``` - **limit**: Default number of search results to return when no limit is specified. Used by CLI, MCP server, and QA. Default: 10 -- **max_context_chars**: Hard limit on total characters in expanded content. Default: 10000. +- **max_context_chars**: Hard limit on total characters in expanded content. Default: 5000. Context expansion is automatic and section-aware. For structured documents (with section headers), expansion includes the entire section containing the match. For sections that exceed the budget or are too small (e.g., a title+authors area), expansion grows outward item-by-item from the match center, skipping noise labels (footnotes, page headers). This naturally crosses into adjacent sections until the budget is filled. Picture and table matches are exempt: they return their enclosing section as-is and never cross section boundaries. For unstructured documents, expansion grows outward item-by-item. Results without `doc_item_refs` (e.g., custom chunks passed to `import_document`) pass through unexpanded. diff --git a/docs/python.md b/docs/python.md index 38308424..c4aa1507 100644 --- a/docs/python.md +++ b/docs/python.md @@ -302,7 +302,7 @@ Context expansion is automatic and section-aware. For structured documents (with Configuration: -- **search.max_context_chars**: Maximum characters in expanded context. Default: 10000. +- **search.max_context_chars**: Maximum characters in expanded context. Default: 5000. **Smart Merging**: When expanded results overlap within the same document, they are automatically merged into a single result with continuous content and the highest relevance score. diff --git a/docs/skills/rag.md b/docs/skills/rag.md index 41accf0b..826f4f70 100644 --- a/docs/skills/rag.md +++ b/docs/skills/rag.md @@ -165,7 +165,7 @@ qa: search: limit: 5 - max_context_chars: 10000 + max_context_chars: 5000 ``` See [Search and question answering](../configuration/qa.md) for every knob. diff --git a/haiku_rag_slim/haiku/rag/config/models.py b/haiku_rag_slim/haiku/rag/config/models.py index c2e79804..e9d429c6 100644 --- a/haiku_rag_slim/haiku/rag/config/models.py +++ b/haiku_rag_slim/haiku/rag/config/models.py @@ -229,7 +229,7 @@ class ProcessingConfig(BaseModel): class SearchConfig(BaseModel): limit: int = 5 - max_context_chars: int = 10000 + max_context_chars: int = 5000 vector_index_metric: Literal["cosine", "l2", "dot"] = "cosine" vector_refine_factor: int = 30