Export
Introduction
In this notebook, we'll explore Qwen3-VL's document parsing capabilities using Together AI's API. We'll convert documents to structured formats:
- QwenVL HTML: HTML with
<bbox>attributes for element coordinates - QwenVL Markdown: Markdown with LaTeX tables and image placeholders
These capabilities are useful for document digitization, data extraction, and building RAG systems.
Install required libraries
[ ]
[1]
Using model: Qwen/Qwen3.5-397B-A17B API Key configured: True
[3]
1. Document Parsing with JSON Mode
Extract structured document elements with their bounding boxes and text content.
[5]
JSON Output (first 5 elements):
[
{
"tag": "heading",
"text": "Company Background",
"bbox_2d": [
55,
59,
389,
107
]
},
{
"tag": "paragraph",
"text": "Industry: Specialty pharmaceuticals (Orphan drugs for narcolepsy, leukemia, and stem-cell complications)",
"bbox_2d": [
74,
174,
877,
205
]
},
{
"tag": "paragraph",
"text": "LTM Financials: $1.5 billion revenue; $759 million EBITDA",
"bbox_2d": [
74,
223,
536,
255
]
},
{
"tag": "paragraph",
"text": "Market Cap: $9.1 billion; Enterprise Value: $10.5 billion",
"bbox_2d": [
74,
274,
515,
306
]
},
{
"tag": "paragraph",
"text": "LTM Multiples: 6.8x EV / Revenue; 13.8x EV / EBITDA",
"bbox_2d": [
74,
325,
510,
357
]
}
]
2. Structured Data Extraction
Extract complex document structures like tables or key-value pairs using custom JSON schemas.
[8]
Extracted Table Data:
{
"table_name": "Standard Capacitors Ratings & Dimensions",
"rows": [
{
"cells": [
{
"text": "Part No.",
"is_header": true
},
{
"text": "kVAr @ 415VAC",
"is_header": true
},
{
"text": "kVAr @ 525VAC",
"is_header": true
},
{
"text": "Cn (\u03bcF)",
"is_header": true
},
{
"text": "In",
"is_header": true
},
{
"text": "Imax",
"is_header": true
},
{
"text": "Dimensions D1(D2)xL (mm)",
"is_header": true
},
{
"text": "Weight (kg)",
"is_header": true
},
{
"text": "Resistor Module",
"is_header": true
}
]
},
{
"cells": [
{
"text": "275.546-703803",
"is_header": false
},
{
"text": "6.25",
"is_header": false
},
{
"text": "10",
"is_header": false
},
{
"text": "3\u00d736",
"is_header": false
},
{
"text": "3\u00d711",
"is_header": false
},
{
"text": "3\u00d718",
"is_header": false
},
{
"text": "75(79.5)\u00d7230",
"is_header": false
},
{
"text": "1.0",
"is_header": false
},
{
"text": "Included with Capacitor",
"is_header": false
}
]
},
{
"cells": [
{
"text": "275.176-707700",
"is_header": false
},
{
"text": "12.5",
"is_header": false
},
{
"text": "20",
"is_header": false
},
{
"text": "3\u00d777",
"is_header": false
},
{
"text": "3\u00d722",
"is_header": false
},
{
"text": "3\u00d736",
"is_header": false
},
{
"text": "100(104.5)\u00d7230",
"is_header": false
},
{
"text": "1.7",
"is_header": false
},
{
"text": "275.100-10160",
"is_header": false
}
]
},
{
"cells": [
{
"text": "275.398-715401",
"is_header": false
},
{
"text": "25",
"is_header": false
},
{
"text": "40",
"is_header": false
},
{
"text": "3\u00d7154",
"is_header": false
},
{
"text": "3\u00d744",
"is_header": false
},
{
"text": "3\u00d772",
"is_header": false
},
{
"text": "136(140.5)\u00d7245",
"is_header": false
},
{
"text": "3.7",
"is_header": false
},
{
"text": "275.100-10120",
"is_header": false
}
]
}
]
}