Entity Extraction
Experimental5 creditsZero-shot entity extraction using NER-inspired approach. Extract any entity type without training - just provide labels or let AI generate them automatically.
Production Recommendation
This is a direct endpoint for development and testing. For production workloads, use the Data Intelligence Pipeline -- it provides structured Data Packages with quality metrics, is async by default, and is covered by Enterprise SLAs.
Overview
Zero-shot entity extraction using NER-inspired approach. Extract any entity type without training - just provide labels or let AI generate them automatically.
Key features:
- •Three label modes: user, generated, hybrid
- •Custom regex extractors for domain-specific patterns
- •LLM refinement for accuracy
- •Handles unlimited text length with chunking
API Reference
https://api.latence.ai/api/v1/extraction/extractRequest Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | — | Input text | |
config.label_mode | string | — | Label mode: user, generated, hybrid | |
config.user_labels | array | — | Entity labels to extract | |
config.threshold | number | — | Confidence threshold (0.0-1.0) | |
custom_labels | array | — | Custom regex extractors |
Response Fields
| Field | Type | Description |
|---|---|---|
entities | array | |
entity_count | number | |
unique_labels | array | |
success | boolean | |
usage | object |
Response Example
{
"entities": [
{"text": "Apple Inc.", "label": "organization", "start": 0, "end": 10, "score": 0.98},
{"text": "Cupertino", "label": "location", "start": 30, "end": 39, "score": 0.95}
],
"entity_count": 2,
"unique_labels": ["organization", "location"],
"success": true,
"usage": { "credits": 0.5 }
}Code Examples
from latence import Latence
client = Latence(api_key="YOUR_API_KEY")
# Zero-shot entity extraction with user-provided labels
result = client.experimental.extraction.extract(
text="Apple Inc. is headquartered in Cupertino, California.",
config={
"label_mode": "user", # or "generated", "hybrid"
"user_labels": ["organization", "location"],
"threshold": 0.3
}
)
for entity in result.entities:
print(f"{entity.text}: {entity.label} (score: {entity.score:.2f})")
# Let AI generate labels automatically
result = client.experimental.extraction.extract(
text="Your business document here...",
config={"label_mode": "generated"}
)Explore Tutorials & Notebooks
Deep-dive examples and interactive notebooks in our GitHub repository
Looking for production-grade processing?
The Data Intelligence Pipeline chains services automatically and returns structured Data Packages.