PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Build a FastAPI summarization service

Last updated: Apr 2, 2026

Quick Overview

This question evaluates web API development and backend engineering competencies, including FastAPI usage, Python type hints, Pydantic-based request/response validation, error handling, in-memory state management, and modular router/service/model layering, and it belongs to the Coding & Algorithms category with a focus on backend web service and API design. It is commonly asked to assess practical ability to deliver production-ready REST endpoints with proper validation and error handling under constrained resources, and the level of abstraction required is primarily practical implementation with attention to architectural design.

  • medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Build a FastAPI summarization service

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Implement a minimal but production-ready FastAPI service for text summarization. Requirements: - Expose an endpoint `POST /summarize`. - The request body is JSON: `{ "text": string }`. - The response body is JSON: `{ "summary": string }`. - The summarization logic can be a placeholder function; you do not need to call a real model. - Store each request and response pair in memory. Engineering requirements: - Use a clean structure with separate router, service, and model layers. - Use type hints throughout. - Use Pydantic models for request and response validation. - Handle invalid input and unexpected errors properly. - Keep the code modular, readable, and simple. - Do not use a database; in-memory storage is sufficient. What to provide: - Show the proposed file structure. - Then provide the code for each file.

Quick Answer: This question evaluates web API development and backend engineering competencies, including FastAPI usage, Python type hints, Pydantic-based request/response validation, error handling, in-memory state management, and modular router/service/model layering, and it belongs to the Coding & Algorithms category with a focus on backend web service and API design. It is commonly asked to assess practical ability to deliver production-ready REST endpoints with proper validation and error handling under constrained resources, and the level of abstraction required is primarily practical implementation with attention to architectural design.

Related Interview Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
Meta logo
Meta
Jan 19, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
1
0

Implement a minimal but production-ready FastAPI service for text summarization.

Requirements:

  • Expose an endpoint POST /summarize .
  • The request body is JSON: { "text": string } .
  • The response body is JSON: { "summary": string } .
  • The summarization logic can be a placeholder function; you do not need to call a real model.
  • Store each request and response pair in memory.

Engineering requirements:

  • Use a clean structure with separate router, service, and model layers.
  • Use type hints throughout.
  • Use Pydantic models for request and response validation.
  • Handle invalid input and unexpected errors properly.
  • Keep the code modular, readable, and simple.
  • Do not use a database; in-memory storage is sufficient.

What to provide:

  • Show the proposed file structure.
  • Then provide the code for each file.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Software Engineer•Meta Software Engineer•Meta Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.