Skip to content
Why did we open-source our inference engine? Read the post

Relations & Classification

GLiREL and GLiClass models extract relationships and classify text with zero-shot label support.

GLiREL models extract relationships between entities. Relation types are passed via the labels parameter. Entities must be pre-extracted (e.g. with GLiNER) and passed in item.metadata:

from sie_sdk import SIEClient
from sie_sdk.types import Item
client = SIEClient("http://localhost:8080")
text = "Tim Cook is the CEO of Apple Inc."
# Step 1: Extract entities with GLiNER
ner_result = client.extract(
"urchade/gliner_multi-v2.1",
Item(text=text),
labels=["person", "organization"]
)
# Step 2: Pass entities to GLiREL for relation extraction
result = client.extract(
"jackboyla/glirel-large-v0",
Item(text=text, metadata={"entities": ner_result["entities"]}),
labels=["works_for", "ceo_of", "founded"]
)
for relation in result["relations"]:
print(f"{relation['head']} --{relation['relation']}--> {relation['tail']}")
# Tim Cook --ceo_of--> Apple Inc.
FieldTypeDescription
headstrSource entity
tailstrTarget entity
relationstrRelation type
scorefloatConfidence score

GLiClass models classify text into categories:

result = client.extract(
"knowledgator/gliclass-base-v1.0",
Item(text="I absolutely loved this movie! The acting was superb."),
labels=["positive", "negative", "neutral"]
)
for classification in result["classifications"]:
print(f"{classification['label']}: {classification['score']:.2f}")
# positive: 0.94
# neutral: 0.04
# negative: 0.02
ModelLanguagesNotes
urchade/gliner_multi-v2.1MultilingualGeneral-purpose NER
urchade/gliner_large-v2.1EnglishLarger model (459M params)
numind/NuNER_ZeroEnglishZero-shot NER
urchade/gliner_multi_pii-v1MultilingualPII detection
ModelNotes
knowledgator/gliclass-base-v1.0Zero-shot classification
knowledgator/gliclass-small-v1.0Faster, smaller

See Full model catalog for the complete list.