Parsing table with empty columns not optimal. result_type='text' produces better table formatting. #88

Closed
opened 2026-02-16 00:16:50 -05:00 by yindo · 5 comments
Owner

Originally created by @ggjx22 on GitHub (Apr 19, 2024).

Hello, I have been trying to parse my document (purchase orders and invoices) containing table by leveraging on parsing_instructions to handle awkward tables. However, I still cannot seem to achieve good parsing result after rewriting my prompts many times. result_type='markdown' is the preferred result type because it allows more control over the output. Is there any 'special' prompts the parser needs so that it behaves as instructed?

In one of my latest prompts to the parser, I have written the following instructions for table extraction. I also wrote formatting instructions to handle a few edge cases:

STEP 7: Extract tables of itemized list of items:
- Tables of itemized list are line items of description of goods or
services
- All rows and columns of the table needs to be extracted.
Notes: Exclude total amounts of the table. Replace special characters such
as "|" in the description with "," as they may cause the table to be 
misaligned. Take note of empty rows or columns and apply the appropriate
markdown formatting in the output.

As I cannot share company document publicly, here is a screenshot of a portion of the table where the parser struggles on.
image

If result_type='markdown', I get the following result. The columns shifted.

| Receiver Suburb    | Extra Charges | Qty | Weight | Description |
|--------------------|---------------|-----|--------|-------------|
| Emerald            | 2             | 3   |        | carton,jiffy|
| Rockhampton Dc     | 2             | 53  |        | skid,jiffy  |
| Emerald            | 2             | 3   |        | jiffy       |
| Rockhampton Dc     | 2             | 72  |        | skid,carton |
| Rockhampton Dc     | 1             | 5   |        | carton      |
| Emerald            | 1             | 1   |        | jiffy       |
| Paget              | 1             | 11  |        | carton      |
| Paget              | 1             | 5   |        |carton       |
| Emerald            | 2             | 165 |        | skid,jiffy  |
| Rockhampton Dc     | 1             | 8   |        | carton      |
| Rockhampton Dc     | 1             | 1   |        | jiffy       |
| Rockhampton Dc     | 1             | 8   |        | carton      |

If result_type='text', I get the following result. No columns where shifted.

