fix: drop RAGcore's opaque version UUID from the fallback answer sentence
document_version_id is an internal UUID, not a human-meaningful version like the demo corpus's markdown frontmatter -- confirmed live it made the fallback answer read as "Per \"vehicle-checkout-procedure.md\" (v2e139422-b10b-...)". Still shown on the source card itself, just not in the composed sentence. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
a2433d7fa3
commit
319f43312e
@@ -7,14 +7,17 @@ from app.services.knowledge import EvidenceState, GroundedAnswer, KnowledgeHealt
|
||||
|
||||
_GROUNDED_ANSWERABILITY = {"answerable", "partially_answerable"}
|
||||
|
||||
# Mirrors DemoKnowledgeProvider's own extractive template exactly: a real cited excerpt
|
||||
# wrapped in a fixed sentence, never a generated summary. Used only as a fallback when
|
||||
# RAGcore's own /v1/answers (generation + citation validation) is unavailable but its
|
||||
# retrieval (/v1/search) still returns real, relevant, cited results -- see ask() below.
|
||||
# Mirrors DemoKnowledgeProvider's own extractive template in spirit: a real cited
|
||||
# excerpt wrapped in a fixed sentence, never a generated summary. Used only as a
|
||||
# fallback when RAGcore's own /v1/answers (generation + citation validation) is
|
||||
# unavailable but its retrieval (/v1/search) still returns real, relevant, cited
|
||||
# results -- see ask() below. Unlike the demo corpus's own markdown frontmatter, RAGcore's
|
||||
# `document_version_id` is an opaque UUID, not a human-meaningful version string, so it
|
||||
# is deliberately left out of this sentence (it still appears on the source card itself).
|
||||
_LEAD_ANSWER_TEMPLATE = {
|
||||
"en-GB": 'Per "{title}" (v{version}): {excerpt}',
|
||||
"nl-BE": 'Volgens "{title}" (v{version}): {excerpt}',
|
||||
"fr-BE": 'Selon « {title} » (v{version}) : {excerpt}',
|
||||
"en-GB": 'Per "{title}": {excerpt}',
|
||||
"nl-BE": 'Volgens "{title}": {excerpt}',
|
||||
"fr-BE": 'Selon « {title} » : {excerpt}',
|
||||
}
|
||||
_DEFAULT_LANGUAGE = "en-GB"
|
||||
|
||||
@@ -207,7 +210,7 @@ class RAGcoreKnowledgeProvider:
|
||||
|
||||
template = _LEAD_ANSWER_TEMPLATE.get(language, _LEAD_ANSWER_TEMPLATE[_DEFAULT_LANGUAGE])
|
||||
lead = sources[0]
|
||||
answer = template.format(title=lead.title, version=lead.version, excerpt=lead.excerpt)
|
||||
answer = template.format(title=lead.title, excerpt=lead.excerpt)
|
||||
return GroundedAnswer(
|
||||
answer=answer,
|
||||
evidence_state="grounded",
|
||||
|
||||
Reference in New Issue
Block a user