add-field
Add predefined field definitions to the Prompture field registry. Handles field structure, categories, template variables, enum support, and thread-safe registration. Use when adding reusable extraction fields.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Add Field Definitions
Adds new fields to the global BASE_FIELD_DEFINITIONS registry in prompture/field_definitions.py.
Before Starting
Ask the user for each field:
-
Field name — lowercase, underscore-separated (e.g.
linkedin_url,blood_type) - Category — Person, Contact, Professional, Financial, Location, Education, Demographic, Social Media, Task Management, or a new one
-
Type —
str,int,float,bool,list,dict - Description — what this field represents
- Instructions — how the LLM should extract or compute the value
-
Default — type-appropriate:
""for str,0for int,0.0for float,[]for list,Falsefor bool -
Nullable —
Trueif the field can legitimately be absent - Enum values (optional) — list of allowed string values
Field Structure
"field_name": {
"type": str,
"description": "What this field represents.",
"instructions": "How the LLM should extract or compute this value.",
"default": "",
"nullable": False,
},
Optional keys
-
"enum":["low", "medium", "high"] - Template variables in
instructions:{{current_year}},{{current_date}},{{current_datetime}},{{current_month}},{{current_day}},{{current_weekday}},{{current_iso_week}}
Steps
1. Edit prompture/field_definitions.py
Add fields to BASE_FIELD_DEFINITIONS under the right category comment. If the category is new, add a comment header:
# ── Medical Fields ──────────────────────────────────
Alphabetical order within each category.
2. Verify
python -c "from prompture.field_definitions import get_field_definition; print(get_field_definition('field_name'))"
pytest tests/test_field_definitions.py -x -q
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!