-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: change type of split_by to Literal including None #3389
Conversation
Hey, @julian-risch I realize this is still in draft, but I'd like to ask a quick question. Would it make sense to make this option a |
Hi @sjrl not a bad idea actually. 🙂 I was just thinking about a quick fix for the issue reported by a community member but a Literal would be a cleaner solution. I'll do that instead. Thanks for the hint. 👍 |
@masci This PR is ready for review. 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
* change type of split_by * fix mpy and update schema files * change split_by type to Literal * handle ImportError for Literal py<3.8
Related Issues
split_by: None
from config fails #3386Proposed Changes:
This PR changes the type annotation of
split_by
fromstr
toLiteral["word", "sentence", "passage", None]
.The type of the
split_by
parameter indicated here wasstr
but it should beOptional[str]
or even more explicitly beLiteral["word", "sentence", "passage", None]
instead: https://github.com/deepset-ai/haystack/blob/main/haystack/nodes/preprocessor/preprocessor.py#L54 and the schema file generated based on that with the following line should also allowNone
as the type ofsplit_by
then:haystack/haystack/json-schemas/haystack-pipeline-main.schema.json
Line 4286 in 7290196
Checklist