Lawhead Extractor
Extract structured information from legal case headlines
The Lawhead Extractor is a Python package that processes legal case headlines and extracts structured information such as the parties involved, the type of claim, and the outcome. It uses a Large Language Model (LLM) to analyze the text input and returns a consistent, formatted response with key details, ensuring accuracy through pattern matching and retries.
Installation
pip install lawhead_extractor
Usage
from lawhead_extractor import lawhead_extractor
import os
# default usage
response = lawhead_extractor(user_input="an example user input text")
print(response)
# usage with custom LLM instance (e.g. OpenAI)
from langchain_openai import ChatOpenAI
from lawhead_extractor import lawhead_extractor
llm = ChatOpenAI()
response = lawhead_extractor(user_input="user input text", llm=llm)
# usage with custom LLM instance (e.g. Anthropic)
from langchain_anthropic import ChatAnthropic
from lawhead_extractor import lawhead_extractor
llm = ChatAnthropic()
response = lawhead_extractor(user_input="user input text", llm=llm)
# usage with custom LLM instance (e.g. Google Generative AI)
from langchain_google_genai import ChatGoogleGenerativeAI
from lawhead_extractor import lawhead_extractor
llm = ChatGoogleGenerativeAI()
response = lawhead_extractor(user_input="user input text", llm=llm)
Input Parameters
user_input:str: the user input text to processllm:Optional[BaseChatModel]: the langchain LLM instance to use, if not provided, the defaultChatLLM7will be used.api_key:Optional[str]: the API key for LLM7, if not provided, the default rate limits for LLM7 free tier will be used.
By default, the package uses the ChatLLM7 from langchain_llm7 <https://pypi.org/project/langchain_llm7/>. Developers can safely pass their own LLM instance (based on https://docs.langchain.com/docs/llm/how-to-use-another-llm) if they want to use another LLM, via passing it like lawhead_extractor(llm=their_llm_instance), for example to use the OpenAI https://docs.langchain.com/docs/openai/how-to-use-openai, Anthropic https://docs.langchain.com/docs/anthropic/how-to-use-anthropic, or Google Generative AI https://docs.langchain.com/docs/google/generative-ai/how-to-use-google-generative-ai.
The default rate limits for LLM7 free tier are sufficient for most use cases of this package. If developers want higher rate limits for LLM7, they can pass their own API key via environment variable LLM7_API_KEY or via passing it directly like lawhead_extractor(api_key="their_api_key"). Developers can get a free API key by registering at https://token.llm7.io/.
Issues
Find and report any issues with the package on our GitHub issues page: https://github.com/chigwell/lawhead_extractor
Author
The Lawhead Extractor package was created by Eugene Evstafev and is maintained by Eugene Evstafev.
Contact the author at: hi@eugene.plus
Follow Chigwell on GitHub at: https://github.com/chigwell
Metadata
Release files for lawhead-extractor 2025.12.21190602
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lawhead_extractor-2025.12.21190602.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lawhead_extractor-2025.12.21190602-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / lawhead_extractor-2025.12.21190602.tar.gz
| Download URL | lawhead_extractor-2025.12.21190602.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc13227fcd8bb402e06ef5e85bade1978f6b697f64c1ca8bb36d42650b2c3d95
|
|
BLAKE2b-256 checksum How to use checksums |
74fb5edefa59dcae600bfefdaebbb23371139ee52b026ce07a1f2f694641fac5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / lawhead_extractor-2025.12.21190602-py3-none-any.whl
| Download URL | lawhead_extractor-2025.12.21190602-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54c95d5e27f8100f2bd87b1dd344e4172b4b276d83f2d87560f76be0cd72b1b1
|
|
BLAKE2b-256 checksum How to use checksums |
81e2efc653cd5fa0865264ad083042410762d9380f1ccdcae5cc85f64b67d759
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|