Integrate Chroma and design semantic search API

Quick Overview

This question evaluates a candidate's competency in ML system design and backend engineering, covering integration of a vector store, embedding model selection and schema design, API endpoint design for upsert/delete/query, metadata handling, and consistency between a CRUD datastore and a semantic search index.

Integrate Chroma and design semantic search API

Company: Credit Genie

Role: Software Engineer

Category: ML System Design

Difficulty: hard

Interview Round: Technical Screen

Extend the CRUD service by integrating a Chroma vector store to support semantic search over documents. Tasks: a) define the collection schema and how embeddings are produced; b) implement endpoints to upsert, delete, and query by vector similarity; c) implement a search_query function that returns a specified response object with a 'results' list that may be empty when there are no matches (never return None), and include fields like scores and metadata; d) describe how you would handle indexing, pagination, filtering by metadata, and eventual consistency; e) discuss latency targets, batching, and error handling in production.

Quick Answer: This question evaluates a candidate's competency in ML system design and backend engineering, covering integration of a vector store, embedding model selection and schema design, API endpoint design for upsert/delete/query, metadata handling, and consistency between a CRUD datastore and a semantic search index.

|Home/ML System Design/Credit Genie
Credit Genie logo
Credit Genie
Sep 6, 2025, 12:00 AM
hardSoftware EngineerTechnical ScreenML System Design
4
0

System Design: Add Semantic Search to an Existing CRUD Service Using Chroma

Context

You own a document CRUD service (create/read/update/delete) that stores documents with an id, text body, and optional metadata. Extend this service by integrating a Chroma vector store to support semantic search over documents. Assume you can add a background worker if needed, but aim for a minimal, production-ready design.

Tasks

  1. Define the vector collection schema and explain how text embeddings are produced (model choice, dimensionality, normalization, and how metadata is stored).
  2. Implement API endpoints to:
    • Upsert documents into the vector store.
    • Delete documents (by id and/or by metadata filter).
    • Query by vector similarity (semantic search) with optional metadata filters.
  3. Implement a search_query function that returns a response object with a required results list (may be empty; never None ). Include per-result scores and metadata.
  4. Describe how you would handle:
    • Indexing strategy and parameters.
    • Pagination for vector search results.
    • Filtering by metadata.
    • Eventual consistency between the CRUD store and the vector index.
  5. Discuss production concerns: latency targets, batching strategies, and error handling (including retries, timeouts, and idempotency).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...