AGENT SKILL

langextract

Use LangExtract to extract structured data from unstructured text, configure model providers, save/visualize grounded outputs, and author provider plugins.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
langextract
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use LangExtract to extract structured data from unstructured text, configure model providers, save/visualize grounded outputs, and author provider plugins.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

LangExtract Repo Skill

Use this skill when the user wants to use the langextract Python package for source-grounded structured extraction from natural language, provider/back-end configuration, JSONL/HTML result review, or custom provider plugin authoring.

LangExtract's central workflow is: define a prompt and examples, call lx.extract(), inspect grounded AnnotatedDocument results, optionally save JSONL, and generate interactive HTML visualization. It supports Gemini by default, OpenAI/GPT through the openai extra, Ollama/local models, Vertex AI batch processing, and third-party provider plugins.

Install and smoke check

For ordinary package use:

python -m pip install langextract
python - <<'PY'
import langextract as lx
print(lx.__name__)
PY

For OpenAI provider support:

python -m pip install "langextract[openai]"

Cloud model calls require provider credentials such as GEMINI_API_KEY, LANGEXTRACT_API_KEY, or OPENAI_API_KEY. Ollama calls require a running Ollama service and a pulled local model.

Route by task

User task Read next
Write or debug lx.extract() calls, examples, relationship attributes, output schemas, prompt validation, resolver params, long-document chunking, Unicode tokenization, or grounded span filtering. sub-skills/extraction/SKILL.md
Choose/configure Gemini, Vertex AI, OpenAI/GPT, OpenAI-compatible endpoints, Ollama/local models, provider kwargs, route resolution, retries, or batch APIs. sub-skills/providers/SKILL.md
Save AnnotatedDocument outputs to JSONL, reload JSONL, inspect serialized data, or generate/write interactive HTML visualizations. sub-skills/visualization/SKILL.md
Create or troubleshoot a custom provider plugin package, entry point, router pattern, or schema adapter. sub-skills/provider-plugins/SKILL.md
Need the public API map or version-sensitive refresh baseline. references/api-map.md and references/repo-provenance.md
Cross-cutting install/import/provider/schema troubleshooting. references/troubleshooting.md

Operating workflow

  1. Identify whether the user's task is extraction design, provider configuration, output review, or provider extension.
  2. Read the matching sub-skill before writing code. Read only sibling sub-skills when the request crosses boundaries, such as extraction plus visualization.
  3. Keep secrets outside code. Use environment variables or caller-owned secret stores for provider API keys.
  4. Start with short, literal text and show_progress=False while debugging. Scale to long documents, batch mode, multiple workers, or multiple passes only after examples and grounding look correct.
  5. Treat char_interval=None as ungrounded output until diagnosed; visualization only highlights valid intervals.
  6. Use bundled scripts as safe starters or diagnostics:
    • extraction examples: sub-skills/extraction/scripts/
    • provider route/Ollama checks: sub-skills/providers/scripts/
    • no-model JSONL/HTML smoke: sub-skills/visualization/scripts/save_and_visualize.py
    • provider plugin scaffold: sub-skills/provider-plugins/scripts/create_provider_plugin.py

Do not do these

  • Do not tell the user to run examples, tests, scripts, or docs from a source checkout as part of using this skill. Use the bundled references/scripts here or write fresh user-project code.
  • Do not enable fetch_urls=True for untrusted URLs; fetch and sanitize content yourself, then pass literal text.
  • Do not combine output_schema with fence_output=True, YAML output, or provider-native schema kwargs.
  • Do not claim live Gemini/OpenAI/Vertex/Ollama verification unless those credentialed or service-backed checks actually ran in the user's environment.
  • Do not put API keys, local Python paths, virtualenv names, conda prefixes, or other machine-specific details in generated user code or reports.

Freshness

This skill was generated for LangExtract package version 1.6.0. Before relying on version-sensitive details, read references/repo-provenance.md. If package metadata, provider entry points, public signatures, or major evidence paths differ from that snapshot, refresh the skill.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351