Receiver Suburb  Extra Charges  Qty  Weight         Description
Emerald                          2       3             carton,jiffy
Rockhampton Dc                   2      53               skid,jiffy
Emerald                          2       3                     jiffy
Rockhampton Dc                   2      72            skid,carton
Rockhampton Dc                   1       5                  carton
Emerald                          1       1                     jiffy
Paget                            1      11                  carton
Paget                            1       5                  carton
Emerald                          2      165              skid,jiffy
Rockhampton Dc                   1       8                  carton
Rockhampton Dc                   1       1                     jiffy
Rockhampton Dc                   1       8                  carton
Originally created by @ggjx22 on GitHub (Apr 19, 2024). Hello, I have been trying to parse my document (purchase orders and invoices) containing table by leveraging on `parsing_instructions` to handle awkward tables. However, I still cannot seem to achieve good parsing result after rewriting my prompts many times. `result_type='markdown'` is the preferred result type because it allows more control over the output. Is there any 'special' prompts the parser needs so that it behaves as instructed? In one of my latest prompts to the parser, I have written the following instructions for table extraction. I also wrote formatting instructions to handle a few edge cases: ``` STEP 7: Extract tables of itemized list of items: - Tables of itemized list are line items of description of goods or services - All rows and columns of the table needs to be extracted. Notes: Exclude total amounts of the table. Replace special characters such as "|" in the description with "," as they may cause the table to be misaligned. Take note of empty rows or columns and apply the appropriate markdown formatting in the output. ``` As I cannot share company document publicly, here is a screenshot of a portion of the table where the parser struggles on. ![image](https://github.com/run-llama/llama_parse/assets/134523967/5fd4b5f8-3abf-4853-8824-b519060ba9bd) If `result_type='markdown'`, I get the following result. The columns shifted. ``` | Receiver Suburb | Extra Charges | Qty | Weight | Description | |--------------------|---------------|-----|--------|-------------| | Emerald | 2 | 3 | | carton,jiffy| | Rockhampton Dc | 2 | 53 | | skid,jiffy | | Emerald | 2 | 3 | | jiffy | | Rockhampton Dc | 2 | 72 | | skid,carton | | Rockhampton Dc | 1 | 5 | | carton | | Emerald | 1 | 1 | | jiffy | | Paget | 1 | 11 | | carton | | Paget | 1 | 5 | |carton | | Emerald | 2 | 165 | | skid,jiffy | | Rockhampton Dc | 1 | 8 | | carton | | Rockhampton Dc | 1 | 1 | | jiffy | | Rockhampton Dc | 1 | 8 | | carton | ``` If `result_type='text'`, I get the following result. No columns where shifted. ``` Receiver Suburb Extra Charges Qty Weight Description Emerald 2 3 carton,jiffy Rockhampton Dc 2 53 skid,jiffy Emerald 2 3 jiffy Rockhampton Dc 2 72 skid,carton Rockhampton Dc 1 5 carton Emerald 1 1 jiffy Paget 1 11 carton Paget 1 5 carton Emerald 2 165 skid,jiffy Rockhampton Dc 1 8 carton Rockhampton Dc 1 1 jiffy Rockhampton Dc 1 8 carton ```
yindo added the bug label 2026-02-16 00:16:50 -05:00
yindo closed this issue 2026-02-16 00:16:50 -05:00
Author
Owner

@galvangoh commented on GitHub (Jul 5, 2024):

The problem with empty columns being ignored by llamaparse is still not fix.

Table:
image

Markdown table:

Line No. Quantity Ordered Quantity Shipped Ship Date Product Number and Description Tariff Code Customer Part No. UM ORIG Unit Price Discount % Net Price Per Unit VAT % Total Price
6.000 2000 2000 26/04/24 M0BLCFX Nut for EO 24 cone end 54627214 608200-M8L This item has been subject to energy surcharge of 0% 608200-M8L EA DE 2100 20.00 420.00
9.000 2000 2000 26/04/24 PSR8LXS Progressive Stop Ring for EO 54627214 621000-M8L This item has been subject to energy surcharge of 0% 621000-M8L EA DE 1900 20.00 380.00
16.000 9231 9231 26/04/24 68MLSBP NUT (BULK QTY 500) 54627214 N3017 This item has been subject to energy surcharge of 0% N3017 EA DE 2100 20.00 1,938.51
22.000 1 1 26/04/24 SHIPPING & HANDLING 54627214 SHIPPING & HANDLING 87.6323 20.00 87.63

Despite giving specific parsing instructions to preserve empty column to llamaparse, the columns are off, making consumption and extraction by LLM impossible.

@galvangoh commented on GitHub (Jul 5, 2024): The problem with empty columns being ignored by llamaparse is still not fix. Table: ![image](https://github.com/run-llama/llama_parse/assets/125248069/673c6c65-2b45-4106-a8e3-31f06747b91c) Markdown table: | Line No. | Quantity Ordered | Quantity Shipped | Ship Date | Product Number and Description | Tariff Code | Customer Part No. | UM ORIG | Unit Price | Discount % | Net Price Per Unit | VAT % | Total Price | |----------|------------------|------------------|-----------|-------------------------------|-------------|-------------------|---------|------------|------------|-------------------|-------|-------------| | 6.000 | 2000 | 2000 | 26/04/24 | M0BLCFX Nut for EO 24| cone end 54627214 608200-M8L This item has been subject to energy surcharge of 0% | 608200-M8L | EA DE | 2100 | 20.00 | 420.00 | | 9.000 | 2000 | 2000 | 26/04/24 | PSR8LXS Progressive Stop Ring for EO 54627214 621000-M8L This item has been subject to energy surcharge of 0% | 621000-M8L | EA DE | 1900 | 20.00 | 380.00 | | 16.000 | 9231 | 9231 | 26/04/24 | 68MLSBP NUT (BULK QTY 500) 54627214 N3017 This item has been subject to energy surcharge of 0% | N3017 | EA DE | 2100 | 20.00 | 1,938.51 | | 22.000 | 1 | 1 | 26/04/24 | SHIPPING & HANDLING 54627214 | SHIPPING & HANDLING | 87.6323 | 20.00 | 87.63 | Despite giving specific parsing instructions to preserve empty column to llamaparse, the columns are off, making consumption and extraction by LLM impossible.
Author
Owner

@BinaryBrain commented on GitHub (Jul 16, 2024):

This should be fixed since our latest API release

@BinaryBrain commented on GitHub (Jul 16, 2024): This should be fixed since our latest API release
Author
Owner

@galvangoh commented on GitHub (Jul 16, 2024):

@BinaryBrain I have tested via the UI which the issue seems to be fixed, but not the API. It's still giving me shifted columns with and without parsing instructions.

@galvangoh commented on GitHub (Jul 16, 2024): @BinaryBrain I have tested via the UI which the issue seems to be fixed, but not the API. It's still giving me shifted columns with and without parsing instructions.
Author
Owner

@sjain132 commented on GitHub (Dec 27, 2024):

@BinaryBrain Hi, can you please provide the API which handles this scenario. I am also facing the same issue. I need this in my project

@sjain132 commented on GitHub (Dec 27, 2024): @BinaryBrain Hi, can you please provide the API which handles this scenario. I am also facing the same issue. I need this in my project
Author
Owner

@BinaryBrain commented on GitHub (Jan 20, 2025):

@sjain132 It's the default on LlamaParse.

@BinaryBrain commented on GitHub (Jan 20, 2025): @sjain132 It's the default on LlamaParse.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#88