Skip to content

build_manual_dq_rule_prompt_package

Public callable

Build copy/paste prompt package for manual DQ candidate generation.

Parameters:

Name Type Description Default
sample_rows Any

Optional small sample context serialized compactly for prompt ferry usage.

None
business_context str

Static context embedded in prompt text.

''
dataset_name str | None

Static dataset name embedded in prompt text.

None

Returns:

Type Description
dict

Manual package containing reusable prompt text, schema expectations, and notes. Output is advisory and requires human review.

Source code in src/fabricops_kit/ai.py
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
def build_manual_dq_rule_prompt_package(sample_rows=None, business_context="", dataset_name=None, config: FrameworkConfig | None = None) -> dict:
    """Build copy/paste prompt package for manual DQ candidate generation.

    Parameters
    ----------
    sample_rows : Any, optional
        Optional small sample context serialized compactly for prompt ferry usage.
    business_context : str, optional
        Static context embedded in prompt text.
    dataset_name : str | None, optional
        Static dataset name embedded in prompt text.

    Returns
    -------
    dict
        Manual package containing reusable prompt text, schema expectations, and
        notes. Output is advisory and requires human review.
    """
    prompt = build_dq_rule_candidate_prompt(business_context=business_context, dataset_name=dataset_name, config=config)
    compact = _compact_sample_rows(sample_rows)
    return {
        "mode": "manual_prompt_ferry",
        "target_use": "dq_rule_candidates",
        "prompt": prompt,
        "full_prompt_text": f"{prompt}\n\nSample rows:\n{compact}" if compact else prompt,
        "expected_output_schema": ["rule_id", "table_name", "column_name", "rule_type", "severity", "reason", "evidence", "needs_human_review"],
        "notes": "Paste prompt into Copilot or another LLM, then review before storing approved deterministic rules.",
        "sample_rows": compact,
    }