fix history anchor

This commit is contained in:
team 1
2026-05-04 20:08:14 +02:00
parent c5aeac397c
commit b259b6cd2d
6 changed files with 660 additions and 5 deletions

View File

@@ -638,6 +638,39 @@ parameters:
- kostet
- shopsuche
- shop-suche
rag_anchor_enrichment:
enabled: true
# Enriches overly narrow numeric shop queries with a product anchor from
# retrieved RAG records when the same record explicitly contains the
# requested numeric value/unit. This prevents queries such as "0,02"
# when RAG already identified a concrete product such as a device model.
min_score: 120
max_query_terms: 6
early_chunk_bonus_max: 10
template: '{anchor} {query} {subject}'
scores:
exact_value_with_unit: 120
exact_value_only: 40
anchor_bonus: 50
numeric_focus_patterns:
- '/(?P<value>\d+(?:[,.]\d+)?)\s*(?P<unit>°?\s*d\s*h|dh|dH)/iu'
product_title_patterns:
- '/#\s*Produkt\s+Titel:\s*`(?P<title>[^`]+)`/iu'
- '/\*\*Produktname:\*\*\s*(?P<title>[^\r\n]+)/iu'
anchor_bonus_patterns:
- '/\b[\p{L}][\p{L}\p{N}®+._-]*(?:\s+|[-_])\d{2,5}\b/u'
subject_terms:
- resthärte
- resthaerte
- wasserhärte
- wasserhaerte
- gesamthärte
- gesamthaerte
- härte
- haerte
- grenzwert
- messung
language_preservation:
enabled: true
language_markers:

View File

