Legal data integrations (CourtListener, citations, case law) for the Matrx ecosystem
Project description
matrx-legal
Legal data integrations for the Matrx ecosystem. Standalone-installable; first-class inside aidream.
Initial provider: CourtListener (REST API v4, bulk S3 dumps, webhooks). Designed to host additional sources (Westlaw, Lexis, Justia, CAP, Caselaw Access Project) behind a uniform interface.
What it does
- Async client for CourtListener REST API v4 with token-bucket throttling, cursor pagination, retry, and 429/
Retry-Afterhandling. - Pydantic models for every public response shape.
- Optional ORM persistence (matrx-orm) for cached opinions, dockets, courts, citations.
- Optional bulk ingest from CourtListener's free quarterly S3 dumps via Postgres
COPY. - Optional RAG indexing of opinion full-text (host injects the embedder).
- Optional FastAPI streaming endpoints (host wires them up).
- AI tool callables ready to register with
matrx-ai's tools registry.
Quick start
import asyncio
from matrx_legal.courtlistener import CourtListenerClient
async def main():
async with CourtListenerClient() as client:
async for hit in client.search(q="miranda v arizona", type="o", page_size=20):
print(hit.case_name, hit.absolute_url)
asyncio.run(main())
Set COURTLISTENER_API_TOKEN in your environment.
Host integration
import matrx_legal
from my_app.settings import settings
from my_app.db import LegalOpinion, LegalDocket # subclassed from matrx_legal.orm
matrx_legal.configure(
settings=settings,
db_models={"LegalOpinion": LegalOpinion, "LegalDocket": LegalDocket, ...},
file_handler_class=FileManager,
embedder=my_embedder,
)
Standalone testing
uv run pytest packages/matrx-legal/tests
Tests must pass with only matrx-utils installed.
Project details
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 matrx_legal-0.1.5.tar.gz.
File metadata
- Download URL: matrx_legal-0.1.5.tar.gz
- Upload date:
- Size: 64.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0aecb2bc30e9ac99ec3bd42f2c8fef27853a511231061de7b293b3110a34660
|
|
| MD5 |
04a8d2a12fe1a35c105a98ac1e901b93
|
|
| BLAKE2b-256 |
a9c0e45befa3f0583e5d70f772e96717b8801418a2bb13b0bff64bffd9fc673c
|
Provenance
The following attestation bundles were made for matrx_legal-0.1.5.tar.gz:
Publisher:
publish-package.yml on AI-Matrix-Engine/aidream
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrx_legal-0.1.5.tar.gz -
Subject digest:
f0aecb2bc30e9ac99ec3bd42f2c8fef27853a511231061de7b293b3110a34660 - Sigstore transparency entry: 2001361465
- Sigstore integration time:
-
Permalink:
AI-Matrix-Engine/aidream@d4642f5780b0eb0dbccd6d83d4ebaa43fc47f615 -
Branch / Tag:
refs/tags/matrx-legal/v0.1.5 - Owner: https://github.com/AI-Matrix-Engine
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@d4642f5780b0eb0dbccd6d83d4ebaa43fc47f615 -
Trigger Event:
push
-
Statement type:
File details
Details for the file matrx_legal-0.1.5-py3-none-any.whl.
File metadata
- Download URL: matrx_legal-0.1.5-py3-none-any.whl
- Upload date:
- Size: 72.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc164987170980a3bb35252b1466615f17378ced030dc83c598f94bafa9f7726
|
|
| MD5 |
8da29487000b9e909d826ff1303dcec2
|
|
| BLAKE2b-256 |
a14866ab862e12d1ea3f54caa8d4f23aaa918f763d25429cfdff2846f4a79d10
|
Provenance
The following attestation bundles were made for matrx_legal-0.1.5-py3-none-any.whl:
Publisher:
publish-package.yml on AI-Matrix-Engine/aidream
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrx_legal-0.1.5-py3-none-any.whl -
Subject digest:
bc164987170980a3bb35252b1466615f17378ced030dc83c598f94bafa9f7726 - Sigstore transparency entry: 2001361575
- Sigstore integration time:
-
Permalink:
AI-Matrix-Engine/aidream@d4642f5780b0eb0dbccd6d83d4ebaa43fc47f615 -
Branch / Tag:
refs/tags/matrx-legal/v0.1.5 - Owner: https://github.com/AI-Matrix-Engine
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@d4642f5780b0eb0dbccd6d83d4ebaa43fc47f615 -
Trigger Event:
push
-
Statement type: