buildPrompt method presentation ✓ 100.0%
Last updated: 2026-03-01T23:25:47.068Z
Metrics
LOC: 27
Complexity: 5
Params: 1
Coverage: 100.0% (10/10 lines, 12x executed)
Signature
buildPrompt(input: FieldClassifierInput): : string
Source Code
buildPrompt(input: FieldClassifierInput): string {
const base = renderPromptBase(this);
const sections: string[] = [];
// Element HTML (truncated for token economy)
const html =
input.elementHtml.length > MAX_ELEMENT_HTML_CHARS
? input.elementHtml.slice(0, MAX_ELEMENT_HTML_CHARS) + "…"
: input.elementHtml;
sections.push(`=== Element HTML ===\n${html}`);
// Surrounding container HTML
if (input.contextHtml) {
const ctx =
input.contextHtml.length > MAX_CONTEXT_HTML_CHARS
? input.contextHtml.slice(0, MAX_CONTEXT_HTML_CHARS) + "…"
: input.contextHtml;
sections.push(`=== Surrounding HTML ===\n${ctx}`);
}
// Pre-computed text signals
if (input.signals?.trim()) {
sections.push(`=== Field Signals ===\n${input.signals}`);
}
return `${base}\n\nClassify this form field:\n\n${sections.join("\n\n")}`;
},
Dependencies (Outgoing)
| Target | Type |
|---|---|
| renderPromptBase | calls |
No incoming dependencies.