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)

graph LR buildPrompt["buildPrompt"] renderPromptBase["renderPromptBase"] buildPrompt -->|calls| renderPromptBase style buildPrompt fill:#dbeafe,stroke:#2563eb,stroke-width:2px click buildPrompt "866645bc66f61421.html" click renderPromptBase "1d807d7283d93d7a.html"
TargetType
renderPromptBase calls

No incoming dependencies.