Skip to content

build_dq_rule_candidate_prompt

Public callable

Build the DQ-candidate prompt used in AI-assisted quality drafting.

In the FabricOps workflow, this supports early quality planning after profiling and before deterministic rule approval.

Parameters:

Name Type Description Default
business_context str

Static business context embedded directly into the prompt text.

''
dataset_name str | None

Static dataset name embedded directly into the prompt text.

None

Returns:

Type Description
str

Prompt template string for use with Fabric DataFrame.ai.generate_response.

Notes

Hardcoded sections define expected JSON output schema and review posture. Row placeholders injected from DataFrame rows are {column_name}, {data_type}, {null_count}, {distinct_count}, and {row_count}. Output is suggestion-oriented and not deterministic enforcement.

Source code in src/fabricops_kit/ai.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
def build_dq_rule_candidate_prompt(business_context="", dataset_name=None, config: FrameworkConfig | None = None) -> str:
    """Build the DQ-candidate prompt used in AI-assisted quality drafting.

    In the FabricOps workflow, this supports early quality planning after
    profiling and before deterministic rule approval.


    Parameters
    ----------
    business_context : str, optional
        Static business context embedded directly into the prompt text.
    dataset_name : str | None, optional
        Static dataset name embedded directly into the prompt text.

    Returns
    -------
    str
        Prompt template string for use with Fabric ``DataFrame.ai.generate_response``.

    Notes
    -----
    Hardcoded sections define expected JSON output schema and review posture.
    Row placeholders injected from DataFrame rows are ``{column_name}``,
    ``{data_type}``, ``{null_count}``, ``{distinct_count}``, and ``{row_count}``.
    Output is suggestion-oriented and not deterministic enforcement.
    """
    template = _resolve_prompt_template(config, "dq_rule_candidate_template", DEFAULT_DQ_RULE_CANDIDATE_TEMPLATE)
    return template.replace("{dataset_name}", dataset_name or "unknown").replace("{business_context}", business_context or "")