lawhead-extractor parses legal headlines, extracting parties, claim type and outcome using an LLM with pattern matching for accuracy.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lawhead_extractor-2025.12.21190602.tar.gz.
File metadata
- Download URL: lawhead_extractor-2025.12.21190602.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc13227fcd8bb402e06ef5e85bade1978f6b697f64c1ca8bb36d42650b2c3d95
|
|
| MD5 |
52614f54d2787df1af23ea0adecd6bd6
|
|
| BLAKE2b-256 |
74fb5edefa59dcae600bfefdaebbb23371139ee52b026ce07a1f2f694641fac5
|
File details
Details for the file lawhead_extractor-2025.12.21190602-py3-none-any.whl.
File metadata
- Download URL: lawhead_extractor-2025.12.21190602-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54c95d5e27f8100f2bd87b1dd344e4172b4b276d83f2d87560f76be0cd72b1b1
|
|
| MD5 |
1666a2ef95dff922209cf31c4438602d
|
|
| BLAKE2b-256 |
81e2efc653cd5fa0865264ad083042410762d9380f1ccdcae5cc85f64b67d759
|