Skip to content

Classify Text

POST
/api/divinity/project-classifier/classify

Predict entry_type for arbitrary prose, project-scoped.

ProjectClassifyRequest

Request body for POST /api/divinity/project-classifier/classify.

object
projectId
required
Projectid
string
>= 1 characters <= 128 characters
text
required
Text
string
>= 10 characters <= 20000 characters
topK
Topk
integer
default: 3 >= 1 <= 10

Successful Response

ProjectClassifyResponse

Response body for POST /api/divinity/project-classifier/classify.

predictions is empty when status is "untrained" or "insufficient_corpus"; classifier_status is always populated so the UI can show the same snapshot the /status route returns without a second round-trip.

object
status
required
Status
string
Allowed values: trained untrained insufficient_corpus low_quality
predictions
Predictions
Array<object>
EntryTypePrediction

One per-entry-type prediction with similar-entry context.

similar_existing_entries is capped at the ProjectContentClassifierService.chromadb_similar_k limit (default 5) so unbounded ChromaDB queries don’t degrade UI responsiveness on large projects.

object
entryType
required
Entrytype
string
Allowed values: article character location item event faction concept species language religion legends plot custom
confidence
required
Confidence
number
<= 1
similarExistingEntries
Similarexistingentries
Array<string>
classifierStatus
required
ProjectClassifierStatus

Snapshot of one project’s classifier state.

Persisted to data/ml/project-{id}/classifiers/meta.json; served by GET /api/divinity/project-classifier/status.

is_low_quality flips on when the trained classifier’s cross-validated F1 macro falls below low_quality_cv_f1_threshold (default 0.40). Predictions are still served — the UI surfaces the flag so the author knows the model trained on insufficient or noisy signal and that confident predictions may be wrong.

object
projectId
required
Projectid
string
trained
required
Trained
boolean
legendryHash
Any of:
string
trainedAt
Any of:
string format: date-time
nExamples
Nexamples
integer
0
labels
Labels
Array<string>
metrics
Metrics
object
key
additional properties
number
insufficientCorpus
Insufficientcorpus
boolean
insufficientCorpusReason
Any of:
string
isLowQuality
Islowquality
boolean
lowQualityReason
Any of:
string
engineVersion
Engineversion
string
default: 1.0.0

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object