def extract_json_content(input_str):
    """
    Extracts JSON content from a string by isolating the portion enclosed
    between the ``` markers, optionally preceded by the 'json' tag.

    Args:
        input_str (str): The input string containing JSON content.

    Returns:
        str: Extracted JSON string or an empty string if no JSON is found.
    """
    # Use regex to find content between triple backticks
    match = re.search(r"```(?:json)?\s*(.*?)\s*```", input_str, re.DOTALL)
    if match:
        return fix_trailing_comma(match.group(1).strip())
    return ""  # Return an empty string if no match is found

    Extracts JSON content from a string by isolating the portion enclosed
    between the ``` markers, optionally preceded by the 'json' tag.

    Args:
        input_str (str): The input string containing JSON content.

    Returns:
        str: Extracted JSON string or an empty string if no JSON is found.
    
PFPO/post_processors/openai_api_callback.py