Skip to content

build_governance_candidate_prompt

Public callable

Build the governance-candidate prompt for AI-assisted classification drafts.

In the workflow, this is used before final governance labels are approved and written to metadata outputs.

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 allowed candidate labels and output keys. Row placeholders injected from DataFrame rows are {table_name}, {column_name}, {data_type}, and {profile_summary}. Output is suggestion-oriented and requires human review.

Source code in src/fabricops_kit/ai.py
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
def build_governance_candidate_prompt(business_context="", dataset_name=None, config: FrameworkConfig | None = None) -> str:
    """Build the governance-candidate prompt for AI-assisted classification drafts.

    In the workflow, this is used before final governance labels are approved
    and written to metadata outputs.


    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 allowed candidate labels and output keys.
    Row placeholders injected from DataFrame rows are ``{table_name}``,
    ``{column_name}``, ``{data_type}``, and ``{profile_summary}``.
    Output is suggestion-oriented and requires human review.
    """
    template = _resolve_prompt_template(config, "governance_candidate_template", DEFAULT_GOVERNANCE_CANDIDATE_TEMPLATE)
    return template.replace("{dataset_name}", dataset_name or "unknown").replace("{business_context}", business_context or "")