oidlabs-com / oidlabs-com/Lexoid

Improve routing function

Open
#61 0 comments 0 reactions 0 assignees View on GitHub

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
    • 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.
  • Check for tables in doc with STATIC_PARSE and reroute to LLM_PARSE if 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.