Skip to content

parse_manual_ai_json_response

Public callable

Parse manual AI JSON output into Python objects.

Parameters:

Name Type Description Default
text str

Raw text expected to contain JSON.

required

Returns:

Type Description
Any

Parsed JSON payload.

Raises:

Type Description
ValueError

Raised when parsing fails.

Source code in src/fabricops_kit/ai.py
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
def parse_manual_ai_json_response(text):
    """Parse manual AI JSON output into Python objects.

    Parameters
    ----------
    text : str
        Raw text expected to contain JSON.

    Returns
    -------
    Any
        Parsed JSON payload.

    Raises
    ------
    ValueError
        Raised when parsing fails.
    """
    try:
        return json.loads(text)
    except Exception as exc:
        raise ValueError("Failed to parse manual AI response as JSON.") from exc