Entities
POST /v1/decision-machine-1/entities takes your text and a list of types. It returns every span that matches a type, sorted by start offset. Each entity carries its type, the matched text, a probability, and character offsets. You name the types yourself. There is no fixed taxonomy.
When to use it
- You need all occurrences of something, not one best answer.
- You need offsets to redact, highlight, or link spans in the original text.
- You need a custom type set:
case_number,drug_name,ticker,policy_id. - Use Extract instead when you want one typed record with named fields. Use Answer instead when you want one span per question.
Three example decisions
- Find every person, organization, and location in a news paragraph.
- Find every email address, phone number, and account number in a support message, then redact the offsets.
- Find every drug name and dosage in a clinical note, then count them.
Request
Send text or texts, never both. The object form gives the model a description per type. Describe any type whose name alone is ambiguous.
Response
entities— every matching span, sorted bystartascending.entities[].type— the type name you requested, copied back.entities[].text— the matched span.entities[].probability— the span confidence, 0 to 1, rounded to 3 decimals.entities[].startandentities[].end— character offsets into your text. They are nevernullon this capability.
The slice text[start:end] equals entities[].text. Use the offsets, not a string search: the same string can occur many times.
An empty result is a normal result. A text with no match for any requested type returns an empty array:
Reading the numbers
This request maps each type to a description:
It returns:
Read account_number at 0.991. The probability is the raw span confidence from the extractor. It is not normalized across types, so the numbers do not sum to 1. Each entity stands alone.
Pick one threshold per action:
Raise the bar with the blast radius. Thresholds and confidence routing covers the bands.
This capability returns no confidence field. confidence exists on Classify and Rate, where the scores compete over one label set.
Batching
Send texts instead of text. The response is {"results": [...]}, one entry per text, in input order.
The second text names Jane Foster. You did not request a person type, so no person span comes back. The model returns only the types you name.
Offsets are per text. Index result n against texts[n]. Each text is a separate inference call, so a batch of 32 fans out to 32 calls. Statements and questions follow different rules, covered in Batching.
Limits and gotchas
- An empty
typesarray fails:{"error":{"code":"invalid_request","message":"types: Too small: expected array to have >=1 items"}}. - Sending both
textandtextsfails withbody: provide text or texts, not both. Sending neither returns the same message. - The common mistake: vague type names.
numbermatches dates, quantities and ids. Name the type for the case, or move to the object form and describe it. Writing good statements and labels has the rules. - Duplicate mentions each return their own entity. Deduplicate on
textin your own code when you want a set. - Over 2,000 characters the service scans overlapping windows and remaps the offsets, so the offsets stay correct against your original string. Cost is linear in characters. Long text and chunking covers the windows.
- The extractor is multilingual. Type descriptions in English work on non-English text. Languages carries the measurements.
- A
502 runner_erroror a529 overloadedmeans retry with backoff. Errors lists every code.
Next
- PII detection — described PII types and offset redaction, end to end.
- Choosing a capability — entities against extract, and the other near misses.
- Extract — one typed record instead of a span list.