Skip to main content

LPGCast LPGCast logo

Short texts in, a labeled property graph out, typed by a GraFlo schema you govern.

tests pre-commit PyPI Python Docs License

LPGCast reads messages, tickets and notes, and writes what they state as vertices and edges of a GraFlo schema. Each text gets one model call, checked against the schema; what fails is corrected at most twice, then quarantined. Every vertex, edge and property keeps the quote it was read from.

OntoCast builds and evolves an ontology from documents and writes RDF; LPGCast casts short, frequent texts into a property-graph schema you already govern.

Status: alpha. The API may change between minor releases.

Quick start

uv add lpgcast        # or: pip install lpgcast

Point it at any OpenAI-compatible endpoint:

# OpenAI (the default model is gpt-5.6-luna)
export LPGCAST_LLM_API_KEY=sk-...

# or Ollama
export LPGCAST_LLM_BASE_URL=http://localhost:11434/v1
export LPGCAST_LLM_MODEL=qwen3:8b
export LPGCAST_LLM_API_KEY=local

Then, from a clone of the repository, with the example in examples/tickets/:

lpgcast sheet  --schema examples/tickets/schema.yaml        # what the model is shown; no call
lpgcast select --schema examples/tickets/schema.yaml --episodes examples/tickets/episodes.jsonl
lpgcast cast   --schema examples/tickets/schema.yaml --episodes examples/tickets/episodes.jsonl \
               --out out/tickets [--db examples/connections/neo4j.yaml] [--replay]

An episodes file holds one JSON object per line:

{"source_id": "mail-1041", "text": "Customer ACC-2291 opened ticket HD-4411 ...", "reference_time": "2026-03-02T09:14:00Z"}

From Python:

import asyncio
from lpgcast import LPGCaster, load_schema, read_episodes

schema = load_schema("examples/tickets/schema.yaml")
result = asyncio.run(
    LPGCaster(schema).cast(read_episodes("examples/tickets/episodes.jsonl"))
)

--out gets the graph, a grounding per assertion, the quarantine, edges waiting for a lookup, one result per text and a run manifest. --replay serves every reply from the cache and makes no request; everything but the manifest is byte-identical. Writing upserts by identity, so writing a cast twice changes nothing in a database that upserts.

Benchmark

lpgcast-bench casts a bundled corpus of texts whose graphs are known and scores the result exactly, with no model as judge: conformance, hallucination, precision and recall, direction, spans, mention versus mint, injection, selection and re-cast stability, with tokens and cost.

Not yet

Registry mode is planned: selection across the schemas of a GraFlo schema registry, and an HTTP service. Today LPGCast works on one schema file.

Documentation

growgraph.github.io/LPGCast: installation, how a cast works, identities and mentions, preparing a schema, replay, writing to a database, the benchmark, and the reference.

uv sync --group dev && uv run pytest              # tests
uv run --group docs properdocs serve              # the docs site

Licence

Apache-2.0.

Metadata

Release files for lpgcast 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lpgcast 0.2.0
File Size Uploaded
lpgcast-0.2.0.tar.gz 363.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lpgcast 0.2.0
File Interpreter ABI Platform
lpgcast-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 503.4 kB

Release files / lpgcast-0.2.0.tar.gz

Download URL lpgcast-0.2.0.tar.gz
Size 363.5 kB
Tags Source
SHA-256 checksum
How to use checksums
34e6fec3548ca7af4ed1000b5ff320bb3ff31125cb0a867fcfedc488ee1c7ad8
BLAKE2b-256 checksum
How to use checksums
d3f6278a6f13124b91a9d802f27fc13214aeeb646ae0b4e593dade787d7a0bc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / lpgcast-0.2.0-py3-none-any.whl

Download URL lpgcast-0.2.0-py3-none-any.whl
Size 140.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f3a6e509385e8ad3bda91326c67cac90e5356a8b4108f2ab45924325802a806
BLAKE2b-256 checksum
How to use checksums
4a04bfd8d4af49148fce67dd9f0a43e798258696256b4d4893df1ba9fb3f7d18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page