paulhemb's picture
Update models.py
fecb183 verified
Raw History Blame Contribute Delete
2.57 kB
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]