Skip to main content

Extract-it

The extract_inference tool allows LLMs and autonomous agents to extract open-vocabulary named entities, spans, confidence scores, and relationships from unstructured text without hallucinations.


Tool Overview​

  • Tool Name: extract_inference
  • Underlying Endpoint: POST /inference/extract/
  • SDK Methods: kg.extract.it (Python) / kg.extract.it (TypeScript)
LoRA Adapters vs. Open Models

adapter_id is for fine-tuned LoRA adapters attached to the base Extract-it service. If you trained or deployed a standalone Open Model (e.g., GLiClass or GLiNER checkpoint), use the open_model_inference tool instead.


Parameters​

ParameterTypeRequiredDescription
textStringYesTarget input text to extract entities or relations from.
tasksObject / DictionaryYesDictionary of extraction tasks following the Unified Inference API (e.g. {"entities": {"type": "span", "labels": ["company", "revenue"], "threshold": 0.4}}).
adapter_idStringNoOptional LoRA adapter ID for fine-tuned adapters (attaches KnowledgatorAPI-Model-ID header).
timeout_msIntegerNoRequest timeout in milliseconds (default: 60000 = 60s).

Example Usage​

Natural Language Prompt to Agent​

"Extract company names and monetary amounts from: 'Alphabet Inc. reported Q4 revenues reaching $86.3 billion, surpassing Wall Street expectations.'"

Tool Call Arguments​

{
"name": "extract_inference",
"arguments": {
"text": "Alphabet Inc. reported Q4 revenues reaching $86.3 billion, surpassing Wall Street expectations.",
"tasks": {
"entities": {
"type": "span",
"labels": ["company", "revenue", "reporting_date"],
"threshold": 0.4
}
}
}
}

Tool Response​

{
"outputs": {
"entities": {
"type": "span",
"value": [
{
"span": "Alphabet Inc.",
"entity": "company",
"start": 0,
"end": 13,
"score": 0.985
},
{
"span": "$86.3 billion",
"entity": "revenue",
"start": 44,
"end": 57,
"score": 0.962
}
],
"threshold": 0.4
}
}
}