def __init__(self, api_key: str, base_url: str = None, timeout: int = 10):
        """
        Initialize the SerpAPI client.
        :param api_key: API key for SerpAPI.
        :param base_url: Optional base URL for the API.
        :param timeout: Timeout for API requests in seconds.
        """
        if not api_key:
            raise ValueError("API key is required for SerpAPI.")
        self.api_key = api_key
        self.base_url = base_url or self.BASE_URL
        self.timeout = timeout

        # Configure retries
        retry_strategy = Retry(
            total=self.RETRY_TOTAL,
            backoff_factor=self.RETRY_BACKOFF_FACTOR,
            status_forcelist=self.RETRY_STATUS_CODES,
        )
        self.session = requests.Session()
        adapter = HTTPAdapter(max_retries=retry_strategy)
        self.session.mount("https://", adapter)

        Initialize the SerpAPI client.
        :param api_key: API key for SerpAPI.
        :param base_url: Optional base URL for the API.
        :param timeout: Timeout for API requests in seconds.
        
backend/director/tools/serp.py