51 lines
986 B
Python
51 lines
986 B
Python
from typing import List, TypedDict
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ArticleSummary(TypedDict):
|
|
"""Type definition for article summary data returned from the LLM."""
|
|
title: str
|
|
summary_de: str
|
|
summary_en: str
|
|
|
|
|
|
# Pydantic models for API requests and responses
|
|
class CronSettings(BaseModel):
|
|
"""Settings for the cron job that harvests news."""
|
|
hours: float
|
|
|
|
|
|
class FeedData(BaseModel):
|
|
"""Data for a news feed."""
|
|
country: str
|
|
url: str
|
|
|
|
|
|
class ModelStatus(BaseModel):
|
|
"""Status of the LLM model."""
|
|
name: str
|
|
status: str
|
|
available_models: List[str]
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
"""Standard error response."""
|
|
status: str
|
|
message: str
|
|
|
|
|
|
class SuccessResponse(BaseModel):
|
|
"""Standard success response."""
|
|
status: str
|
|
|
|
|
|
class TimestampResponse(BaseModel):
|
|
"""Response containing a timestamp."""
|
|
ts: int
|
|
|
|
|
|
class HoursResponse(BaseModel):
|
|
"""Response containing hours setting."""
|
|
hours: float
|