1. [OA] API Design for Model Training — Design an API for model training at OpenAI
OpenAI frequently trains and fine-tunes machine learning models, requiring an organized API to serve these requests efficiently. Problem Statement: Design a class named ModelTrainingAPI that allows clients to submit training jobs, check their progress, and retrieve results once completed.
submit_training_job(model_id: str, data: Any) -> str: Submit a new training job and return the job ID.
check_job_status(job_id: str) -> str: Retrieve the current status of a training job.
get_job_result(job_id: str) -> Any: Retrieve the results of a completed job.
Example 1: Input: Submit a training job with a model ID and training data. Output: Returns a unique job ID to track. Explanation: The API facilitates the model training workflow by providing necessary actions. Constraints:
The API should handle up to 500 concurrent training jobs.
Training jobs should support data sizes up to 10GB.
Want to practise this one?
Create a free account to open the full question and practise OpenAI questions with AI.
2. [OA] Distributed Config Manager — Design a configuration manager for OpenAI's microservices
OpenAI's microservices architecture requires a centralized configuration management system to ensure consistent settings across various services. Problem Statement: Design a class named ConfigManager, which handles loading and retrieving configurations from a key-value store. The class should support watching for configuration changes and notify services when updates occur.
load_config() - Load configurations from a given source.
get_config(key: str) -> str - Retrieve the value for the provided key.
watch_config(key: str, callback: Callable) - Register a callback to be called when the configuration for the specified key changes.
Example 1: Input: Load configuration from a JSON file. Output: Key-value pairs are stored internally. Explanation: The ConfigManager can load configurations on startup and provide them to other services. Constraints:
The key store should support at least 1000 key-value pairs.
Must provide thread-safe access to configuration values.