---
name: build_entity_schema_prompt
kind: function
lang: py
domain: datascience
version: "1.0.0"
purity: pure
signature: "def build_entity_schema_prompt(entity_presets: list[dict]) -> str"
description: "Genera la seccion del system prompt que describe los entity types disponibles para extraccion. Formatea los presets del registry en texto legible para el LLM."
tags: [prompt, llm, entity, schema, osint, graph, extraction]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
params:
  - name: entity_presets
    desc: "lista de dicts describiendo tipos de entidad (ej: [{'type_ref': 'osint_person_go_cybersecurity', 'label': 'Person', 'metadata_fields': ['name', 'alias']}])"
output: "string con seccion del system prompt describiendo los entity types en formato legible para LLM"
tested: true
tests:
  - "lista con varios presets"
  - "lista vacia retorna string vacio"
  - "preset sin metadata_fields"
test_file_path: "python/functions/datascience/build_entity_schema_prompt_test.py"
file_path: "python/functions/datascience/build_entity_schema_prompt.py"
---

## Ejemplo

```python
from build_entity_schema_prompt import build_entity_schema_prompt

presets = [
    {
        "type_ref": "osint_person_go_cybersecurity",
        "label": "Person",
        "metadata_fields": ["full_name", "alias", "nationality", "dob", "risk_score"],
    },
    {
        "type_ref": "osint_organization_go_cybersecurity",
        "label": "Organization",
        "metadata_fields": ["legal_name", "country", "sector", "founded", "risk_score"],
    },
]

prompt = build_entity_schema_prompt(presets)
# Entity types available for extraction:
#
# 1. Person (type_ref: osint_person_go_cybersecurity)
#    Attributes: full_name, alias, nationality, dob, risk_score
#
# 2. Organization (type_ref: osint_organization_go_cybersecurity)
#    Attributes: legal_name, country, sector, founded, risk_score
```

## Notas

Funcion pura. No requiere dependencias externas.

El formato de salida es deliberadamente sencillo para maximizar la comprension por el LLM: numero de orden, label humano, type_ref del registry y lista de atributos en una sola linea.

Si un preset no tiene `metadata_fields` (o tiene lista vacia), se omite la linea de atributos.

Pensada para componer con `build_relation_schema_prompt` al construir el system prompt completo de extraccion de grafos OSINT.
