def get_tool_calls_from_response(
        self,
        response: ChatResponse,
        error_on_no_tool_call: bool = True,
        **kwargs: Any,
    ) -> List[ToolSelection]:
        """
        Extract tool calls from the chat response.

        Args:
            response (ChatResponse): The chat response containing tool calls.
            error_on_no_tool_call (bool): Whether to raise an error if no tool calls are found.
            **kwargs: Additional keyword arguments.

        Returns:
            List[ToolSelection]: A list of tool selections extracted from the response.

        Raises:
            ValueError: If no tool calls are found and error_on_no_tool_call is True.

        """
        tool_calls = response.message.additional_kwargs.get("tool_calls", [])
        logger.debug(f"Getting tool calls from response: {tool_calls}")

        if len(tool_calls) < 1:
            if error_on_no_tool_call:
                raise ValueError(
                    f"Expected at least one tool call, but got {len(tool_calls)} tool calls."
                )
            else:
                return []

        tool_selections = []
        for tool_call in tool_calls:
            if tool_call.get("type") != "function":
                raise ValueError(f"Invalid tool type detected: {tool_call.get('type')}")

            # Handle both complete and partial JSON
            try:
                argument_dict = parse_partial_json(
                    tool_call.get("function", {}).get("arguments", {})
                )
            except ValueError as e:
                logger.debug(f"Failed to parse tool call arguments: {e!s}")
                argument_dict = {}

            tool_selections.append(
                ToolSelection(
                    tool_id=tool_call.get("id"),
                    tool_name=tool_call.get("function", {}).get("name"),
                    tool_kwargs=argument_dict,
                )
            )

        logger.debug(
            f"Extracted tool calls: {[tool_selection.model_dump() for tool_selection in tool_selections]}"
        )
        return tool_selections

        Extract tool calls from the chat response.

        Args:
            response (ChatResponse): The chat response containing tool calls.
            error_on_no_tool_call (bool): Whether to raise an error if no tool calls are found.
            **kwargs: Additional keyword arguments.

        Returns:
            List[ToolSelection]: A list of tool selections extracted from the response.

        Raises:
            ValueError: If no tool calls are found and error_on_no_tool_call is True.

        
llama-index-integrations/llms/llama-index-llms-oci-data-science/llama_index/llms/oci_data_science/base.py