@@ -129,6 +129,7 @@ parameters:
language_rules_label: LANGUAGE RULES
fact_grounding_rules_label: FACT GROUNDING RULES
measurement_evidence_label: MEASUREMENT PARAMETER EVIDENCE CHECK
numeric_value_focus_label: EXACT NUMERIC VALUE FOCUS
retrieved_knowledge_label: RETRIEVED KNOWLEDGE (primary for technical matching and factual explanation)
url_content_label: CONTENT FROM URL (authoritative if user-provided)
conversation_context:
@@ -220,14 +221,18 @@ parameters:
- '- This block is generated from the current user question and is stricter than broad product-selection wording.'
- '- For measurement-parameter questions, technical suitability requires explicit positive evidence for the requested parameter in the same source record.'
- '- Similar water-treatment parameters, abbreviations, units, product families, search queries, or ranking positions are not enough.'
- '- For exact numeric measurement requests, records that do not contain the requested numeric value/unit must not provide indicators, ranges, variants, accessories, or suitability details for the selected product.'
product_specific_rules:
- '- Verify every recommended product independently against the requested measurement parameter.'
- '- If a retrieved RAG record mentions several products, only use a product for the requested parameter when that product is named in the same sentence, bullet, table row, or clearly bounded product section as the parameter evidence.'
- '- Do not transfer measurement suitability from one product, variant, indicator, category, tag, heading, or nearby paragraph to another product.'
- '- Generic category, umbrella-topic, device-class, product-family, document-title, tag, or application-area terms are not enough to prove a specific measurement parameter for a specific product.'
- '- Indicator names and indicator ranges are product-specific evidence. Use them only when the same source record explicitly connects the exact product, requested value or range, and indicator code.'
- '- If a record proves the device/value but the visible excerpt does not connect an indicator code to that device/value, omit the indicator instead of borrowing one from a different product record.'
generic_request_patterns:
- '/\b(?:mit|für|fuer|zur|zum)\s+(?:dem\s+)?(?:messparameter|parameter|messwert|messgröße|messgroesse)\s+(?<parameter>[^?.!,;\n]{2,80})/iu'
- '/\b(?:messparameter|parameter|messwert|messgröße|messgroesse)\s*(?:für|fuer|von|zur|zum|:)\s*(?<parameter>[^?.!,;\n]{2,80})/iu'
- '/\b(?:messung|messen|überwachung|ueberwachung|bestimmung|analyse)\s+(?:von|der|des|für|fuer|zur|zum)\s+(?<parameter>[^?.!,;\n]{2,80})/iu'
generic_positive_context_terms:
- Messung
- messen
@@ -436,6 +441,18 @@ parameters:
- '- If one source chunk contains both the best matching value and nearby comparison values, use the nearby values only as context and do not include them unless the user asks for comparison or alternatives.'
- '- For lowest/highest/minimum/maximum questions, answer only the requested extreme value and the product/device explicitly connected to it.'
- '- Do not add runner-up products, second-lowest values, adjacent ranges, broader tables, or explanatory comparisons unless explicitly requested.'
- '- For a product recommendation tied to an exact numeric value, keep the recommendation anchored to records that contain that exact value/unit. Do not pull indicator codes or ranges from records for other products.'
- '- If the user asks for a suitable device/product and not for an indicator, do not add indicator names unless a same-record device-value-indicator mapping is visible.'
numeric_value_focus:
enabled: true
max_values: 3
value_patterns:
- '/(?<value>\d+(?:[,.]\d+)?)\s*(?<unit>°?\s*dH|dh|°dh|°\s*dH)\b/iu'
rules:
- '- Exact numeric focus from the current user question: {values}.'
- '- Prefer retrieved records that explicitly contain this exact value/unit when selecting or recommending a product.'
- '- Records without the exact value/unit may provide background only; they must not provide indicator codes, indicator ranges, variants, or suitability details for the selected product.'
- '- If the selected product record proves the exact value but does not visibly connect an indicator code to that product and value, omit the indicator field rather than borrowing an indicator from another record.'
fallback_escalation:
state_line_template: '- Internal confidence state: {state}.'
base_rules:
@@ -518,6 +535,7 @@ parameters:
- '- For direct follow-up questions about an indicator, value, threshold, or device, answer the resolved mapping first before any table or explanation.'
- '- If the sources only support a negative finding, output only that negative finding and do not add speculative alternatives.'
- '- For product-selection answers, keep the answer minimal: suitable product if explicitly supported, exact evidence, current shop fields if same product identity is clear. Do not add sections for Vorteile, Einsatzbereiche, Messprinzip, or Hinweise unless directly asked and explicitly sourced.'
- '- For product-selection answers tied to a numeric value/range, do not include an indicator field unless the same retrieved record explicitly connects the selected product, numeric value/range, and indicator code.'
accessory_rules:
- '- If the user asks for a matching accessory, separate the answer into: main device and matching accessory.'
- '- The main device must come first. The accessory must not replace the main device.'
@@ -606,6 +624,7 @@ parameters:
- '- For lowest/highest/minimum/maximum questions, answer only the requested extreme unless the user explicitly asks for a comparison or alternatives.'
- '- For direct numeric lookup questions such as which device measures a given threshold, answer with the exact matching device/value pair first and avoid advisory
caveats.'
- '- For product recommendations based on an exact numeric value, use only same-record evidence for the recommended product. Do not import indicator names, ranges, or variants from higher-ranked records that describe different products.'
- '- Do not add the runner-up product, second-lowest value, or adjacent range unless the user asks for it.'
- '- Do not add calibration, accuracy, pretreatment, temperature, or application notes unless those exact notes are requested and explicitly present in the
retrieved source.'
@@ -615,6 +634,7 @@ parameters:
- '- Do not output the full indicator table, measurement principle, application areas, or advisory notes unless the user explicitly asks for all indicators, details, a table, or device information.'
- '- For numeric extreme questions, do not combine a value, device name, indicator name, range or product variant from different chunks unless the same retrieved
entry explicitly connects them.'
- '- For exact-value product recommendations, if the retrieved record only supports product plus value/range, answer product plus value/range only; indicator details require an explicit same-record product-value-indicator mapping.'
- '- If several devices or indicators are present, keep each device-indicator-range assignment separate and do not transfer an indicator from one product to
another.'
- '- For Testomat CAL or Testomat 2000 CAL threshold/range questions, use only source entries that explicitly name CAL or Testomat 2000 CAL in the same product record. Do not answer with Testomat 808 indicator ranges or the generic 0,02 °dH to 5 °dH range unless a CAL source record explicitly contains that exact assignment.'