mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Deterministically guard the high-heat-retention storage description 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
01e7e1d831
commit
9711b2e5f5
2 changed files with 51 additions and 0 deletions
11
domain/epc/property_overrides/main_heating_guard.py
Normal file
11
domain/epc/property_overrides/main_heating_guard.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from domain.epc.property_overrides.main_heating_system_type import (
|
||||
MainHeatingSystemType,
|
||||
)
|
||||
|
||||
|
||||
def main_heating_guard(description: str) -> Optional[MainHeatingSystemType]:
|
||||
raise NotImplementedError
|
||||
40
tests/domain/epc/test_main_heating_guard.py
Normal file
40
tests/domain/epc/test_main_heating_guard.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from domain.epc.property_overrides.main_heating_guard import main_heating_guard
|
||||
from domain.epc.property_overrides.main_heating_system_type import (
|
||||
MainHeatingSystemType,
|
||||
)
|
||||
|
||||
|
||||
def test_guard_resolves_high_heat_retention_storage() -> None:
|
||||
# Arrange — the structured phrasing the LLM funnelled into "old storage" (401).
|
||||
description = "Electric Storage Systems: High heat retention storage heaters"
|
||||
|
||||
# Act
|
||||
result = main_heating_guard(description)
|
||||
|
||||
# Assert — HHRSH has its own archetype (SAP 409), never old storage (ADR-0044).
|
||||
assert result is MainHeatingSystemType.ELECTRIC_STORAGE_HIGH_HEAT_RETENTION
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"description",
|
||||
[
|
||||
# Other storage subtypes the LLM already classifies correctly — the guard
|
||||
# only rescues the HHRSH gap, leaving the rest to the fallback classifier.
|
||||
"Electric Storage Systems: Old (large volume) storage heaters",
|
||||
"Electric Storage Systems: Modern (slimline) storage heaters",
|
||||
"Electric Storage Systems: Fan storage heaters",
|
||||
# Unrelated / varied phrasings are the LLM's job.
|
||||
"Gas boiler",
|
||||
"",
|
||||
],
|
||||
)
|
||||
def test_guard_defers_non_hhrsh_descriptions_to_the_llm(description: str) -> None:
|
||||
# Act
|
||||
result = main_heating_guard(description)
|
||||
|
||||
# Assert
|
||||
assert result is None
|
||||
Loading…
Add table
Reference in a new issue