feat(ai-services): add AVM v2 A/B comparison endpoint and tests
Add POST /avm/v2/compare-v1 endpoint that runs both v1 (single-model) and v2 (ensemble) AVM predictions on the same property and returns a side-by-side comparison with price diff, confidence delta, and a recommendation on which model to prefer. - ABComparisonRequest/Response schemas in avm_v2 models - compare_v1() method in AVMv2EnsembleService - 4 new integration tests for the comparison endpoint - All 47 Python tests pass Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.models.avm_v2 import (
|
||||
ABComparisonRequest,
|
||||
ABComparisonResponse,
|
||||
AVMv2ModelInfo,
|
||||
AVMv2PredictRequest,
|
||||
AVMv2PredictResponse,
|
||||
@@ -33,6 +35,16 @@ def train_v2(req: AVMv2TrainRequest) -> AVMv2TrainResponse:
|
||||
return avm_v2_service.train(req)
|
||||
|
||||
|
||||
@router.post("/compare-v1", response_model=ABComparisonResponse)
|
||||
def compare_v1(req: ABComparisonRequest) -> ABComparisonResponse:
|
||||
"""Compare v1 (single-model) vs v2 (ensemble) predictions side by side.
|
||||
|
||||
Runs both models on the same property and returns price difference,
|
||||
confidence delta, and a recommendation on which to prefer.
|
||||
"""
|
||||
return avm_v2_service.compare_v1(req)
|
||||
|
||||
|
||||
@router.get("/model-info", response_model=AVMv2ModelInfo)
|
||||
def model_info_v2() -> AVMv2ModelInfo:
|
||||
"""Get current active ensemble model information."""
|
||||
|
||||
Reference in New Issue
Block a user