15/30
Part 4 of 7 · Long promptsLearn and do

A prompt every request shares is cached once

Every request to the assistant opens with the same 1,800 tokens of instructions and catalog.

# the assistant's instructions and catalog, then the question
shared, own = 1800, 60
print(f"prefill without the cache {(shared + own) * prefill_ms:.1f} ms, with it {own * prefill_ms:.1f} ms")
Predict

The 1,800 tokens of instructions and catalog are the same in every request. If their cache is kept, how much prefill is left?

Pick one to see what it prints.
Pick an answer above to see the rest