-
Notifications
You must be signed in to change notification settings - Fork 56
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
add splitter config and SplitterOpsFactory to ExtractPDFFlow #78
Conversation
@@ -17,13 +18,13 @@ class ExtractPDFFlow(Flow): | |||
def __init__( | |||
self, | |||
model_config: Dict[str, Any], | |||
splitter: str = "", |
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.
Nit: None
is a better default value.
if splitter: | ||
self._split_op = SplitterOpsFactory.get(splitter) | ||
else: | ||
self._split_op = None |
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.
I would suggest to always assume there will be a splitter for pdf flow for now. It is good to have this if-else case, but it can introduce extra complexity and in the long term cause inconsistency from with and without splitter pdf extractor. in this case, you should use a default splitter with for example paragraph splitter and allow people to configure it to other splitter such as markdown.
In the future, if there is a request regarding without splitter, we can think about bring it back. I would like to keep the code as simple as possible for now.
if self._split_op: | ||
nodes = self._split_op(nodes) |
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.
In this case, you can directly use node = self._split_op(nodes)
here.
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
splitter
field to ExtractPDFConfigSplitterOpsFactory
, which has two splitters:extract_pdf_no_split.ipynb
instruction
inGuidedPrompt
: