Skip to content

create_ai_prompt_config

Public callable

Create the AI prompt-template configuration used by FabricOps.

Use this in 00_env_config to register the prompt templates that power AI-assisted DQ rule generation, governance suggestion generation, and handover summary drafting before downstream notebooks execute.

Parameters:

Name Type Description Default
dq_rule_candidate_template str

Template used to ask Fabric AI for candidate DQ rules.

required
governance_candidate_template str

Template used to ask Fabric AI for governance and classification suggestions.

required
handover_summary_template str

Template used to ask Fabric AI for pipeline handover summaries.

required

Returns:

Type Description
AIPromptConfig

Frozen configuration object containing the validated prompt templates.

Raises:

Type Description
ValueError

Raised when any prompt template is empty or not a string.

Examples:

>>> ai_prompts = create_ai_prompt_config(
...     dq_rule_candidate_template="Generate DQ checks for {table_name}",
...     governance_candidate_template="Suggest governance metadata for {dataset_name}",
...     handover_summary_template="Summarize lineage and handover notes for {pipeline_name}",
... )
>>> ai_prompts.dq_rule_candidate_template
'Generate DQ checks for {table_name}'
Source code in src/fabricops_kit/config.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
def create_ai_prompt_config(
    dq_rule_candidate_template: str,
    governance_candidate_template: str,
    handover_summary_template: str,
) -> AIPromptConfig:
    """Create the AI prompt-template configuration used by FabricOps.

    Use this in ``00_env_config`` to register the prompt templates that power
    AI-assisted DQ rule generation, governance suggestion generation, and
    handover summary drafting before downstream notebooks execute.

    Parameters
    ----------
    dq_rule_candidate_template : str
        Template used to ask Fabric AI for candidate DQ rules.
    governance_candidate_template : str
        Template used to ask Fabric AI for governance and classification suggestions.
    handover_summary_template : str
        Template used to ask Fabric AI for pipeline handover summaries.

    Returns
    -------
    AIPromptConfig
        Frozen configuration object containing the validated prompt templates.

    Raises
    ------
    ValueError
        Raised when any prompt template is empty or not a string.

    Examples
    --------
    >>> ai_prompts = create_ai_prompt_config(
    ...     dq_rule_candidate_template="Generate DQ checks for {table_name}",
    ...     governance_candidate_template="Suggest governance metadata for {dataset_name}",
    ...     handover_summary_template="Summarize lineage and handover notes for {pipeline_name}",
    ... )
    >>> ai_prompts.dq_rule_candidate_template
    'Generate DQ checks for {table_name}'
    """
    for label, value in {
        "dq_rule_candidate_template": dq_rule_candidate_template,
        "governance_candidate_template": governance_candidate_template,
        "handover_summary_template": handover_summary_template,
    }.items():
        if not isinstance(value, str) or not value.strip():
            raise ValueError(f"{label} must be a non-empty string.")

    return AIPromptConfig(
        dq_rule_candidate_template=dq_rule_candidate_template,
        governance_candidate_template=governance_candidate_template,
        handover_summary_template=handover_summary_template,
    )