def _format_oci_tool_calls(
    tool_calls: Optional[List[Any]] = None,
) -> List[Dict]:
    """
    Formats an OCI GenAI API response into the tool call format used in LlamaIndex.
    Handles both dictionary and object formats.
    """
    if not tool_calls:
        return []

    formatted_tool_calls = []
    for tool_call in tool_calls:
        # Handle both object and dict formats
        if isinstance(tool_call, dict):
            name = tool_call.get("name", tool_call.get("functionName"))
            parameters = tool_call.get(
                "parameters", tool_call.get("functionParameters")
            )
        else:
            name = getattr(tool_call, "name", getattr(tool_call, "functionName", None))
            parameters = getattr(
                tool_call, "parameters", getattr(tool_call, "functionParameters", None)
            )

        if name and parameters:
            formatted_tool_calls.append(
                {
                    "toolUseId": uuid.uuid4().hex[:],
                    "name": name,
                    "input": json.dumps(parameters)
                    if isinstance(parameters, dict)
                    else parameters,
                }
            )

    return formatted_tool_calls

    Formats an OCI GenAI API response into the tool call format used in LlamaIndex.
    Handles both dictionary and object formats.
    
llama-index-integrations/llms/llama-index-llms-oci-genai/llama_index/llms/oci_genai/utils.py