def _prepare_chat_with_tools_compat(
        self,
        tools: Sequence["BaseTool"],
        user_msg: Optional[Union[str, ChatMessage]] = None,
        chat_history: Optional[List[ChatMessage]] = None,
        verbose: bool = False,
        allow_parallel_tool_calls: bool = False,
        tool_required: bool = False,  # if required, LLM should only call tools, and not return a response
        **kwargs: Any,
    ) -> Dict[str, Any]:
        """Prepare the arguments needed to let the LLM chat with tools."""
        # for compatibility with older llm integrations code, check whether the tool_required argument is supported yet
        if not _supports_tool_required(self.__class__, tool_required):
            return self._prepare_chat_with_tools(
                tools=tools,
                user_msg=user_msg,
                chat_history=chat_history,
                verbose=verbose,
                allow_parallel_tool_calls=allow_parallel_tool_calls,
                **kwargs,
            )
        return self._prepare_chat_with_tools(
            tools=tools,
            user_msg=user_msg,
            chat_history=chat_history,
            verbose=verbose,
            allow_parallel_tool_calls=allow_parallel_tool_calls,
            tool_required=tool_required,
            **kwargs,
        )
Prepare the arguments needed to let the LLM chat with tools.
llama-index-core/llama_index/core/llms/function_calling.py