generated from coulomb/repo-seed
65 lines
2.2 KiB
Python
65 lines
2.2 KiB
Python
from __future__ import annotations
|
|
|
|
from decimal import Decimal
|
|
from typing import Any
|
|
|
|
from .ltv import build_ltv_simulations
|
|
from .models import EconomicsSnapshot, PricingModel
|
|
|
|
|
|
def _fallback_catalog(models: list[PricingModel]) -> dict[str, Any]:
|
|
return {
|
|
"version": 1,
|
|
"currency": "EUR",
|
|
"horizon_months": 24,
|
|
"monthly_discount_rate_pct": "1.0",
|
|
"required_improvement_factor": "1.05",
|
|
"profiles": [
|
|
{
|
|
"id": "observatory-default",
|
|
"name": "Observatory default",
|
|
"segment": "coulomb-social-members",
|
|
"eligible_model_ids": [model.id for model in models if model.status in ("active", "candidate")],
|
|
"members_per_customer": 1,
|
|
"expected_monthly_usage_units": "120000",
|
|
"usage_variance_pct": "25",
|
|
"monthly_churn_pct": "5.0",
|
|
"monthly_default_pct": "1.0",
|
|
"monthly_support_cost": "0.00",
|
|
"monthly_risk_cost": "0.00",
|
|
"acquisition_cost": "0.00",
|
|
"upfront_investment_cost": "0.00",
|
|
"notes": "Fallback scenario when no explicit LTV scenario catalog is provided."
|
|
}
|
|
],
|
|
"notes": "Fallback scenario catalog generated inside observatory.simulator.",
|
|
}
|
|
|
|
|
|
def _fallback_usage_records(snapshot: EconomicsSnapshot, ai_cost_per_member: Decimal) -> list[dict[str, Any]]:
|
|
return [
|
|
{
|
|
"id": "fallback-usage",
|
|
"period": snapshot.period,
|
|
"member_id": "fallback",
|
|
"tokens": 120000,
|
|
"cost_eur": ai_cost_per_member,
|
|
"source": "fallback",
|
|
}
|
|
]
|
|
|
|
|
|
def build_pricing_simulations(
|
|
snapshot: EconomicsSnapshot,
|
|
models: list[PricingModel],
|
|
ai_cost_per_member: Decimal,
|
|
usage_records: list[dict[str, Any]] | None = None,
|
|
scenario_catalog: dict[str, Any] | None = None,
|
|
) -> dict[str, Any]:
|
|
return build_ltv_simulations(
|
|
snapshot,
|
|
models,
|
|
usage_records or _fallback_usage_records(snapshot, ai_cost_per_member),
|
|
scenario_catalog or _fallback_catalog(models),
|
|
)
|