Skip to content
AI-grafen
EUniversityAI product development· about 60 min· evolving, reviewed regularly· verified 2026-09-20· EN

From prototype to product

Be able to take a notebook to a service with tests, logging and evals.

Prerequisites

Intuition

The notebook works. Now it has to run 10 000 times a day for people who are not you. The difference:

PrototypeProduct
cells in ordermodules: data.py, model.py, service.py with side-effect-free functions
hard-coded paths and keysconfiguration via the environment or a file, secrets outside the code
«it worked when I ran it»tests plus an eval harness run in CI on every change
printstructured logging with a request id, without personal data
one callan API with validation, timeouts, error codes, quotas
the best casedegraded modes when the model or the provider is down
«the model»a versioned artefact with a data hash and eval results

Do it in that order. Tests and evals first — they pay for themselves at the first change.

Code

project/
├── src/svc/
│   ├── config.py      # pydantic-settings: MODEL_PATH, LLM_URL, LOG_LEVEL …
│   ├── data.py        # load/clean — pure functions
│   ├── model.py       # predict(text) -> Out ; loaded once
│   ├── service.py     # FastAPI: /healthz, /v1/predict, error handling
│   └── log.py         # json logging with request_id
├── tests/             # pytest: data, model, API (httpx.AsyncClient(app=app))
├── evals/cases.jsonl  # the harness; the threshold in CI
├── Dockerfile
├── requirements.txt   # pinned versions
└── .github/workflows/ci.yml   # lint → test → eval → build
# config.py
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
    model_path: str = "artifacts/model-v3.pkl"
    llm_url: str
    llm_timeout_s: float = 20
    daily_budget_sek: float = 100
settings = Settings()   # reads the environment; a missing llm_url → a clear error at start-up, not at the first call

Mastery means

  • Breaks a notebook out into modules with tests
  • Adds logging, configuration and evals in CI
  • Identifies what separates a demo from something that can be operated

Sign in to do the exercises and build your mastery up.

Sources

All the sources and licences