visualization
Use LangExtract visualization to save, reload, inspect, and render AnnotatedDocument JSONL outputs without model inference.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- visualization
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use LangExtract visualization to save, reload, inspect, and render AnnotatedDocument JSONL outputs without model inference.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/troubleshooting.md6.3 KB
- 参考文档references/workflows.md7.2 KB
- 脚本scripts/save_and_visualize.py8.1 KB
03 SKILL.md 正文
LangExtract Visualization
Use this sub-skill when the user already has LangExtract AnnotatedDocument
objects or saved JSONL output and wants to persist, reload, inspect, or render an
interactive HTML visualization without calling a model.
Route first
- To create new extraction results with
lx.extract(), read../extraction/SKILL.mdfirst. - For model IDs, API keys, Vertex/OpenAI batch settings, Ollama, or provider
credentials, read
../providers/SKILL.md. - For frontend code changes beyond the HTML generated by LangExtract, treat the request as unsupported by this repo skill and explain that custom UI work is a gap.
Common workflows
- Save one or more annotated documents to JSONL. Use
lx.io.save_annotated_documents([doc], output_dir=..., output_name=..., show_progress=...). The default filename isdata.jsonl; whenoutput_dir=None, LangExtract writes under a relativetest_output/directory. Prefer an explicit output directory in agent-written code. - Reload JSONL for later inspection. Use
lx.io.load_annotated_documents_jsonl(path, show_progress=...)and materialize the iterator only when the file is small enough. Uselangextract.data_libconversions when you need JSON dictionaries rather than dataclass objects. - Visualize a document or JSONL file. Use
lx.visualize(doc_or_jsonl_path)orlangextract.visualization.visualize(...)withanimation_speed,show_legend, andgif_optimizedas needed. A JSONL path visualizes the first document in the file; load and select a document yourself for multi-document outputs. - Write HTML safely. In a notebook, the return value may be an
IPython.display.HTMLobject with.data; in plain Python it is a string. Usepayload = html.data if hasattr(html, "data") else htmlbefore writing. - Check grounding before blaming visualization. Only extractions with a
usable
char_intervalcan be highlighted. Missing or invalid intervals usually mean the extraction was ungrounded or manually constructed with bad offsets.
Read references/workflows.md for verified signatures, JSONL round trips,
selection patterns, and HTML writing details. Read
references/troubleshooting.md for save/load/visualization failures and their
fixes.
Bundled helper
Run scripts/save_and_visualize.py when you need a no-model smoke helper that
creates a handcrafted AnnotatedDocument, saves JSONL, reloads it, generates
HTML, and writes all outputs under a caller-selected directory:
python scripts/save_and_visualize.py --output-dir ./lx-viz-demo
The helper does not require API keys, provider credentials, network access, or source-repository files.
Verification anchors
This guidance is based on the public README save/visualization snippets,
long-document and medication visualization examples, implementation behavior in
langextract/io.py, langextract/visualization.py, langextract/data_lib.py,
langextract/progress.py, and langextract/core/data.py, installed-package
signature inspection, and the safe native candidate families io_test.py,
data_lib_test.py, visualization_test.py, and progress_test.py.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).