hygm
A shared graph schema/ontology model: node types, relation types with the
node labels they may connect (start_labels/end_labels, OWL's
rdfs:domain/rdfs:range), and how each node type's mentions merge into
nodes (identity). Producing packages (unstructured2graph) extract and
validate against it.
from hygm import ManualStrategy, validate_model
model = ManualStrategy().create_model("ontology.yaml")
Strategies:
-
ManualStrategy: a hand-authored YAML file (see its docstring for the shape). -
OwlImportStrategy: a standard OWL ontology.owl:Classbecomes a node type,owl:ObjectPropertya relation type, andrdfs:domain/rdfs:range(one class or anowl:unionOf) the start/end labels. Needshygm[owl](rdflib). -
LlmRecommendationStrategy: grows a model from a delta of new sessions. Onederive()run takes the current model and returns a candidate (Derivation) with a changelog, observation counts and a pool of retired types:- LLM propose calls over batches of the delta, told what the model already has;
- one consolidate call that may merge synonyms (vetoed on protected labels, differing identities or incompatible endpoints);
- a permissive observe pass through a caller-supplied
Observer; - an LLM prune that sets new relations' endpoints from what was observed;
- retirement to the pool below a share threshold (once there's enough evidence) or past the active-type cap (~40 node, ~60 relation types).
The core, the catch-alls and pinned labels are never merged away or retired. You supply the LLM as
llm(system, prompt, schema) -> reply; hygm takes no SDK.
The generic default model ships with the package:
from hygm import CATCH_ALL_LABELS, CORE_LABELS, default_model, with_core
model = default_model() # core + Organization/Location/Event + catch-alls
supplied = with_core(my_model) # a supplied model with any missing core type added
- The fixed core (
CORE_LABELS):User,Person, and the value types (VALUE_LABELS:Duration,Quantity,Money,Date,TimeWindow). A learned model never merges or retires these. - The generic layer:
Organization,LocationandEvent. - The catch-alls (
CATCH_ALL_LABELS):TopicandArtifact. They collect whatever has no better type, so the share of mentions landing in them measures how well a model fits. - Relations: generic user-centred relations, plus at least one relation into every value type, so value facts always have somewhere to land.
validate_model is the hard gate every model passes before anything extracts
against it. ManualStrategy runs it on load.
Named after, but separate from, agents/sql2graph's HyGM, which is untouched.
Its validation types are lifted here in the same shape, so a later
consolidation is a type swap.
Metadata
Release files for hygm 0.2.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 | |
|---|---|---|---|
| hygm-0.2.0.tar.gz | 26.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hygm-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.6 kB
Release files / hygm-0.2.0.tar.gz
| Download URL | hygm-0.2.0.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5053e6296c074c1f0d362c9ff786d72733fb2e48e88af3b186e1947f3ec1606c
|
|
BLAKE2b-256 checksum How to use checksums |
700c44c900123611b57cdc2b674f600a8d75ee472afcb3acdfc19c74f6123db7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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 / hygm-0.2.0-py3-none-any.whl
| Download URL | hygm-0.2.0-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa38d44c8c32a9a5803f756cadd962e5ac4249923146297a8bbc6795e1c1c997
|
|
BLAKE2b-256 checksum How to use checksums |
667041a296458a798528ad4cbf1395ee612758617a4980660bd2ca2e620a9f2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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}
|