# Extract Entities

> Extrae entidades con nombre de un texto mediante reconocimiento con un LLM.

Source: https://docs.sommatic.ai/es/nodes/ai.entity.extract/

- Slug: `ai.entity.extract`
- Familia: IA
- Versión: 1.0.0
- Estado: Disponible
- Ejecución: async

Extrae entidades con nombre de un texto mediante reconocimiento con un LLM.

Identifica personas, organizaciones, lugares, fechas, montos y tipos de entidad personalizados en cualquier texto no estructurado. Configura los tipos de entidad o aporta tus propias definiciones mediante Knowledge Resources.

**Operaciones:**
- **Standard:** Extrae los tipos de entidad comunes (PERSON, ORG, LOCATION, DATE, MONEY, EMAIL, PHONE, URL).
- **Custom:** Define tus propios tipos de entidad con descripciones y ejemplos.
- **All:** Combina la extracción de entidades estándar y personalizadas.

## Configuración

- `llm_provider_id` (string, opcional): El `id` de un registro `LlmProviderModel` (p. ej. `wf-llm-provider-*`). El orquestador delega en el backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` en modo sync, o `POST /chat/conversation/execute/stream-ephemeral` (SSE) en modo stream. El backend resuelve endpoint + api-key + deployment a partir del registro y enruta al adaptador correspondiente.
- `invocation_mode` (string, opcional): Transporte de la llamada al LLM. `sync` se bloquea hasta recibir la respuesta completa. `stream` consume los tokens mediante SSE (necesario para generaciones largas). Predeterminado: `sync`. Por defecto: `sync`. Valores permitidos: `sync`, `stream`.
- `timeout_ms` (integer, opcional): Tiempo máximo de espera para que termine la invocación (o tiempo máximo de inactividad entre fragmentos en modo stream). Predeterminado: 30000 en sync, 600000 en stream.
- `extraction_mode` (string, obligatorio): Standard extrae los tipos comunes. Custom usa tus definiciones. All combina ambos. Por defecto: `standard`. Valores permitidos: `standard`, `custom`, `all`.
- `entity_types` (array<string>, opcional): Filtra qué tipos estándar se extraen. Déjalo vacío para todos. Se muestra cuando: extraction_mode = `standard` | `all`.
- `custom_entities` (array<object>, opcional): Define tipos de entidad personalizados con nombre, descripción y ejemplos. Se muestra cuando: extraction_mode = `custom` | `all`.
- `knowledge_resource_id` (string, opcional): Opcional: carga las definiciones de entidades personalizadas desde un Knowledge Resource.
- `language` (string, opcional): Idioma del texto de entrada. Por defecto: `en`.
- `deduplicate` (boolean, opcional): Combina las menciones duplicadas de una entidad en entradas únicas. Por defecto: `true`.

Su configuración muestra los ajustes de ejecución compartidos, pero este nodo aún no aplica reintentos (`retryOnFail`, `maxTries`). Ningún nodo aplica `continueOnFail`.

## Puertos de salida

- `success` (por defecto): Se extrajo al menos una entidad.
- `none_found`: No se detectaron entidades en el texto.
- `error`: La extracción falló.

## Contrato de entrada

- `text` (string, obligatorio): Texto del que se extraen las entidades.
- `context` (string, opcional): Contexto opcional para mejorar la precisión de la extracción.

## Contrato de salida

- `entities` (array, opcional): Entidades extraídas con su tipo, texto y confianza.
- `entity_counts` (object, opcional): Cantidad por tipo de entidad.
- `unique_entities` (object, opcional): Entidades sin duplicados, agrupadas por tipo.

## En expresiones

Lo que un nodo posterior puede leer de la salida de este nodo con `$("Extract Entities").item.json.<ruta>` (escribe la etiqueta de tu nodo en lugar de `Extract Entities`). **Editor** marca las rutas que sugiere el editor de workflows en Previous Nodes (el contrato de salida); **Worker** marca las rutas que el worker devuelve de verdad por `success`, según la salida que muestra Puertos.

- `$("Extract Entities").item.json.entities` (array) = `[…] (3)`: Entidades extraídas con su tipo, texto y confianza.
- `$("Extract Entities").item.json.entity_counts` (object) = `{…}`: Cantidad por tipo de entidad.
- `$("Extract Entities").item.json.unique_entities` (object) = `{…}`: Entidades sin duplicados, agrupadas por tipo.
- `$("Extract Entities").item.json.entity_counts.PERSON` (number) = `2` (El editor no la sugiere)
- `$("Extract Entities").item.json.entity_counts.EMAIL` (number) = `1` (El editor no la sugiere)
- `$("Extract Entities").item.json.unique_entities.PERSON` (array) = `[…] (1)` (El editor no la sugiere)
- `$("Extract Entities").item.json.unique_entities.EMAIL` (array) = `[…] (1)` (El editor no la sugiere)
- `$("Extract Entities").item.json.total` (number) = `3` (El editor no la sugiere)
- `$("Extract Entities").item.json.unique_total` (number) = `2` (El editor no la sugiere)


## Cómo funciona

Extrae entidades nombradas de tipos estándar y/o personalizados de `text` en una sola llamada al modelo, filtra los tipos desconocidos y agrupa las menciones duplicadas.

1. Combina el payload anterior con la configuración del nodo (gana la configuración), lee `text` (con respaldo en `input`) y `context`, y usa `stream` como `invocation_mode` si no está definido.
2. Arma la lista de tipos según `extraction_mode`: `standard` usa PERSON, ORG, LOCATION, DATE, MONEY, EMAIL, PHONE, URL e ID (filtrados por `entity_types`); `custom` usa `custom_entities` más `structured_data.entity_types` del `knowledge_resource_id`; `all` usa ambos. Falla si la lista queda vacía.
3. Envía un prompt de sistema con los tipos y un formato JSON estricto; el mensaje de usuario es `text`, precedido de `Context:` si existe; `temperature: 0`.
4. Interpreta la respuesta como JSON; `entities` debe ser un arreglo. Descarta las entidades cuyo tipo no está en la lista (sin distinguir mayúsculas).
5. Con `deduplicate` (por defecto true), agrupa las menciones por tipo y texto normalizado, cuenta `mentions` y conserva la confianza más alta. Sale por `success` si queda al menos una entidad; si no, por `none_found`.

## En un workflow

### Nodo

```json
{
  "node_id": "node-extract-contacts",
  "label": "Extract contacts",
  "operator_slug": "ai.entity.extract",
  "operator_version": "1.0.0",
  "config": {
    "text": "{{ $json.body }}",
    "extraction_mode": "standard",
    "entity_types": [
      "PERSON",
      "EMAIL",
      "PHONE"
    ],
    "deduplicate": true,
    "language": "en",
    "llm_provider_id": "wf-llm-provider-xxxx",
    "invocation_mode": "stream",
    "timeout_ms": 120000
  }
}
```

### Envelope

```json
{
  "ok": true,
  "data": {
    "entities": [
      {
        "text": "Ana Ruiz",
        "type": "PERSON",
        "normalized": "Ana Ruiz",
        "confidence": 0.98
      },
      {
        "text": "ana.ruiz@example.com",
        "type": "EMAIL",
        "normalized": "ana.ruiz@example.com",
        "confidence": 0.99
      },
      {
        "text": "Ms. Ruiz",
        "type": "PERSON",
        "normalized": "Ana Ruiz",
        "confidence": 0.9
      }
    ],
    "entity_counts": {
      "PERSON": 2,
      "EMAIL": 1
    },
    "unique_entities": {
      "PERSON": [
        {
          "text": "Ana Ruiz",
          "type": "PERSON",
          "normalized": "Ana Ruiz",
          "confidence": 0.98,
          "mentions": 2
        }
      ],
      "EMAIL": [
        {
          "text": "ana.ruiz@example.com",
          "type": "EMAIL",
          "normalized": "ana.ruiz@example.com",
          "confidence": 0.99,
          "mentions": 1
        }
      ]
    },
    "total": 3,
    "unique_total": 2
  },
  "port": "success"
}
```

## Puertos de salida (comportamiento en el código)

### `success`

Se encontró al menos una entidad de un tipo configurado.

```json
{
  "entities": [
    {
      "text": "Ana Ruiz",
      "type": "PERSON",
      "normalized": "Ana Ruiz",
      "confidence": 0.98
    },
    {
      "text": "ana.ruiz@example.com",
      "type": "EMAIL",
      "normalized": "ana.ruiz@example.com",
      "confidence": 0.99
    },
    {
      "text": "Ms. Ruiz",
      "type": "PERSON",
      "normalized": "Ana Ruiz",
      "confidence": 0.9
    }
  ],
  "entity_counts": {
    "PERSON": 2,
    "EMAIL": 1
  },
  "unique_entities": {
    "PERSON": [
      {
        "text": "Ana Ruiz",
        "type": "PERSON",
        "normalized": "Ana Ruiz",
        "confidence": 0.98,
        "mentions": 2
      }
    ],
    "EMAIL": [
      {
        "text": "ana.ruiz@example.com",
        "type": "EMAIL",
        "normalized": "ana.ruiz@example.com",
        "confidence": 0.99,
        "mentions": 1
      }
    ]
  },
  "total": 3,
  "unique_total": 2
}
```

### `none_found`

El modelo no encontró entidades de un tipo configurado.

```json
{
  "entities": [],
  "entity_counts": {},
  "unique_entities": {},
  "total": 0,
  "unique_total": 0
}
```

### `error`

No hay tipos de entidad configurados, falló la llamada al modelo o la respuesta no traía el arreglo `entities`.

```json
{
  "error": "Model did not return valid entity extraction output."
}
```

## Comportamiento en el código

- `invocation_mode`: En el código el valor por defecto es `stream`, no `sync` como dice el esquema, para que los textos largos no agoten el timeout síncrono. Fija `sync` de forma explícita si no lo quieres.
- `knowledge_resource_id`: Solo se lee cuando `extraction_mode` es `custom` o `all`; si la carga falla, solo se registra en el log.
- `deduplicate`: Con `false`, `unique_entities` es `null` y `unique_total` vale 0; `entities` siempre conserva todas las menciones.
- `text, context`: No está en el esquema de configuración (está en el contrato de entrada), pero se lee primero de la configuración y luego del payload anterior.
- `timeout_ms`: Solo en modo stream: timeout de inactividad entre fragmentos, por defecto 600000. En modo sync no se aplica a la petición.
- `execution`: Declarado pero ignorado: ni el worker ni el motor leen `retryOnFail`, `maxTries`, `waitBetweenTries`, `continueOnFail`, `alwaysOutputData` ni `timeout_ms` de este bloque.

## Errores

| Mensaje | Puerto | Causa y solución |
| --- | --- | --- |
| `No entity types defined. Configure standard types, custom entities, or a Knowledge Resource.` | `error` | Por ejemplo `extraction_mode: "custom"` sin `custom_entities` ni recurso, o un filtro `entity_types` que no coincide con ningún tipo estándar. |
| `Model did not return valid entity extraction output.` | `error` | La respuesta no era JSON o `entities` no era un arreglo. |
| `[AiEntityExtract] Missing 'llm_provider_id' in node config (LlmProviderModel.id, e.g. 'wf-llm-provider-*'). The legacy 'model_id' alias is no longer supported — update the node config to use 'llm_provider_id'.` | `error` | `llm_provider_id` está vacío o no es un texto. Elige un registro de proveedor LLM con capacidad de chat. |
| `LLM Invocation Error: <backend message>` | `error` | El backend rechazó la llamada: registro de proveedor inexistente o inactivo, error del proveedor, cuota o filtro de contenido. Revisa el registro de proveedor y los logs del backend. |
| `LLM Invocation Error: empty response from backend (<transport error>)` | `error` | Modo sync: falló la llamada HTTP al backend (error de red, estado distinto de 2xx o timeout). Los prompts largos suelen agotar el timeout de la petición; cambia a `invocation_mode: "stream"`. |
| `RemoteApiService.stream: idle timeout after <timeout_ms>ms` | `error` | Modo stream: no llegó ningún fragmento dentro de `timeout_ms`. Si la petición de stream falla, el mensaje es `RemoteApiService.stream: HTTP <status> — <body>`. |

## Notas y límites

- Si `text` está vacío, el worker usa `input`, que en ejecución siempre es el objeto completo que llega del nodo anterior. Por eso la validación de texto faltante nunca se dispara y el objeto se envía al modelo como mensaje. Mapea siempre `text` de forma explícita.
- Como el modo stream es el predeterminado, normalmente no se aplica `temperature: 0` y `raw` no está disponible.
- El worker devuelve `raw` junto a `data`; el motor solo conserva `data` como salida del nodo, así que `raw` no está disponible aguas abajo.
- La llamada al modelo pasa por el backend de Sommatic AI, que resuelve el registro de proveedor indicado en `llm_provider_id` (endpoint, credenciales, despliegue); el orquestador nunca guarda llaves del proveedor. `invocation_mode: "sync"` (por defecto) espera la respuesta completa; `"stream"` la lee como eventos SSE y une los fragmentos.
- `timeout_ms` solo tiene efecto en modo stream, como tiempo máximo de inactividad entre fragmentos (por defecto 600000). En modo sync el valor se registra en el log, pero no se aplica a la petición HTTP, así que rige el timeout por defecto de la plataforma.
- El recurso de conocimiento se lee del backend en cada ejecución (timeout de 10 s). Un recurso cuyo estado no es `active` se usa igual, con una advertencia en el log.
- Sin reintentos automáticos: el motor no aplica `execution.retryOnFail`, `maxTries` ni `waitBetweenTries` en este nodo; una llamada fallida sale directamente por `error`.


## Contratos (JSON Schema)

### All (`*.definition.js`)

```json
{
  "slug": "ai.entity.extract",
  "name": "Extract Entities",
  "category": "ai",
  "version": "1.0.0",
  "description": "Extract named entities from text using LLM-powered recognition.\n\n  Identify people, organizations, locations, dates, monetary amounts, and custom entity types from any unstructured text. Configure entity types or provide your own definitions via Knowledge Resources.\n\n  **Operations:**\n  - **Standard:** Extract common entity types (PERSON, ORG, LOCATION, DATE, MONEY, EMAIL, PHONE, URL).\n  - **Custom:** Define your own entity types with descriptions and examples.\n  - **All:** Combine standard and custom entity extraction.",
  "capabilities": [
    "nlp",
    "ner",
    "extraction",
    "entities"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "llm_provider_id": {
        "type": "string",
        "title": "LLM Provider",
        "description": "The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.",
        "x-ui-widget": "llm-provider-picker",
        "x-llm-provider-capabilities": [
          "chat"
        ]
      },
      "invocation_mode": {
        "type": "string",
        "title": "Invocation Mode",
        "description": "Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.",
        "enum": [
          "sync",
          "stream"
        ],
        "default": "sync"
      },
      "timeout_ms": {
        "type": "integer",
        "title": "Timeout (ms)",
        "description": "Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.",
        "minimum": 1000
      },
      "extraction_mode": {
        "type": "string",
        "title": "Extraction Mode",
        "enum": [
          "standard",
          "custom",
          "all"
        ],
        "default": "standard",
        "description": "Standard extracts common types. Custom uses your definitions. All combines both."
      },
      "entity_types": {
        "type": "array",
        "title": "Entity Types (Standard)",
        "description": "Filter which standard types to extract. Leave empty for all.",
        "items": {
          "type": "string"
        },
        "displayOptions": {
          "show": {
            "extraction_mode": [
              "standard",
              "all"
            ]
          }
        }
      },
      "custom_entities": {
        "type": "array",
        "title": "Custom Entity Definitions",
        "description": "Define custom entity types with name, description, and examples.",
        "items": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "description": "Entity type name (e.g., PRODUCT, DISEASE)"
            },
            "description": {
              "type": "string",
              "description": "What this entity type represents"
            },
            "examples": {
              "type": "string",
              "description": "Comma-separated examples"
            }
          }
        },
        "displayOptions": {
          "show": {
            "extraction_mode": [
              "custom",
              "all"
            ]
          }
        }
      },
      "knowledge_resource_id": {
        "type": "string",
        "title": "Knowledge Resource",
        "description": "Optional: load custom entity definitions from a Knowledge Resource.",
        "ui_widget": "knowledge_resource_picker"
      },
      "language": {
        "type": "string",
        "title": "Language",
        "default": "en",
        "description": "Language of the input text."
      },
      "deduplicate": {
        "type": "boolean",
        "title": "Deduplicate",
        "default": true,
        "description": "Merge duplicate entity mentions into unique entries."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    },
    "required": [
      "extraction_mode"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "description": "Text to extract entities from."
      },
      "context": {
        "type": "string",
        "description": "Optional context to improve extraction accuracy."
      }
    },
    "required": [
      "text"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "entities": {
        "type": "array",
        "description": "Extracted entities with type, text, and confidence."
      },
      "entity_counts": {
        "type": "object",
        "description": "Count per entity type."
      },
      "unique_entities": {
        "type": "object",
        "description": "Deduplicated entities grouped by type."
      }
    }
  },
  "ports": [
    {
      "port_id": "success",
      "label": "Entities Found",
      "description": "At least one entity was extracted.",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "none_found",
      "label": "No Entities",
      "description": "No entities detected in the text.",
      "is_default": false,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Extraction failed.",
      "is_default": false,
      "supports_condition": false
    }
  ],
  "execution_mode": "async",
  "tags": [
    "ai",
    "nlp",
    "ner",
    "entities",
    "extraction"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}
