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.1.1

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.1.1
File Size Uploaded
lpgcast-0.1.1.tar.gz 309.2 kB Details

Built distribution (wheel)

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

Total release size: 426.4 kB

Release files / lpgcast-0.1.1.tar.gz

Download URL lpgcast-0.1.1.tar.gz
Size 309.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c1085be76a2a433e0a0cd4ce7f042e4655f40f81e66e07effa6179a48960704a
BLAKE2b-256 checksum
How to use checksums
61dd74363827b490174e6da6e764ace40ef9986e3584d127b22e008b02dab1bf
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":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL lpgcast-0.1.1-py3-none-any.whl
Size 117.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0fae3622b6152f00ca281acff7176c3da99b318dffac58667f8622fe9cbfd16
BLAKE2b-256 checksum
How to use checksums
221a7b96f35a36e557558ba6b2c6f9e742bfd2fe89d71cc24e11f2b1c921d487
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":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.1 This release

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