fix: answer questions whose answers exist in the knowledge base - #239
Open
HardeepAsrani wants to merge 1 commit into
Open
fix: answer questions whose answers exist in the knowledge base#239HardeepAsrani wants to merge 1 commit into
HardeepAsrani wants to merge 1 commit into
Conversation
… judge answerability Structured HTML-to-text extraction (tables become label | value lines, blocks become line breaks, entities decode), chunking that never drops boundary-less content, score-ordered context, visitor-only retrieval query blending, and a noise-floor threshold (0.25) paired with a relative score band so the model decides answerability from the retrieved text. Connect upserts ship the same structured text. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes Codeinwp/hyve#298
The chatbot refused questions whose answers were sitting in the knowledge base. Two things caused it: ingestion was destroying the content's structure, and the similarity threshold was doing a job it cannot do.
Ingestion now preserves structure. Stripping tags used to fuse table cells ("Laundry$32.00/hr") and glue headings to paragraphs, and any long block without sentence punctuation (like a table) was silently dropped from the index entirely. Content is now extracted as structured text: table rows become "Laundry | $32.00/hr" lines, headings keep their own line, entities are decoded, and oversized blocks are split instead of thrown away. Hyve Connect uploads ship the same clean text.
Retrieval now lets the model judge. Measurements showed an absolute similarity score cannot separate answerable from unanswerable questions: a legitimate question can score lower against its correct page than an off-topic one scores against a tangential page. So the default threshold drops from 0.4 to 0.25 and acts as a noise floor, a new relative cutoff keeps only chunks scoring close to the query's best match, and the model (which sees the actual text) decides whether it can answer. Sites that saved a custom threshold keep their value.
Also fixed along the way:
hyve_context_score_ratio,hyve_chat_context_token_limit,hyve_chunk_token_size.Verified on a live seeded site: "How much does laundry cost per hour?" went from refused to answered ("Laundry costs $32.00 per hour."), while off-topic questions are still correctly declined.
QA instructions