-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
124 lines (101 loc) · 3.41 KB
/
Copy pathmodels.py
File metadata and controls
124 lines (101 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
from datetime import datetime
from decimal import Decimal
from enum import Enum
from typing import Any, Literal
from uuid import UUID
from pydantic import BaseModel, Field
class Intent(str, Enum):
LEAD_QUALIFICATION = "LEAD_QUALIFICATION"
AD_REQUEST = "AD_REQUEST"
CMA_REQUEST = "CMA_REQUEST"
PROPERTY_UPDATE = "PROPERTY_UPDATE"
STATS_REQUEST = "STATS_REQUEST"
GENERAL_QUESTION = "GENERAL_QUESTION"
class ConversationMessage(BaseModel):
role: str
content: str
timestamp: datetime
class LeadData(BaseModel):
customer_name: str | None = None
gender: str | None = None # "male" / "female" / "couple"
budget: str | None = None
timeline: str | None = None # מתי מתכוון לקנות/לשכור ("חודש", "חצי שנה", "גמיש")
authority: str | None = None # מי מחליט ("לבד", "זוג", "צריך אישור הורים")
area_or_asset: str | None = None
meeting_ready: bool | None = None
rooms: str | None = None # מספר חדרים / שטח
parking: bool | None = None # חניה נדרשת
elevator: bool | None = None # מעלית נדרשת
safe_room: bool | None = None # ממ"ד/מקלט נדרש
condition_preference: str | None = None # "renovated" / "needs_work" / "both"
floor_preference: str | None = None # העדפת קומה
new_construction: bool | None = None # פרויקט חדש / בנייה
meeting_proposed: bool | None = None # האם הבוט כבר הציע פגישה (state פנימי, לא מחולץ מ-LLM)
class Tenant(BaseModel):
id: UUID
phone: str
business_phone: str | None = None
name: str
business_name: str | None = None
system_prompt: str | None = None
is_active: bool = False
api_key: str | None = None
webhook_url: str | None = None
created_at: datetime
class Property(BaseModel):
id: UUID
tenant_id: UUID
address: str
price: Decimal | None = None
rooms: int | None = None
floor: int | None = None
size_sqm: int | None = None
features: dict[str, Any] = Field(default_factory=dict)
raw_description: str | None = None
is_active: bool = True
created_at: datetime
class Conversation(BaseModel):
id: UUID
tenant_id: UUID
customer_phone: str
messages: list[ConversationMessage] = Field(default_factory=list)
lead_score: int = 0
lead_data: LeadData = Field(default_factory=LeadData)
notified_agent: bool = False
last_updated: datetime
created_at: datetime
class UsageLog(BaseModel):
id: UUID
tenant_id: UUID
model: str
input_tokens: int
output_tokens: int
cost_usd: Decimal
intent: str | None = None
created_at: datetime
class IncomingMessage(BaseModel):
from_phone: str
to_phone: str
body: str
timestamp: datetime
audio_id: str | None = None
class PropertyCreate(BaseModel):
address: str
price: Decimal | None = None
rooms: int | None = None
floor: int | None = None
size_sqm: int | None = None
raw_description: str | None = None
features: dict[str, Any] = {}
class CsvRowResult(BaseModel):
row: int
address: str
status: Literal["imported", "skipped", "updated", "error"]
message: str | None = None
class CsvImportResult(BaseModel):
total: int
imported: int
updated: int
skipped: int
errors: int
rows: list[CsvRowResult]