chroma icon indicating copy to clipboard operation
chroma copied to clipboard

Move validation logic out of python frontend and into the backend

Open jeffchuber opened this issue 2 years ago • 2 comments

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.

jeffchuber avatar Feb 22 '23 17:02 jeffchuber

@levand im guessing this is not a part of the refactor because we are keeping the API the same, correct?

jeffchuber avatar Mar 29 '23 19:03 jeffchuber

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.

levand avatar Mar 29 '23 20:03 levand

  • difficulty: would require copying logic down from frontend into backend - fairly straightforward
  • concerns: performance in the distributed system --> validators that require round trips

jeffchuber avatar Sep 13 '23 21:09 jeffchuber

Update issue - we should do client and server side validation

HammadB avatar Nov 07 '23 18:11 HammadB