Wire the guarded conversational RAG answer layer end-to-end

This commit is contained in:
2026-08-05 14:33:13 +07:00
parent 834d9e51b0
commit ef08b4929e
127 changed files with 37921 additions and 169 deletions
+21
View File
@@ -0,0 +1,21 @@
import pytest
from rag.calculators import body_surface_area_m2
def test_bsa_matches_book_worked_example():
# Dược thư Phụ lục 1: "165 cm và 60 kg sẽ có diện tích 1,66 m²".
assert round(body_surface_area_m2(60, 165), 2) == 1.66
def test_bsa_matches_book_table_cells():
# Independent cells read from the BSA table (printed 1499): ground truth.
assert round(body_surface_area_m2(10, 90), 2) == 0.50
assert round(body_surface_area_m2(70, 170), 2) == 1.81
def test_bsa_rejects_nonpositive_inputs():
with pytest.raises(ValueError):
body_surface_area_m2(0, 165)
with pytest.raises(ValueError):
body_surface_area_m2(60, -1)