Skip to content

configure_fabric_ai_functions

Public callable

Apply optional default Fabric AI Function configuration.

Parameters:

Name Type Description Default
deployment_name str | None

Optional deployment name applied through aifunc.default_conf when supported by the runtime.

None
temperature float

Optional generation temperature applied when supported.

0.0

Returns:

Type Description
dict

Configuration result with availability and message fields.

Notes

This helper configures runtime defaults only; it does not execute model calls.

Source code in src/fabricops_kit/ai.py
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
def configure_fabric_ai_functions(deployment_name: str | None = None, temperature: float = 0.0) -> dict:
    """Apply optional default Fabric AI Function configuration.

    Parameters
    ----------
    deployment_name : str | None, optional
        Optional deployment name applied through ``aifunc.default_conf`` when
        supported by the runtime.
    temperature : float, default=0.0
        Optional generation temperature applied when supported.

    Returns
    -------
    dict
        Configuration result with availability and message fields.

    Notes
    -----
    This helper configures runtime defaults only; it does not execute model calls.
    """
    try:
        import synapse.ml.spark.aifunc as aifunc
    except Exception as exc:  # pragma: no cover
        return {"available": False, "configured": False, "message": f"Microsoft Fabric AI Functions are unavailable. Import error: {exc}"}
    conf = getattr(aifunc, "default_conf", None)
    if conf is None:
        return {"available": True, "configured": False, "message": "aifunc.default_conf is not available in this runtime."}
    if deployment_name and hasattr(conf, "set_deployment_name"):
        conf.set_deployment_name(deployment_name)
    if hasattr(conf, "set_temperature"):
        conf.set_temperature(float(temperature))
    return {"available": True, "configured": True, "message": "Microsoft Fabric AI Functions default configuration applied."}