feat: funciones Python datascience, finance, cybersecurity y pipelines
Datascience: aggregate_by_group, deduplicate_entities/relations, detect_drift, diff_entities/relations, extract_entities/relations_llm, hotness_score, melt, merge_graphs, pivot, build_entity/relation_schema_prompt. Finance: avellaneda_stoikov_quotes, generate_gbm_prices, generate_taker_order, hawkes_intensity + módulo finance.py. Cybersecurity: envelope_encrypt/decrypt + módulo cybersecurity.py. Pipelines: extraction_pipeline, monte_carlo_market, run_market_sim. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
---
|
||||
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: []
|
||||
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.
|
||||
Reference in New Issue
Block a user