Skip to content

feat(server): production-grade modular structure with algorithms - #2

Merged
AnikethTS merged 1 commit into
masterfrom
feat/server-refactor
Jun 6, 2026
Merged

feat(server): production-grade modular structure with algorithms#2
AnikethTS merged 1 commit into
masterfrom
feat/server-refactor

Conversation

@AnikethTS

Copy link
Copy Markdown
Owner

Restructured the flat main.py into a layered FastAPI app:

  • core/config.py — pydantic-settings for type-safe env var loading
  • core/prompts.py — system and summarization prompts
  • models/chat.py — Message and ChatRequest Pydantic models
  • middleware/ — sliding-window rate limiter (per IP, O(1) amortised)
  • services/context — message preprocessing, greedy token-budget trimming,
    and midpoint summarization via a secondary Groq call
  • services/streaming — SSE generator with exponential-backoff retry
  • api/routes/ — chat and health endpoints as isolated routers
  • main.py — create_app() factory wiring everything together

@AnikethTS AnikethTS self-assigned this Jun 6, 2026
@AnikethTS
AnikethTS merged commit 52fa2b6 into master Jun 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant