Move validation logic out of python frontend and into the backend
Currently we have a lot of validation logic in Collection.py. This is nice in that we validate things before sending them over the wire, but does not abstract well for different clients (like javascript) and different protocols (other than REST).
Because of this, we re-implemented some (but not all) in the JS client. https://github.com/chroma-core/chroma/blob/14c26f5c222e3bb72e811a4403cbc644846629d6/clients/js/src/index.ts
We want to at a minimum dupe the validation logic into the backend, and perhaps also remove it from Collection.py - the "frontend" client.
@levand im guessing this is not a part of the refactor because we are keeping the API the same, correct?
We are keeping the API the same and there are also some performance and operational benefits to having as much validation as we can up front.
Cost is, as you note, code duplication.
- difficulty: would require copying logic down from frontend into backend - fairly straightforward
- concerns: performance in the distributed system --> validators that require round trips
Update issue - we should do client and server side validation