Command Palette

Search for a command to run...

Hectal
Phase 13: Interviews and Capstone
RAG and Vector Search · Exercise 1 of 5Next
Intermediate

Estimate memory and cost for a design

Write vector_mb(chunks, dimensions) that returns the raw size in megabytes (1 MB = 1,000,000 bytes) of 32-bit float vectors.

Write cost_per_1000(sources, chunk_tokens, extra_tokens, out_tokens, price_in, price_out) returning dollars for 1000 questions. Input tokens are sources * chunk_tokens + extra_tokens. Prices are dollars per million tokens.

What Check tests

  1. Raw size of 200,000 vectors of 384 dimensions
  2. Doubling the dimensions doubles the size
  3. Cost per 1000 questions with 5 sources
  4. Fewer sources cost less

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.