This question is basically five questions stapled together.
Start by clarifying requirements (e.g., expected QPS, image size, model type, latency SLA) and then walk through the design in a structured way: endpoints, schemas, auth, rate limiting, security, observability, and backward compatibility. Emphasize NVIDIA-specific considerations like GPU inference optimization, batching, and integration with Triton Inference Server. Conclude with an OpenAPI snippet for one endpoint to demonstrate concreteness.
Pro tip: Show awareness of GPU utilization and cost by discussing dynamic batching and model warm-up, and mention how you'd version the API to avoid breaking clients when models are updated.
Ask about expected traffic, image size, model type (e.g., classification, detection), latency SLA, and whether the API is internal or public. This shapes decisions on batching, rate limits, and auth.
Define a RESTful endpoint like POST /v1/predict that accepts an image (multipart/form-data or base64) and returns predictions with confidence scores. Specify request/response JSON schemas and error formats.
Use API keys or OAuth2 for auth, implement rate limiting per key (e.g., token bucket), and secure the API with HTTPS, input validation, and size limits to prevent abuse.
Instrument with metrics (latency, QPS, error rates), logging, and tracing. Use versioned endpoints (e.g., /v1/) and additive changes to maintain backward compatibility.
Write a concise OpenAPI 3.0 snippet for the predict endpoint, and discuss trade-offs like synchronous vs. asynchronous inference, batching latency vs. throughput, and cost implications.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.