File size: 2,570 Bytes
fecb183 | 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 | from pydantic import BaseModel, Field
from typing import List, Dict, Optional, Any
from datetime import datetime
# ====================== Analysis ======================
class AnalysisRequest(BaseModel):
subreddits: List[str] = Field(..., description="List of subreddit names")
posts_per_subreddit: int = Field(10, ge=1, le=50, description="Number of posts per subreddit")
time_filter: str = Field("day", description="Time filter (hour, day, week, month, year, all)")
class AnalysisResponse(BaseModel):
status: str
message: str
insights: List[Dict[str, Any]] = []
# ====================== Insights ======================
class InsightResponse(BaseModel):
id: str
subreddit: str
post_title: str
post_url: str
timestamp: datetime
model: str
insight: Dict[str, Any]
# ====================== Query / RAG ======================
class QueryRequest(BaseModel):
query: str = Field(..., description="The user's question")
n_results: int = Field(5, ge=1, le=20, description="Number of sources to retrieve")
class QueryResponse(BaseModel):
answer: str
sources: List[Dict[str, Any]] # each source: {title, subreddit, url}
# ====================== Market Intelligence ======================
class MarketIntelligenceRequest(BaseModel):
idea: str = Field(..., description="Startup idea to analyze")
class MarketIntelligenceResponse(BaseModel):
interest_score: int
competitors: List[str]
funding_news: List[Dict[str, str]]
# ====================== Startup Builder ======================
class GeneratePlanRequest(BaseModel):
insight: Dict[str, Any] = Field(..., description="The insight object to generate a plan for")
class GeneratePlanResponse(BaseModel):
plan: str
# ====================== Trends ======================
class TrendRequest(BaseModel):
subreddit: Optional[str] = Field(None, description="Filter by subreddit (optional)")
class TrendResponse(BaseModel):
dates: List[str]
counts: List[int]
# ====================== Auth & Users ======================
class UserSignup(BaseModel):
email: str
password: str
full_name: Optional[str] = None
class UserLogin(BaseModel):
email: str
password: str
class UserProfile(BaseModel):
id: str
email: str
full_name: Optional[str]
subscription_tier: str
subscription_status: str
created_at: datetime
# ====================== Subscription Plans ======================
class SubscriptionPlan(BaseModel):
id: str
name: str
price: float
features: Dict[str, Any] |