The vector store engine and its routes are backend-neutral in shape but not in structure:
one module holds both the bookkeeping and the Amazon S3 Vectors calls, the routes import
its private functions by name, and the filter dialect and score normalisation are written
against S3 Vectors specifically. Nothing else can be plugged in without rewriting the
callers.
That is the right shape for one backend and the wrong one for two. It only becomes worth
paying for when a second backend is actually wanted — recorded here so the decision is
deliberate rather than discovered.
Refactor: a VectorIndex protocol (create, delete, put, get, delete vectors, query) with
the S3 Vectors implementation behind it; filter translation and score conversion become
the backend's responsibility, since each expresses them differently; chunking becomes a
declared backend capability, because a backend that chunks on ingestion cannot honour a
per-request chunking strategy. The offline tests currently substitute private module
attributes, so they would parametrise over a fake implementation of the protocol instead.
Assessment recorded during the 1.16 review: Amazon Bedrock Knowledge Bases is not the
second backend to build this for. The classic generation caps at 100 knowledge bases per
account, which cannot express a store-per-caller API; the managed generation fits
structurally but costs roughly $1,000 per million searches against roughly $5 on S3
Vectors, and cannot express per-file chunking, chunk listing or normalised scores.
Knowledge Bases remain the right backing for the read-only file_search tool (#105),
which is a different problem.
The vector store engine and its routes are backend-neutral in shape but not in structure:
one module holds both the bookkeeping and the Amazon S3 Vectors calls, the routes import
its private functions by name, and the filter dialect and score normalisation are written
against S3 Vectors specifically. Nothing else can be plugged in without rewriting the
callers.
That is the right shape for one backend and the wrong one for two. It only becomes worth
paying for when a second backend is actually wanted — recorded here so the decision is
deliberate rather than discovered.
Refactor: a
VectorIndexprotocol (create, delete, put, get, delete vectors, query) withthe S3 Vectors implementation behind it; filter translation and score conversion become
the backend's responsibility, since each expresses them differently; chunking becomes a
declared backend capability, because a backend that chunks on ingestion cannot honour a
per-request chunking strategy. The offline tests currently substitute private module
attributes, so they would parametrise over a fake implementation of the protocol instead.
Assessment recorded during the 1.16 review: Amazon Bedrock Knowledge Bases is not the
second backend to build this for. The classic generation caps at 100 knowledge bases per
account, which cannot express a store-per-caller API; the managed generation fits
structurally but costs roughly $1,000 per million searches against roughly $5 on S3
Vectors, and cannot express per-file chunking, chunk listing or normalised scores.
Knowledge Bases remain the right backing for the read-only
file_searchtool (#105),which is a different problem.