Skip to content
arbazshah52Public

About

Small LLM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

59 Commits

Folders and files

Repository files navigation

KK2 - Climate AI and Data Analysis

Typed LLM chain with FastAPI, Pandas, and SmolLM.

Requirements checklist

Requirement Status
GET /health Done
POST /data/upload (CSV, metadata) Done
GET /data/stats (describe(), 404 if missing) Done
POST /ai/ask (Runnable chain) Done
Runnable chain PromptBuilder | LLMRunner | ResponseParser Done
Pydantic types in each step Done
SmolLM via transformers.pipeline Done
.env not in git Done
Error handling + meaningful status codes Done
pytest (chain, endpoints, mocked model) Done
reflektion.md Done

Install

uv sync

Copy optional env file:

copy .env.example .env

Run

uv run uvicorn app.main:app --reload

Swagger: http://127.0.0.1:8000/docs

Example flow

  1. Upload CSV:
curl -X POST "http://127.0.0.1:8000/data/upload" -F "file=@app/data/climate.csv"
  1. Stats:
curl "http://127.0.0.1:8000/data/stats"
  1. Ask:
curl -X POST "http://127.0.0.1:8000/ai/ask" \
  -H "Content-Type: application/json" \
  -d "{\"question\":\"Vilken stad har hogst medeltemperatur?\"}"

Without upload:

  • /data/stats -> 404
  • /ai/ask -> 400

Project structure

app/
  main.py
  config.py
  schemas.py
  data.py
  llm/
    runnable.py
    steps.py
    pipeline.py
  tests/
  data/
    climate.csv
reflektion.md

Tests

uv run pytest app/tests/ -v

Assumptions

  • Dataset stored in memory (single process).
  • CSV must be UTF-8.
  • First /ai/ask call may be slow while model downloads (~300 MB).

About

Small LLM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages