Relations & Classification
GLiREL and GLiClass models extract relationships and classify text with zero-shot label support.
Relation Extraction
Section titled “Relation Extraction”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 SIEClientfrom sie_sdk.types import Item
client = SIEClient("http://localhost:8080")
text = "Tim Cook is the CEO of Apple Inc."
# Step 1: Extract entities with GLiNERner_result = client.extract( "urchade/gliner_multi-v2.1", Item(text=text), labels=["person", "organization"])
# Step 2: Pass entities to GLiREL for relation extractionresult = 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.import { SIEClient } from "@superlinked/sie-sdk";
const client = new SIEClient("http://localhost:8080");
const text = "Tim Cook is the CEO of Apple Inc.";
// Step 1: Extract entities with GLiNERconst nerResult = await client.extract( "urchade/gliner_multi-v2.1", { text }, { labels: ["person", "organization"] });
// Step 2: Pass entities to GLiREL for relation extractionconst result = await client.extract( "jackboyla/glirel-large-v0", { text, metadata: { entities: nerResult.entities } }, { labels: ["works_for", "ceo_of", "founded"] });
for (const relation of result.relations) { console.log(`${relation.head} --${relation.relation}--> ${relation.tail}`);}// Tim Cook --ceo_of--> Apple Inc.
await client.close();Relation Fields
Section titled “Relation Fields”| Field | Type | Description |
|---|---|---|
head | str | Source entity |
tail | str | Target entity |
relation | str | Relation type |
score | float | Confidence score |
Text Classification
Section titled “Text Classification”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.02const result = await client.extract( "knowledgator/gliclass-base-v1.0", { text: "I absolutely loved this movie! The acting was superb." }, { labels: ["positive", "negative", "neutral"] });
for (const classification of result.classifications) { console.log(`${classification.label}: ${classification.score.toFixed(2)}`);}// positive: 0.94// neutral: 0.04// negative: 0.02Recommended Models
Section titled “Recommended Models”Relation Extraction Models
Section titled “Relation Extraction Models”| Model | Notes |
|---|---|
jackboyla/glirel-large-v0 | Zero-shot relation extraction |
NER Models
Section titled “NER Models”| Model | Languages | Notes |
|---|---|---|
urchade/gliner_multi-v2.1 | Multilingual | General-purpose NER |
urchade/gliner_large-v2.1 | English | Larger model (459M params) |
numind/NuNER_Zero | English | Zero-shot NER |
urchade/gliner_multi_pii-v1 | Multilingual | PII detection |
Classification Models
Section titled “Classification Models”| Model | Notes |
|---|---|
knowledgator/gliclass-base-v1.0 | Zero-shot classification |
knowledgator/gliclass-small-v1.0 | Faster, smaller |
See Full model catalog for the complete list.
Framework Integrations
Section titled “Framework Integrations”All extraction types (entities, relations, classifications) are also available through framework integrations. See LangChain, LlamaIndex, Haystack, DSPy, and CrewAI for framework-specific examples.
What’s Next
Section titled “What’s Next”- NER & Entity Extraction - named entity recognition
- Vision Tasks - image captioning, OCR, object detection, and document understanding
- Full model catalog - all supported models