oidlabs-com / oidlabs-com/Lexoid
Improve routing function
Open
Nobody has claimed this yet.
dev
enhancement
- Dominant language
- Python
- Stars
- 108
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Some ideas:
- Priority setting
speed:- no image ->
STATIC_PARSE - image ->
LLM_PARSE- Can also check if image size <<< page size and if so, default to static
- no image ->
accuracy: The current setting- has hidden hyperlink AND no image (or very small image) ->
STATIC_PARSE - All other cases ->
LLM_PARSE - The intuition behind the above routing is that LLM_PARSE (with a strong model) will usually represent the output much more accurately than STATIC_PARSE. However, the LLMs are currently not able to extract hidden (embedded) links from PDFs. STATIC_PARSE is also unable to process images (currently). So, if there are hidden links AND there are no images, we can route the doc to STATIC_PARSE.
- has hidden hyperlink AND no image (or very small image) ->
- Check for tables in doc with
STATIC_PARSEand reroute toLLM_PARSEif tables are present.- Reasoning: The LLM would be better at accurately representing the table - It can also use HTML to represent more complex tables (e.g.: those with merged cells).
- Custom routing functions:
- An option can be provided to define a custom routing function by specifying the conditions for STATIC_PARSE vs LLM_PARSE.
- One way this could be done is to pass a dictionary with keys for certain utility functions (e.g.:
has_image_in_pdf,has_hyperlink_in_pdf) and boolean values to indicate whether they should be True or False in order for the document to be routed to STATIC_PARSE.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the routing function and the existing STATIC_PARSE and LLM_PARSE paths. Review how images, hidden hyperlinks, tables, and priority or accuracy settings are currently detected; done means the routing behavior and any custom routing option match the specified conditions and are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100