Improve judge prompt, QA prompt, and raise max_searches to 5
This commit is contained in:
parent
e92f4774fa
commit
75c84805b4
7 changed files with 14 additions and 11 deletions
|
|
@ -10,6 +10,9 @@
|
|||
|
||||
- **Database migration required**: Run `haiku-rag migrate` to populate `document_items` table for existing documents
|
||||
- **Pin docling-core**: Upper bound added (`<2.72`) to prevent uncontrolled schema changes
|
||||
- **`max_searches` default**: Raised from 3 to 5 — faster expansion makes additional searches inexpensive
|
||||
- **Improved QA prompt**: Stronger instruction to refuse answering from tangentially related content
|
||||
- **Improved judge prompt**: Asymmetric evaluation — generated answers that are more comprehensive than expected are not penalized
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ research:
|
|||
search:
|
||||
limit: 10 # Default number of results to return
|
||||
max_context_items: 10 # Maximum items in expanded context
|
||||
max_context_chars: 5000 # Maximum characters in expanded context
|
||||
max_context_chars: 10000 # Maximum characters in expanded context
|
||||
vector_index_metric: cosine # cosine, l2, or dot
|
||||
vector_refine_factor: 30
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ Configure search behavior and context expansion:
|
|||
search:
|
||||
limit: 10 # Default number of results to return
|
||||
max_context_items: 10 # Maximum items in expanded context
|
||||
max_context_chars: 5000 # Maximum characters in expanded context
|
||||
max_context_chars: 10000 # Maximum characters in expanded context
|
||||
```
|
||||
|
||||
- **limit**: Default number of search results to return when no limit is specified. Used by CLI, MCP server, QA, and research workflows. Default: 10
|
||||
- **max_context_items**: Limits how many document items (paragraphs, list items, etc.) can be included in expanded context. Default: 10.
|
||||
- **max_context_chars**: Hard limit on total characters in expanded content. Default: 5000.
|
||||
- **max_context_chars**: Hard limit on total characters in expanded content. Default: 10000.
|
||||
|
||||
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. 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.
|
||||
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ Context expansion is automatic and section-aware. For structured documents (with
|
|||
Configuration:
|
||||
|
||||
- **search.max_context_items**: Maximum items in expanded context. Default: 10.
|
||||
- **search.max_context_chars**: Maximum characters in expanded context. Default: 5000.
|
||||
- **search.max_context_chars**: Maximum characters in expanded context. Default: 10000.
|
||||
|
||||
**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.
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ Guidelines:
|
|||
- Base answers strictly on retrieved content - do not use external knowledge
|
||||
- Use the Source and Type metadata to understand context
|
||||
- If multiple results are relevant, synthesize them coherently
|
||||
- If information is insufficient, say: "I cannot find enough information in the knowledge base to answer this question."
|
||||
- Be concise and direct - avoid elaboration unless asked
|
||||
- Results are ordered by relevance, with rank 1 being most relevant
|
||||
- If the search tool tells you the search limit is reached, stop searching immediately and answer with what you have
|
||||
- If the retrieved documents do not directly address the question, say: "I cannot find enough information in the knowledge base to answer this question." Do not guess or infer an answer from tangentially related content.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class QAConfig(BaseModel):
|
|||
temperature=0.3,
|
||||
)
|
||||
)
|
||||
max_searches: int = 3
|
||||
max_searches: int = 5
|
||||
|
||||
|
||||
class ResearchConfig(BaseModel):
|
||||
|
|
@ -175,7 +175,7 @@ class ProcessingConfig(BaseModel):
|
|||
class SearchConfig(BaseModel):
|
||||
limit: int = 10
|
||||
max_context_items: int = 10
|
||||
max_context_chars: int = 5000
|
||||
max_context_chars: int = 10000
|
||||
vector_index_metric: Literal["cosine", "l2", "dot"] = "cosine"
|
||||
vector_refine_factor: int = 30
|
||||
|
||||
|
|
|
|||
8
uv.lock
8
uv.lock
|
|
@ -1570,7 +1570,7 @@ requires-dist = [
|
|||
{ name = "cohere", marker = "extra == 'cohere'", specifier = ">=5.21.1" },
|
||||
{ name = "docling", marker = "extra == 'docling'", specifier = ">=2.84.0" },
|
||||
{ name = "docling-core", specifier = ">=2.71.0,<2.72" },
|
||||
{ name = "haiku-skills", specifier = ">=0.13.3" },
|
||||
{ name = "haiku-skills", specifier = ">=0.14.0" },
|
||||
{ name = "httpx", specifier = ">=0.28.1" },
|
||||
{ name = "jinja2", specifier = ">=3.1.0" },
|
||||
{ name = "jsonpatch", specifier = ">=1.33" },
|
||||
|
|
@ -1604,7 +1604,7 @@ provides-extras = ["docling", "voyageai", "mxbai", "cohere", "zeroentropy", "jin
|
|||
|
||||
[[package]]
|
||||
name = "haiku-skills"
|
||||
version = "0.13.3"
|
||||
version = "0.14.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "ag-ui-protocol" },
|
||||
|
|
@ -1614,9 +1614,9 @@ dependencies = [
|
|||
{ name = "pyyaml" },
|
||||
{ name = "skills-ref" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9c/65/44140f3289ebf3647c6f3dbf051de2162bc4ade11f020f98676e14d1d8b7/haiku_skills-0.13.3.tar.gz", hash = "sha256:4c918d6c8183c01274a34111159eeb56d1befed5d38a39779d9e511f92d4e088", size = 250458, upload-time = "2026-04-14T09:13:29.975Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/89/c4/82a6b82f70726a2e759aad4c6c553309f2cc2ca7f3c157b8a15fd14da709/haiku_skills-0.14.0.tar.gz", hash = "sha256:27074a171060a0ecae6b89c6b7756b3b8ed0dfb957a3f5076ab1d158e68feb82", size = 250637, upload-time = "2026-04-16T08:47:33.152Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b9/c6/e3aaed844b80c94b8e8462b80751b372061b19bf17f57e531f327e0366f7/haiku_skills-0.13.3-py3-none-any.whl", hash = "sha256:2bf0d28fd3e7c65b627f1bec33245bc36dc997d95d6efcea949cb9260aec2d73", size = 31530, upload-time = "2026-04-14T09:13:28.787Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e5/7a/bc53abcbae8bf1aa013379f49f6690fbaff55f80a7b997824103a5f44384/haiku_skills-0.14.0-py3-none-any.whl", hash = "sha256:698d0012bcf06f43499c30aaf6a3b7b772c66737696bfa3f93a6b113fb0f6b17", size = 31613, upload-time = "2026-04-16T08:47:31.68Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
Loading…
Reference in a new issue