```

### config_schema

```json
{
  "type": "object",
  "properties": {
    "llm_provider_id": {
      "type": "string",
      "title": "LLM Provider",
      "description": "The `id` of a `LlmProviderModel` record (e.g. `wf-llm-provider-*`). The orchestrator delegates to the backend: `POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke` for sync mode, or `POST /chat/conversation/execute/stream-ephemeral` (SSE) for stream mode. The backend resolves endpoint + api-key + deployment from the record and routes to the correct adapter.",
      "x-ui-widget": "llm-provider-picker",
      "x-llm-provider-capabilities": [
        "chat"
      ]
    },
    "invocation_mode": {
      "type": "string",
      "title": "Invocation Mode",
      "description": "Transport for the LLM call. `sync` blocks until the full response arrives. `stream` consumes tokens via SSE (required for long generations). Default `sync`.",
      "enum": [
        "sync",
        "stream"
      ],
      "default": "sync"
    },
    "timeout_ms": {
      "type": "integer",
      "title": "Timeout (ms)",
      "description": "Maximum time to wait for the invocation to complete (or idle timeout between chunks in stream mode). Default 30000 for sync, 600000 for stream.",
      "minimum": 1000
    },
    "extraction_mode": {
      "type": "string",
      "title": "Extraction Mode",
      "enum": [
        "standard",
        "custom",
        "all"
      ],
      "default": "standard",
      "description": "Standard extracts common types. Custom uses your definitions. All combines both."
    },
    "entity_types": {
      "type": "array",
      "title": "Entity Types (Standard)",
      "description": "Filter which standard types to extract. Leave empty for all.",
      "items": {
        "type": "string"
      },
      "displayOptions": {
        "show": {
          "extraction_mode": [
            "standard",
            "all"
          ]
        }
      }
    },
    "custom_entities": {
      "type": "array",
      "title": "Custom Entity Definitions",
      "description": "Define custom entity types with name, description, and examples.",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Entity type name (e.g., PRODUCT, DISEASE)"
          },
          "description": {
            "type": "string",
            "description": "What this entity type represents"
          },
          "examples": {
            "type": "string",
            "description": "Comma-separated examples"
          }
        }
      },
      "displayOptions": {
        "show": {
          "extraction_mode": [
            "custom",
            "all"
          ]
        }
      }
    },
    "knowledge_resource_id": {
      "type": "string",
      "title": "Knowledge Resource",
      "description": "Optional: load custom entity definitions from a Knowledge Resource.",
      "ui_widget": "knowledge_resource_picker"
    },
    "language": {
      "type": "string",
      "title": "Language",
      "default": "en",
      "description": "Language of the input text."
    },
    "deduplicate": {
      "type": "boolean",
      "title": "Deduplicate",
      "default": true,
      "description": "Merge duplicate entity mentions into unique entries."
    },
    "execution": {
      "type": "object",
      "title": "Execution Settings",
      "properties": {
        "alwaysOutputData": {
          "type": "boolean",
          "title": "Always Output Data",
          "description": "Always output data, even on error (if configured).",
          "default": false
        },
        "retryOnFail": {
          "type": "boolean",
          "title": "Retry On Fail",
          "description": "Retry the execution if it fails.",
          "default": false
        },
        "maxTries": {
          "type": "integer",
          "title": "Max Retries",
          "description": "Number of retries.",
          "default": 3,
          "displayOptions": {
            "show": {
              "retryOnFail": [
                true
              ]
            }
          }
        },
        "waitBetweenTries": {
          "type": "integer",
          "title": "Wait Between Retries (ms)",
          "default": 1000,
          "displayOptions": {
            "show": {
              "retryOnFail": [
                true
              ]
            }
          }
        },
        "continueOnFail": {
          "type": "boolean",
          "title": "Continue On Fail",
          "description": "Do not crash workflow on error.",
          "default": false
        },
        "timeout_ms": {
          "type": "integer",
          "title": "Timeout (ms)",
          "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
          "default": 300000
        }
      }
    }
  },
  "required": [
    "extraction_mode"
  ]
}
```

### input_contract_schema

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "Text to extract entities from."
    },
    "context": {
      "type": "string",
      "description": "Optional context to improve extraction accuracy."
    }
  },
  "required": [
    "text"
  ]
}
```

### output_contract_schema

```json
{
  "type": "object",
  "properties": {
    "entities": {
      "type": "array",
      "description": "Extracted entities with type, text, and confidence."
    },
    "entity_counts": {
      "type": "object",
      "description": "Count per entity type."
    },
    "unique_entities": {
      "type": "object",
      "description": "Deduplicated entities grouped by type."
    }
  }
}
```

### ports

```json
[
  {
    "port_id": "success",
    "label": "Entities Found",
    "description": "At least one entity was extracted.",
    "is_default": true,
    "supports_condition": true
  },
  {
    "port_id": "none_found",
    "label": "No Entities",
    "description": "No entities detected in the text.",
    "is_default": false,
    "supports_condition": true
  },
  {
    "port_id": "error",
    "label": "Error",
    "description": "Extraction failed.",
    "is_default": false,
    "supports_condition": false
  }
]
```
