content_type non-enforcement for Document #3938
bglearning
started this conversation in
General
Replies: 1 comment 1 reply
-
Hey @bglearning ! I don't recall ever having a proper design discussion over this topic, so thank you for raising it up! I'd say this is a proper use for a Proposal, although first-of-its-kind (so far we used it only for new features). Could you draft one according to the guidelines? https://github.com/deepset-ai/haystack/tree/main/proposals I'm looking forward to see how it plays out 🙂 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We don't seem to enforce content_type to be from a pre-defined set anywhere in Document creation.
As such,
Document(content="...", content_type="random-type")
is also valid.Though we do have
ContentTypes
Literal (here) as part of the type hint forcontent_type
inDocument
and so type-checkers can complain. Of course,ContentTypes
specifically is only meant for type hinting but can also imagine having some normal list specified to be enforced.Just wanted to confirm: is it a design choice? i.e. to allow for greater flexibility to users at the schema level.
Beta Was this translation helpful? Give feedback.
All reactions