Detect Entities In Content
POST /api/writing/entities/detect
π Detect entities in document content for auto-linking
Analyzes text content to detect entities with position tracking for automatic linking suggestions. Uses semantic search and pattern matching to identify characters, locations, concepts, and other entities.
Request Body:
content: Text content to analyzeminConfidence: Minimum confidence threshold (0-1, default: 0.7)maxSuggestions: Maximum number of suggestions (default: 20)context: Optional context (documentTitle, tags, category, knownEraLabels)
Returns:
- Detection result with entity matches, positions, and metadata
Raises:
HTTPException 500: If entity detection fails
Example Request:
{
"content": "Aragorn traveled to Rivendell to meet Elrond.",
"minConfidence": 0.7,
"maxSuggestions": 20,
"context": {
"documentTitle": "Chapter 1",
"category": "fantasy"
}
}
Example Response:
{
"status": "success",
"matches": [
{
"entity": "Aragorn",
"confidence": 0.95,
"type": "character",
"startPos": 0,
"endPos": 7,
"description": "Ranger and heir to the throne"
}
],
"processingTime": 45
}Request Body required
Section titled βRequest Body required βRequest model for detecting entities in document content for auto-linking.
Used by the AutoLinkService to analyze text content and identify entities (characters, locations, concepts) with position tracking for automatic wiki-style linking suggestions.
Fields:
content: Text content to analyze for entitiesmin_confidence: Minimum confidence threshold (0-1, default: 0.7)max_suggestions: Maximum number of entity suggestions to returncontext: Optional context for improved detection accuracy
Detection Process:
- Extract candidate entities from text (capitalized words/phrases)
- Perform semantic search against entity collections (ChromaDB)
- Calculate confidence scores based on semantic similarity
- Filter by confidence threshold and limit results
- Return matches with position information
Usage: POST /api/writing/entities/detect for entity detection.
JSON Example:
{
"content": "Aragorn traveled to Rivendell to meet Elrond.",
"minConfidence": 0.7,
"maxSuggestions": 20,
"context": {
"documentTitle": "Chapter 1",
"category": "fantasy"
}
}
Response: EntityDetectionResponseDict with status, matches, and processingTime.
object
Text content to analyze for entities
Minimum confidence threshold
Maximum suggestions to return
Optional context for entity detection to improve accuracy.
Fields:
document_title: Title of the document being analyzedtags: Document tags for context filteringcategory: Document categoryknown_era_labels: Era abbreviations from project calendar systems for temporal detection boostfull_document: Full document text whencontentis only a selection β enables structure-aware classification using surrounding context
object
Responses
Section titled β Responses βSuccessful Response
Response dictionary from AutoLinkService.detect_entities.
object
Entity match dictionary structure from AutoLinkService.
object
object
Validation Error