Skip to main content
Relation extraction turns sentences into facts you can store in a graph or a table. You define the entity labels and the relation types, and GLiNER returns each relation as a head entity, a tail entity, and the relation type.

Request

Request schema

Response

GLiNER returns the result as a JSON string in choices[0].message.content. Parsed, it looks like this. Measured against https://api.fastino.ai; confidence values vary slightly between calls.

Response schema

Relations come back under relation_extraction, not under relations.

Act on the answer

Adapt it

  • State the direction in each description, such as “a person is employed by an organization”, so heads and tails come out the right way round.
  • Define entity labels for every kind of thing your relations connect, so the entities are typed in your results.
  • Lower threshold while tuning to see near misses, then filter in code on the head and tail confidence.
  • Store start and end with each fact, so you can trace it back to its source sentence.

Call GLiNER

Every GLiNER schema type and how to read its result.

Chat Completions API reference

Every field, limit, and error for POST /v1/chat/completions.