def _select(
        self, choices: Sequence[ToolMetadata], query: QueryBundle, timeout: int = None
    ) -> SelectorResult:
        """
        Call Not Diamond to select the best LLM for the given prompt, then have the LLM select the best tool.
        """
        messages = [
            {"role": "system", "content": self._format_prompt(choices, query)},
            {"role": "user", "content": query.query_str},
        ]

        session_id, best_llm = self._client.model_select(
            messages=messages,
            llm_configs=self._client.llm_configs,
            metric=self._metric,
            notdiamond_api_key=self._client.api_key,
            max_model_depth=self._client.max_model_depth,
            hash_content=self._client.hash_content,
            tradeoff=self._client.tradeoff,
            preference_id=self._client.preference_id,
            tools=self._client.tools,
            timeout=timeout or self._timeout,
        )

        self._llm = self._llm_config_to_client(best_llm)

        return NotDiamondSelectorResult.from_selector_result(
            super()._select(choices, query), session_id, best_llm
        )

        Call Not Diamond to select the best LLM for the given prompt, then have the LLM select the best tool.
        
llama-index-integrations/selectors/llama-index-selectors-notdiamond/llama_index/selectors/notdiamond/base.py