LivePlanAssistant / models.py
jedidiahhurt's picture
Initial working POC with LangChain tools (still no create revenue function though)
ad1cd7a
Raw History Blame Contribute Delete
1.53 kB
from liveplan_api_model import *
from pydantic.v1 import UUID4, validator, conint
class StrictForecastPeriodResource(BaseModel):
"""
Forecast period resource for a LivePlan company. Call getCompanyForecastPeriods to retrieve the forecastPeriods for a company.
"""
resolution: Resolution = "MONTH"
period: str
month: conint(ge=1, le=12) # Month must be between 1 and 12
startingYear: conint(ge=2020) # Assuming year >= 1900
endingYear: conint(le=2040)
@validator('endingYear')
def validate_years(cls, v, values, **kwargs):
if 'startingYear' in values and v < values['startingYear']:
raise ValueError(
'endingYear must be greater or equal to startingYear')
return v
class ValueSource(str, Enum):
FORECAST = "FORECAST"
ACTUAL = "ACTUAL"
class StrictForecastValueResource(BaseModel):
value: float = Field(gte=0)
forecastPeriod: StrictForecastPeriodResource
valueSource: ValueSource = ValueSource.FORECAST
class StrictBasicForecastValuesResource(BaseModel):
frequency: Frequency = "MULTIPLE"
spreadBy: SpreadBy = "MONTH"
values: List[StrictForecastValueResource]
baseNumberType: BaseNumberType = "CURRENCY"
source: Source = "SELF"
class StrictOverallRevenueStreamResource(BaseModel):
overall: StrictBasicForecastValuesResource
class OverallRevenueRevenueStreamResource(BaseModel):
uuid: UUID4
name: str
overallRevenue: StrictOverallRevenueStreamResource
type: str = "OVERALL"