paulhemb commited on
Commit
fecb183
·
verified ·
1 Parent(s): 1da4550

Update models.py

Browse files

added additional code file and improvements toward models.py code files.

Files changed (1) hide show
  1. models.py +82 -51
models.py CHANGED
@@ -1,51 +1,82 @@
1
- from pydantic import BaseModel, Field
2
- from typing import List, Dict, Optional, Any
3
- from datetime import datetime
4
-
5
- class AnalysisRequest(BaseModel):
6
- subreddits: List[str] = Field(..., description="List of subreddit names")
7
- posts_per_subreddit: int = Field(10, ge=1, le=50, description="Number of posts per subreddit")
8
- time_filter: str = Field("day", description="Time filter (hour, day, week, month, year, all)")
9
-
10
- class AnalysisResponse(BaseModel):
11
- status: str
12
- message: str
13
- insights: List[Dict[str, Any]] = []
14
-
15
- class InsightResponse(BaseModel):
16
- id: str
17
- subreddit: str
18
- post_title: str
19
- post_url: str
20
- timestamp: datetime
21
- model: str
22
- insight: Dict[str, Any]
23
-
24
- class QueryRequest(BaseModel):
25
- query: str
26
- n_results: int = Field(5, ge=1, le=20)
27
-
28
- class QueryResponse(BaseModel):
29
- answer: str
30
- sources: List[Dict[str, Any]]
31
-
32
- class MarketIntelligenceRequest(BaseModel):
33
- idea: str
34
-
35
- class MarketIntelligenceResponse(BaseModel):
36
- interest_score: int
37
- competitors: List[str]
38
- funding_news: List[Dict[str, str]]
39
-
40
- class GeneratePlanRequest(BaseModel):
41
- insight: Dict[str, Any]
42
-
43
- class GeneratePlanResponse(BaseModel):
44
- plan: str
45
-
46
- class TrendRequest(BaseModel):
47
- subreddit: Optional[str] = None
48
-
49
- class TrendResponse(BaseModel):
50
- dates: List[str]
51
- counts: List[int]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pydantic import BaseModel, Field
2
+ from typing import List, Dict, Optional, Any
3
+ from datetime import datetime
4
+
5
+ # ====================== Analysis ======================
6
+ class AnalysisRequest(BaseModel):
7
+ subreddits: List[str] = Field(..., description="List of subreddit names")
8
+ posts_per_subreddit: int = Field(10, ge=1, le=50, description="Number of posts per subreddit")
9
+ time_filter: str = Field("day", description="Time filter (hour, day, week, month, year, all)")
10
+
11
+ class AnalysisResponse(BaseModel):
12
+ status: str
13
+ message: str
14
+ insights: List[Dict[str, Any]] = []
15
+
16
+ # ====================== Insights ======================
17
+ class InsightResponse(BaseModel):
18
+ id: str
19
+ subreddit: str
20
+ post_title: str
21
+ post_url: str
22
+ timestamp: datetime
23
+ model: str
24
+ insight: Dict[str, Any]
25
+
26
+ # ====================== Query / RAG ======================
27
+ class QueryRequest(BaseModel):
28
+ query: str = Field(..., description="The user's question")
29
+ n_results: int = Field(5, ge=1, le=20, description="Number of sources to retrieve")
30
+
31
+ class QueryResponse(BaseModel):
32
+ answer: str
33
+ sources: List[Dict[str, Any]] # each source: {title, subreddit, url}
34
+
35
+ # ====================== Market Intelligence ======================
36
+ class MarketIntelligenceRequest(BaseModel):
37
+ idea: str = Field(..., description="Startup idea to analyze")
38
+
39
+ class MarketIntelligenceResponse(BaseModel):
40
+ interest_score: int
41
+ competitors: List[str]
42
+ funding_news: List[Dict[str, str]]
43
+
44
+ # ====================== Startup Builder ======================
45
+ class GeneratePlanRequest(BaseModel):
46
+ insight: Dict[str, Any] = Field(..., description="The insight object to generate a plan for")
47
+
48
+ class GeneratePlanResponse(BaseModel):
49
+ plan: str
50
+
51
+ # ====================== Trends ======================
52
+ class TrendRequest(BaseModel):
53
+ subreddit: Optional[str] = Field(None, description="Filter by subreddit (optional)")
54
+
55
+ class TrendResponse(BaseModel):
56
+ dates: List[str]
57
+ counts: List[int]
58
+
59
+ # ====================== Auth & Users ======================
60
+ class UserSignup(BaseModel):
61
+ email: str
62
+ password: str
63
+ full_name: Optional[str] = None
64
+
65
+ class UserLogin(BaseModel):
66
+ email: str
67
+ password: str
68
+
69
+ class UserProfile(BaseModel):
70
+ id: str
71
+ email: str
72
+ full_name: Optional[str]
73
+ subscription_tier: str
74
+ subscription_status: str
75
+ created_at: datetime
76
+
77
+ # ====================== Subscription Plans ======================
78
+ class SubscriptionPlan(BaseModel):
79
+ id: str
80
+ name: str
81
+ price: float
82
+ features: Dict[str, Any]