SchemaCast 
Turn text into a knowledge graph. You say what to look for; every fact keeps the words it came from.
SchemaCast reads short texts (news, messages, notes, tickets) and writes what they state as a graph: the entities, how they relate, and what is said about them. A schema of a few lines says what to look for. Each text is one model call, checked against that schema.
Status: alpha. The API may change between minor releases.
Three steps
1. Install
pip install schemacast
2. Say what to look for, in a few lines of YAML (schema.yaml):
name: deals
types:
Company: {key: name, fields: {name: str, sector: str, city: str}}
Person: {key: name, fields: {name: str}}
relations:
- Person CEO_OF Company
- Company ACQUIRED Company
3. Cast your texts, one per line (notes.jsonl):
{"source_id": "note-1", "text": "Brightline, a payments company in Austin, acquired Oakfield for $40 million."}
{"source_id": "note-4", "text": "Contrary to earlier reports, Raj Patel is not the CEO of Westpeak."}
export SCHEMACAST_LLM_API_KEY=sk-... # or any OpenAI-compatible endpoint, a local Ollama included
schemacast cast --schema schema.yaml --episodes notes.jsonl --out out/
Out comes the graph, and every fact with the words it was read from (as the example's demo prints it):
note-1 Company 'Brightline, a payments company in Austin'
note-1 name 'Brightline'
note-1 sector 'payments company'
note-1 city 'Austin'
note-1 Company 'Oakfield'
note-1 name 'Oakfield'
note-1 ACQUIRED 'Brightline, a payments company in Austin, acquired Oakfield for $40 million.'
note-1 price '$40 million'
note-4 Person 'Raj Patel'
note-4 Company 'Westpeak'
note-4 CEO_OF 'Raj Patel is not the CEO of Westpeak' denied
$40 million is stored as price: 40000000.0, checked as a number. The denial is kept with its
quote and never written to the graph.
No key yet? From a clone, uv run python examples/hello/demo.py runs this example on replies
recorded once, for free. Its ten lines are also all it takes from Python.
What you get
- Checked facts. Types, relations and values are checked against the schema; a reply that fails is corrected at most twice, then set aside with its reason, never guessed.
- One entity per key. "Brightline" in three notes is one company. A mention without its key waits until a lookup can identify it, instead of creating a duplicate.
- Quotes and nuance. Every fact keeps its quote and character span, and what the text says about it: when it holds, whether it is only planned or hedged, and whether the text denies it. A denial is kept, never written to the graph.
- Free reruns. Replies are cached;
--replaymakes no request and gives the same graph, byte for byte. - Your database.
--db conn.yamlwrites to any database GraFlo supports, Neo4j and ArangoDB among them. Writing a cast twice changes nothing in a database that upserts.
Going further
- A bigger example:
examples/tickets/, a support desk: replies that belong to a ticket without naming it (known), mentions that wait for a lookup, andschemacast pick, which links them to database candidates in one checked call. - The full schema format: the short YAML above is GraFlo's compact notation;
schemacast schema --schema schema.yamlprints the full GraFlo schema it stands for, which SchemaCast also reads directly. - Plain JSON out:
cast --bundlealso writes nodes, edges and quotes as JSON Lines with stable ids, readable without GraFlo. - A service:
schemacast serve(extraserver) offersPOST /castandPOST /pick.
Benchmark
schemacast-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. It
runs a corpus of your own the same way (--corpus DIR), and scores saved casts with no model
(schemacast-bench score).
Not yet
Registry mode is planned: selection across the schemas of a GraFlo schema registry. Today a cast selects within one schema.
Documentation
growgraph.github.io/SchemaCast: installation, how a cast works, mentions and resolution, groundings and qualifiers, context and known entities, preparing a schema, replay, writing to a database, linking staged mentions, running as a service, the benchmark, and the reference.
uv sync --group dev && uv run pytest # tests
uv run --group docs properdocs serve # the docs site
Contributing
See Contributing. Contributors accept the Contributor License Agreement once, by commenting on their first pull request.
Licence
Apache-2.0. Maintained by GrowGraph.
Metadata
Release files for schemacast 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| schemacast-0.4.0.tar.gz | 460.2 kB | Without provenance | Details for schemacast-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| schemacast-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for schemacast-0.4.0-py3-none-any.whl |
Total release size: 645.6 kB
Release files / schemacast-0.4.0.tar.gz
| Download URL | schemacast-0.4.0.tar.gz |
|---|---|
| Size | 460.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38e2596ffc307a3cce66e108c4228023e6fb052c39b94912f0ee336bb168cf2d
|
|
BLAKE2b-256 checksum How to use checksums |
a2bb3956ae2f2bbabc1ced14bb93c9155da4445577ed753b6bbc822c554675eb
|
| 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":true}
|
Release files / schemacast-0.4.0-py3-none-any.whl
| Download URL | schemacast-0.4.0-py3-none-any.whl |
|---|---|
| Size | 185.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ad50a3dc63d10f0c451bb12d0cfe7dc07bd2a65a6e29a935e9024af9a939fde
|
|
BLAKE2b-256 checksum How to use checksums |
bbb755c44353212413d4dbf535dafae669759848b89c842c49db7b5c9a106466
|
| 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":true}
|
Security for schemacast 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.