Skip to content
Back to search

langextract

SkillOfficial: GoogleGitHub

A Python library for extracting structured information from unstructured text using LLMs with precise source grounding and interactive visualization.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/google--langextract/badge.svg)](/listings/google--langextract)

HTML

<a href="/listings/google--langextract"><img src="/api/listings/google--langextract/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

> **Note:** Using cloud-hosted models like Gemini requires an API key. See the [API Key Setup](#api-key-setup-for-cloud-models) section for instructions on how to get and configure your key.

Extract structured information with just a few lines of code.

1. Define Your Extraction Task

First, create a prompt that clearly describes what you want to extract. Then, provide a high-quality example to guide the model.

import langextract as lx
import textwrap

# 1. Define the prompt and extraction rules
prompt = textwrap.dedent("""\
    Extract characters, emotions, and relationships in order of appearance.
    Use exact text for extractions. Do not paraphrase or overlap entities.
    Provide meaningful attributes for each entity to add context.""")

# 2. Provide a high-quality example to guide the model
examples = [
    lx.data.ExampleData(
        text="ROMEO. But soft! What light through yonder window breaks? It is the east, and Juliet is the sun.",
        extractions=[
            lx.data.Extraction(
                extraction_class="character",
                extraction_text="ROMEO",
                attributes={"emotional_state": "wonder"}
            ),
            lx.data.Extraction(
                extraction_class="emotion",
                extraction_text="But soft!",
                attributes={"feeling": "gentle awe"}
            ),
            lx.data.Extraction(
                extraction_class="relationship",
                extraction_text="Juliet is the sun",
                attributes={"type": "metaphor"}
            ),
        ]
    )
]

> **Note:** Examples drive model behavior. Each `extraction_text` should ideally be verbatim from the example's `text` (no paraphrasing), listed in order of appearance. LangExtract raises `Prompt alignment` warnings by default if examples don't follow this pattern—resolve these for best results. > > **Grounding:** LLMs may occasionally extract content from few-shot examples rather than the input text. LangExtract automatically detects this: extractions that cannot be located in the source text will have `char_interval = None`. Filter these out with `[e for e in result.extractions if e.char_interval]` to keep only grounded results.

2. Run the Extraction

Provide your input text and the prompt materials to the `lx.extract` function.

# The input text to be processed
input_text = "Lady Juliet gazed longingly at the stars, her heart aching for Romeo"

# Run the extraction
result = lx.extract(
    text_or_documents=input_text,
    prompt_description=prompt,
    examples=examples,
    model_id="gemini-3.5-flash",
)

For advanced constraints beyond examples, such as enum values on extraction attributes, Gemini and OpenAI support `output_schema` with or without few-shot examples. See [Custom output schemas](docs/examples/output_schema.md).

> **Model Selection**: `gemini-3.5-flash` is the recommended default, offering strong extraction quality for LangExtract's schema-constrained workflows. For high-volume or cost-sensitive workloads, consider the current stable Flash-Lite model, `gemini-3.1-flash-lite`; for highly complex tasks requiring deeper reasoning, evaluate a current Gemini Pro model from the official model documentation. For large-scale or production use, a paid Gemini tier is suggested to increase throughput and avoid rate limits. See the [rate-limit documentation](https://ai.google.dev/gemini-api/docs/rate-limits#usage-tiers) for details. > > **Model Lifecycle**: Note that Gemini models have a lifecycle with defined retirement dates. Users should consult the [official model version documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versions) to stay informed about the latest stable and legacy versions.

3. Visualize the Results

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 545 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <p align="center">
  2. <a href="https://github.com/google/langextract">
  3. <img src="https://raw.githubusercontent.com/google/langextract/main/docs/_static/logo.svg" alt="LangExtract Logo" width="128" />
  4. </a>
  5. </p>
  6. # LangExtract
  7. [![PyPI version](https://img.shields.io/pypi/v/langextract.svg)](https://pypi.org/project/langextract/)
  8. [![GitHub stars](https://img.shields.io/github/stars/google/langextract.svg?style=social&label=Star)](https://github.com/google/langextract)
  9. ![Tests](https://github.com/google/langextract/actions/workflows/ci.yaml/badge.svg)
  10. [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17015089.svg)](https://doi.org/10.5281/zenodo.17015089)
  11. [![Live demo](https://img.shields.io/badge/%F0%9F%A4%97%20demo-LangExtract-yellow)](https://google-langextract.hf.space/)
  12. ## Table of Contents
  13. - [Introduction](#introduction)
  14. - [Why LangExtract?](#why-langextract)
  15. - [Quick Start](#quick-start)
  16. - [Installation](#installation)
  17. - [API Key Setup for Cloud Models](#api-key-setup-for-cloud-models)
  18. - [Adding Custom Model Providers](#adding-custom-model-providers)
  19. - [Using OpenAI Models](#using-openai-models)
  20. - [Using Local LLMs with Ollama](#using-local-llms-with-ollama)
  21. - [More Examples](#more-examples)
  22. - [*Romeo and Juliet* Full Text Extraction](#romeo-and-juliet-full-text-extraction)
  23. - [Medication Extraction](#medication-extraction)
  24. - [Radiology Report Structuring: RadExtract](#radiology-report-structuring-radextract)
  25. - [Community Providers](#community-providers)
  26. - [Contributing](#contributing)
  27. - [Testing](#testing)
  28. - [How to Cite](#how-to-cite)
  29. - [Disclaimer](#disclaimer)
  30. ## Introduction
  31. LangExtract is a Python library that uses LLMs to extract structured information from unstructured text documents based on user-defined instructions. It processes materials such as clinical notes or reports, identifying and organizing key details while ensuring the extracted data corresponds to the source text.
  32. <p align="center">
  33. <picture>
  34. <source media="(prefers-reduced-motion: reduce)" srcset="https://raw.githubusercontent.com/google/langextract/main/docs/_static/langextract_concept_still.png" />
  35. <img src="https://raw.githubusercontent.com/google/langextract/main/docs/_static/langextract_concept.gif" alt="LangExtract end to end: unstructured text is chunked, extracted in parallel by an LLM, and every extracted value is grounded back to its exact character span in the source" width="880" />
  36. </picture>
  37. </p>
  38. <p align="center">
  39. <b><a href="https://google-langextract.hf.space/">Try the live demo &rarr;</a></b><br>
  40. <sub>Run grounded extraction on <i>Romeo and Juliet</i> in your browser, no install required.</sub>
  41. </p>
  42. ## Why LangExtract?
  43. 1. **Precise Source Grounding:** Maps every extraction to its exact location in the source text, enabling visual highlighting for easy traceability and verification.
  44. 2. **Reliable Structured Outputs:** Enforces a consistent output schema based on your few-shot examples, leveraging controlled generation in supported models like Gemini to guarantee robust, structured results.
  45. 3. **Optimized for Long Documents:** Overcomes the "needle-in-a-haystack" challenge of large document extraction by using an optimized strategy of text chunking, parallel processing, and multiple passes for higher recall.
  46. 4. **Interactive Visualization:** Instantly generates a self-contained, interactive HTML file to visualize and review thousands of extracted entities in their original context.
  47. 5. **Flexible LLM Support:** Supports your preferred models, from cloud-based LLMs like the Google Gemini family to local open-source models via the built-in Ollama interface.
  48. 6. **Adaptable to Any Domain:** Define extraction tasks for any domain using just a few examples. LangExtract adapts to your needs without requiring any model fine-tuning.
  49. 7. **Leverages LLM World Knowledge:** Utilize precise prompt wording and few-shot examples to influence how the extraction task may utilize LLM knowledge. The accuracy of any inferred information and its adherence to the task specification are contingent upon the selected LLM, the complexity of the task, the clarity of the prompt instructions, and the nature of the prompt examples.
  50. ## Quick Start
  51. > **Note:** Using cloud-hosted models like Gemini requires an API key. See the [API Key Setup](#api-key-setup-for-cloud-models) section for instructions on how to get and configure your key.
  52. Extract structured information with just a few lines of code.
  53. ### 1. Define Your Extraction Task
  54. First, create a prompt that clearly describes what you want to extract. Then, provide a high-quality example to guide the model.
  55. ```python
  56. import langextract as lx
  57. import textwrap
  58. # 1. Define the prompt and extraction rules
  59. prompt = textwrap.dedent("""\
  60. Extract characters, emotions, and relationships in order of appearance.
  61. Use exact text for extractions. Do not paraphrase or overlap entities.
  62. Provide meaningful attributes for each entity to add context.""")
  63. # 2. Provide a high-quality example to guide the model
  64. examples = [
  65. lx.data.ExampleData(
  66. text="ROMEO. But soft! What light through yonder window breaks? It is the east, and Juliet is the sun.",
  67. extractions=[
  68. lx.data.Extraction(
  69. extraction_class="character",
  70. extraction_text="ROMEO",
  71. attributes={"emotional_state": "wonder"}
  72. ),
  73. lx.data.Extraction(
  74. extraction_class="emotion",
  75. extraction_text="But soft!",
  76. attributes={"feeling": "gentle awe"}
  77. ),
  78. lx.data.Extraction(
  79. extraction_class="relationship",
  80. extraction_text="Juliet is the sun",
  81. attributes={"type": "metaphor"}
  82. ),
  83. ]
  84. )
  85. ]
  86. ```
  87. > **Note:** Examples drive model behavior. Each `extraction_text` should ideally be verbatim from the example's `text` (no paraphrasing), listed in order of appearance. LangExtract raises `Prompt alignment` warnings by default if examples don't follow this pattern—resolve these for best results.
  88. >
  89. > **Grounding:** LLMs may occasionally extract content from few-shot examples rather than the input text. LangExtract automatically detects this: extractions that cannot be located in the source text will have `char_interval = None`. Filter these out with `[e for e in result.extractions if e.char_interval]` to keep only grounded results.
  90. ### 2. Run the Extraction
  91. Provide your input text and the prompt materials to the `lx.extract` function.
  92. ```python
  93. # The input text to be processed
  94. input_text = "Lady Juliet gazed longingly at the stars, her heart aching for Romeo"
  95. # Run the extraction
  96. result = lx.extract(
  97. text_or_documents=input_text,
  98. prompt_description=prompt,
  99. examples=examples,
  100. model_id="gemini-3.5-flash",
  101. )
  102. ```
  103. For advanced constraints beyond examples, such as enum values on extraction
  104. attributes, Gemini and OpenAI support `output_schema` with or without
  105. few-shot examples. See
  106. [Custom output schemas](docs/examples/output_schema.md).
  107. > **Model Selection**: `gemini-3.5-flash` is the recommended default, offering strong extraction quality for LangExtract's schema-constrained workflows. For high-volume or cost-sensitive workloads, consider the current stable Flash-Lite model, `gemini-3.1-flash-lite`; for highly complex tasks requiring deeper reasoning, evaluate a current Gemini Pro model from the official model documentation. For large-scale or production use, a paid Gemini tier is suggested to increase throughput and avoid rate limits. See the [rate-limit documentation](https://ai.google.dev/gemini-api/docs/rate-limits#usage-tiers) for details.
  108. >
  109. > **Model Lifecycle**: Note that Gemini models have a lifecycle with defined retirement dates. Users should consult the [official model version documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versions) to stay informed about the latest stable and legacy versions.
  110. ### 3. Visualize the Results
  111. The extractions can be saved to a `.jsonl` file, a popular format for working with language model data. LangExtract can then generate an interactive HTML visualization from this file to review the entities in context.
  112. ```python
  113. # Save the results to a JSONL file
  114. lx.io.save_annotated_documents([result], output_name="extraction_results.jsonl", output_dir=".")
  115. # Generate the visualization from the file
  116. html_content = lx.visualize("extraction_results.jsonl")
  117. with open("visualization.html", "w", encoding="utf-8") as f:
  118. if hasattr(html_content, 'data'):
  119. f.write(html_content.data) # For Jupyter/Colab
  120. else:
  121. f.write(html_content)
  122. ```
  123. This creates an animated and interactive HTML file:
  124. ![Romeo and Juliet Basic Visualization ](https://raw.githubusercontent.com/google/langextract/main/docs/_static/romeo_juliet_basic.gif)
  125. > **Note on LLM Knowledge Utilization:** This example demonstrates extractions that stay close to the text evidence - extracting "longing" for Lady Juliet's emotional state and identifying "yearning" from "gazed longingly at the stars." The task could be modified to generate attributes that draw more heavily from the LLM's world knowledge (e.g., adding `"identity": "Capulet family daughter"` or `"literary_context": "tragic heroine"`). The balance between text-evidence and knowledge-inference is controlled by your prompt instructions and example attributes.
  126. ### Scaling to Longer Documents
  127. For larger texts, you can process entire documents directly from URLs with parallel processing and enhanced sensitivity:
  128. ```python
  129. # Process Romeo & Juliet directly from Project Gutenberg
  130. result = lx.extract(
  131. text_or_documents="https://www.gutenberg.org/files/1513/1513-0.txt",
  132. fetch_urls=True,
  133. prompt_description=prompt,
  134. examples=examples,
  135. model_id="gemini-3.5-flash",
  136. extraction_passes=3, # Improves recall through multiple passes
  137. max_workers=20, # Parallel processing for speed
  138. max_char_buffer=1000 # Smaller contexts for better accuracy
  139. )
  140. ```
  141. This approach can extract hundreds of entities from full novels while maintaining high accuracy. The interactive visualization seamlessly handles large result sets, making it easy to explore hundreds of entities from the output JSONL file. **[See the full *Romeo and Juliet* extraction example →](https://github.com/google/langextract/blob/main/docs/examples/longer_text_example.md)** for detailed results and performance insights.
  142. ### Vertex AI Batch Processing
  143. Save costs on large-scale tasks by enabling Vertex AI Batch API with
  144. `language_model_params` that include `vertexai=True`, `project`, `location`,
  145. and a `batch` config.
  146. See an example of the Vertex AI Batch API usage in [this example](docs/examples/batch_api_example.md).
  147. ## Installation
  148. ### From PyPI
  149. ```bash
  150. pip install langextract
  151. ```
  152. *Recommended for most users. For isolated environments, consider using a virtual environment:*
  153. ```bash
  154. python -m venv langextract_env
  155. source langextract_env/bin/activate # On Windows: langextract_env\Scripts\activate
  156. pip install langextract
  157. ```
  158. ### From Source
  159. LangExtract uses modern Python packaging with `pyproject.toml` for dependency management:
  160. *Installing with `-e` puts the package in development mode, allowing you to modify the code without reinstalling.*
  161. ```bash
  162. git clone https://github.com/google/langextract.git
  163. cd langextract
  164. # For basic installation:
  165. pip install -e .
  166. # For development (includes linting tools):
  167. pip install -e ".[dev]"
  168. # For testing (includes pytest):
  169. pip install -e ".[test]"
  170. ```
  171. ### Docker
  172. ```bash
  173. docker build -t langextract .
  174. docker run --rm -e LANGEXTRACT_API_KEY="your-api-key" langextract python your_script.py
  175. ```
  176. ## API Key Setup for Cloud Models
  177. When using LangExtract with cloud-hosted models (like Gemini or OpenAI), you'll need to
  178. set up an API key. On-device models don't require an API key. For developers
  179. using local LLMs, LangExtract offers built-in support for Ollama and can be
  180. extended to other third-party APIs by updating the inference endpoints.
  181. ### API Key Sources
  182. Get API keys from:
  183. * [AI Studio](https://aistudio.google.com/app/apikey) for Gemini models
  184. * [Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/sdks/overview) for enterprise use
  185. * [OpenAI Platform](https://platform.openai.com/api-keys) for OpenAI models
  186. ### Setting up API key in your environment
  187. **Option 1: Environment Variable**
  188. ```bash
  189. export LANGEXTRACT_API_KEY="your-api-key-here"
  190. ```
  191. **Option 2: .env File (Recommended)**
  192. Add your API key to a `.env` file:
  193. ```bash
  194. # Add API key to .env file
  195. cat >> .env << 'EOF'
  196. LANGEXTRACT_API_KEY=your-api-key-here
  197. EOF
  198. # Keep your API key secure
  199. echo '.env' >> .gitignore
  200. ```
  201. In your Python code:
  202. ```python
  203. import langextract as lx
  204. result = lx.extract(
  205. text_or_documents=input_text,
  206. prompt_description="Extract information...",
  207. examples=[...],
  208. model_id="gemini-3.5-flash"
  209. )
  210. ```
  211. **Option 3: Direct API Key (Not Recommended for Production)**
  212. You can also provide the API key directly in your code, though this is not recommended for production use:
  213. ```python
  214. result = lx.extract(
  215. text_or_documents=input_text,
  216. prompt_description="Extract information...",
  217. examples=[...],
  218. model_id="gemini-3.5-flash",
  219. api_key="your-api-key-here" # Only use this for testing/development
  220. )
  221. ```
  222. **Option 4: Vertex AI (Service Accounts)**
  223. Use [Vertex AI](https://cloud.google.com/vertex-ai/docs/start/introduction-unified-platform) for authentication with service accounts:
  224. ```python
  225. result = lx.extract(
  226. text_or_documents=input_text,
  227. prompt_description="Extract information...",
  228. examples=[...],
  229. model_id="gemini-3.5-flash",
  230. language_model_params={
  231. "vertexai": True,
  232. "project": "your-project-id",
  233. "location": "global" # or regional endpoint
  234. }
  235. )
  236. ```
  237. ## Adding Custom Model Providers
  238. LangExtract supports custom LLM providers via a lightweight plugin system. You can add support for new models without changing core code.
  239. - Add new model support independently of the core library
  240. - Distribute your provider as a separate Python package
  241. - Keep custom dependencies isolated
  242. - Override or extend built-in providers via priority-based resolution
  243. See the detailed guide in [Provider System Documentation](langextract/providers/README.md) to learn how to:
  244. - Register a provider with `@router.register(...)` from `langextract.providers`
  245. - Publish an entry point for discovery
  246. - Optionally provide a schema with `get_schema_class()` for structured output
  247. - Integrate with the factory via `create_model(...)`
  248. ## Using OpenAI Models
  249. LangExtract supports OpenAI models (requires optional dependency: `pip install langextract[openai]`):
  250. ```python
  251. import langextract as lx
  252. # OPENAI_API_KEY in the environment is picked up automatically; pass
  253. # api_key=... explicitly only if you need to override it.
  254. result = lx.extract(
  255. text_or_documents=input_text,
  256. prompt_description=prompt,
  257. examples=examples,
  258. model_id="gpt-4o", # Automatically selects OpenAI provider
  259. )
  260. ```
  261. The OpenAI provider uses structured outputs or JSON mode and auto-determines
  262. fence behavior — leave `fence_output` and `use_schema_constraints` unset.
  263. `output_schema` is also supported for OpenAI models that support structured
  264. outputs; provide a LangExtract output-envelope JSON schema, preferably with the
  265. `lx.schema` helpers.
  266. For large, non-latency-sensitive OpenAI workloads, enable the OpenAI Batch API
  267. with `language_model_params`. Batch mode is opt-in and falls back to realtime
  268. calls when the prompt count is below the configured threshold.
  269. ```python
  270. result = lx.extract(
  271. text_or_documents=documents,
  272. prompt_description=prompt,
  273. examples=examples,
  274. model_id="gpt-4o-mini",
  275. language_model_params={
  276. "batch": {
  277. "enabled": True,
  278. "threshold": 50,
  279. "poll_interval": 10,
  280. }
  281. },
  282. )
  283. ```
  284. For OpenAI-compatible endpoints or non-GPT model IDs (which skip auto-routing), use `ModelConfig` with an explicit provider:
  285. ```python
  286. from langextract.factory import ModelConfig
  287. result = lx.extract(
  288. text_or_documents=input_text,
  289. prompt_description=prompt,
  290. examples=examples,
  291. config=ModelConfig(
  292. model_id="my-openai-compatible-model",
  293. provider="openai",
  294. provider_kwargs={"api_key": "sk-...", "base_url": "https://..."},
  295. ),
  296. )
  297. ```
  298. ## Using Local LLMs with Ollama
  299. LangExtract supports local inference using Ollama, allowing you to run models without API keys:
  300. ```python
  301. import langextract as lx
  302. result = lx.extract(
  303. text_or_documents=input_text,
  304. prompt_description=prompt,
  305. examples=examples,
  306. model_id="gemma2:2b", # Automatically selects Ollama provider
  307. model_url="http://localhost:11434",
  308. )
  309. ```
  310. The Ollama provider exposes `FormatModeSchema` for JSON mode. Leave `fence_output`
  311. and `use_schema_constraints` unset so the factory auto-configures from the provider's
  312. schema. Ollama does not currently support `output_schema`.
  313. **Quick setup:** Install Ollama from [ollama.com](https://ollama.com/), run `ollama pull gemma2:2b`, then `ollama serve`.
  314. For detailed installation, Docker setup, and examples, see [`examples/ollama/`](examples/ollama/).
  315. ## More Examples
  316. Additional examples of LangExtract in action:
  317. ### *Romeo and Juliet* Full Text Extraction
  318. LangExtract can process complete documents directly from URLs. This example demonstrates extraction from the full text of *Romeo and Juliet* from Project Gutenberg (147,843 characters), showing parallel processing, sequential extraction passes, and performance optimization for long document processing.
  319. **[View *Romeo and Juliet* Full Text Example →](https://github.com/google/langextract/blob/main/docs/examples/longer_text_example.md)**
  320. ### Medication Extraction
  321. > **Disclaimer:** This demonstration is for illustrative purposes of LangExtract's baseline capability only. It does not represent a finished or approved product, is not intended to diagnose or suggest treatment of any disease or condition, and should not be used for medical advice.
  322. LangExtract excels at extracting structured medical information from clinical text. These examples demonstrate both basic entity recognition (medication names, dosages, routes) and relationship extraction (connecting medications to their attributes), showing LangExtract's effectiveness for healthcare applications.
  323. **[View Medication Examples →](https://github.com/google/langextract/blob/main/docs/examples/medication_examples.md)**
  324. ### Radiology Report Structuring: RadExtract
  325. Explore RadExtract, a live interactive demo on HuggingFace Spaces that shows how LangExtract can automatically structure radiology reports. Try it directly in your browser with no setup required.
  326. **[View RadExtract Demo →](https://google-radextract.hf.space/)**
  327. ## Community Providers
  328. Extend LangExtract with custom model providers! Check out our [Community Provider Plugins](COMMUNITY_PROVIDERS.md) registry to discover providers created by the community or add your own.
  329. For detailed instructions on creating a provider plugin, see the [Custom Provider Plugin Example](examples/custom_provider_plugin/).
  330. ## Contributing
  331. Contributions are welcome! See [CONTRIBUTING.md](https://github.com/google/langextract/blob/main/CONTRIBUTING.md) to get started
  332. with development, testing, and pull requests. You must sign a
  333. [Contributor License Agreement](https://cla.developers.google.com/about)
  334. before submitting patches.
  335. Thanks to everyone who has [contributed](https://github.com/google/langextract/graphs/contributors).
  336. ## Testing
  337. To run tests locally from the source:
  338. ```bash
  339. # Clone the repository
  340. git clone https://github.com/google/langextract.git
  341. cd langextract
  342. # Install with test dependencies
  343. pip install -e ".[test]"
  344. # Run all tests
  345. pytest tests
  346. ```
  347. Or reproduce the full CI matrix locally with tox:
  348. ```bash
  349. tox # runs pylint + pytest on Python 3.10 and 3.11
  350. ```
  351. ### Ollama Integration Testing
  352. If you have Ollama installed locally, you can run integration tests:
  353. ```bash
  354. # Test Ollama integration (requires Ollama running with gemma2:2b model)
  355. tox -e ollama-integration
  356. ```
  357. This test will automatically detect if Ollama is available and run real inference tests.
  358. ## Development
  359. ### Code Formatting
  360. This project uses automated formatting tools to maintain consistent code style:
  361. ```bash
  362. # Auto-format all code
  363. ./autoformat.sh
  364. # Or run formatters separately
  365. isort langextract tests --profile google --line-length 80
  366. pyink langextract tests --config pyproject.toml
  367. ```
  368. ### Pre-commit Hooks
  369. For automatic formatting checks:
  370. ```bash
  371. pre-commit install # One-time setup
  372. pre-commit run --all-files # Manual run
  373. ```
  374. ### Linting
  375. Run linting before submitting PRs:
  376. ```bash
  377. pylint --rcfile=.pylintrc langextract tests
  378. ```
  379. See [CONTRIBUTING.md](CONTRIBUTING.md) for full development guidelines.
  380. ## How to Cite
  381. If you use LangExtract in your research, please cite it:
  382. ```bibtex
  383. @software{goel_langextract,
  384. author = {Goel, Akshay},
  385. title = {{LangExtract}},
  386. year = {2026},
  387. version = {1.6.0},
  388. doi = {10.5281/zenodo.21126643},
  389. url = {https://github.com/google/langextract}
  390. }
  391. ```
  392. Cite the version you used — each release has its own DOI on
  393. [Zenodo](https://doi.org/10.5281/zenodo.17015089). If your style rejects
  394. `@software`, use `@misc`.
  395. ## Disclaimer
  396. This is not an officially supported Google product. If you use
  397. LangExtract in production or publications, please cite accordingly and
  398. acknowledge usage. Use is subject to the [Apache 2.0 License](https://github.com/google/langextract/blob/main/LICENSE).
  399. For health-related applications, use of LangExtract is also subject to the
  400. [Health AI Developer Foundations Terms of Use](https://developers.google.com/health-ai-developer-foundations/terms).
  401. ---
  402. **Happy Extracting!**

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.