providers
Choose, configure, inspect, and troubleshoot LangExtract model providers and batch backends.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- providers
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Choose, configure, inspect, and troubleshoot LangExtract model providers and batch backends.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/providers.md10.6 KB
- 参考文档references/troubleshooting.md7.6 KB
- 脚本scripts/check_provider_routes.py5.0 KB
- 脚本scripts/ollama_demo.py5.5 KB
03 SKILL.md 正文
LangExtract Providers
Use this sub-skill when a task depends on selecting or configuring the LangExtract language-model backend: Gemini, Vertex AI, OpenAI/GPT, OpenAI-compatible endpoints, Ollama/local models, provider routing, provider kwargs, or batch behavior.
Fast route
- Decide whether the user is doing provider setup or prompt/extraction design.
- Provider/backend choice, API keys,
ModelConfig,language_model_params, batch mode, Ollama daemon/model checks: stay here. - Prompt, examples,
output_schemashape, tokenization, resolver tuning, or extraction result grounding: route to extraction. - Custom provider package scaffolding, entry points, plugin conflicts, or schema implementation for a new provider: route to provider-plugins.
- JSONL persistence or HTML output: route to visualization.
- Provider/backend choice, API keys,
- Inspect routing without secrets or network by running the bundled route checker:
python sub-skills/providers/scripts/check_provider_routes.py - Use references/providers.md for exact provider patterns, factory APIs, environment-variable precedence, schema/fence interactions, and batch configuration.
- Use references/troubleshooting.md when provider creation or inference fails.
- For local Ollama, start with a preflight-only check before inference:
python sub-skills/providers/scripts/ollama_demo.py --model gemma2:2b --preflight-only
Provider selection checklist
- Prefer
model_idauto-routing for known IDs:gemini...for Gemini,gpt-4...orgpt-5...for OpenAI, and common local IDs such asgemma2:2b,llama3.2:1b,qwen..., orgpt-oss...for Ollama. - Use
langextract.factory.ModelConfig(provider=..., provider_kwargs=...)when a model ID does not match a built-in pattern, when an OpenAI-compatible endpoint uses a non-GPT ID, or when multiple providers could match. - Do not put secrets in generated code. Read API keys from environment variables or caller-owned secret stores.
- Treat live Gemini/OpenAI/Vertex/Ollama checks as optional. This sub-skill only establishes configuration and local/no-network inspection unless the caller explicitly supplies credentials or a local daemon.
- Batch APIs are opt-in and only trigger when the prompt/chunk count meets the configured threshold.
Runtime helpers
scripts/check_provider_routes.py: safe, no-network provider registry and sample model-ID resolver.scripts/ollama_demo.py: local Ollama preflight plus optional tiny extraction demo. It does not require the source repository checkout.
Evidence basis
This guidance is distilled from README.md, langextract/providers/README.md, docs/examples/batch_api_example.md, examples/ollama/, langextract/factory.py, langextract/providers/router.py, builtin_registry.py, patterns.py, gemini.py, openai.py, ollama.py, gemini_batch.py, openai_batch.py, and provider schema modules. Related native verification candidates include factory_test.py, factory_schema_test.py, provider_schema_test.py, inference_test.py, test_kwargs_passthrough.py, test_gemini_batch_api.py, gemini_retry_test.py, openai_batch_test.py, optional test_live_api.py, and optional test_ollama_integration.py; do not run those from this sub-skill unless the root verification plan asks for them.
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).