{"record":{"id":"5320e9a20f67fa00","repo":"BerriAI/litellm","slug":"transform-search-response-must-be-implemented-by-p","errorCode":null,"errorMessage":"transform_search_response must be implemented by provider","messagePattern":"transform_search_response must be implemented by provider","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/search/transformation.py","lineNumber":242,"sourceCode":"            query: Search query (string or list of strings)\n            optional_params: Optional parameters for the request\n\n        Returns:\n            Dict with request data\n        \"\"\"\n        raise NotImplementedError(\"transform_search_request must be implemented by provider\")\n\n    def transform_search_response(\n        self,\n        raw_response: httpx.Response,\n        logging_obj: LiteLLMLoggingObj,\n        **kwargs,\n    ) -> SearchResponse:\n        \"\"\"\n        Transform provider-specific Search response to standard format.\n        Override in provider-specific implementations.\n        \"\"\"\n        raise NotImplementedError(\"transform_search_response must be implemented by provider\")\n\n    def get_error_class(\n        self,\n        error_message: str,\n        status_code: int,\n        headers: dict,\n    ) -> Exception:\n        \"\"\"Get appropriate error class for the provider.\"\"\"\n        return BaseLLMException(\n            status_code=status_code,\n            message=error_message,\n            headers=headers,\n        )\n","sourceCodeStart":224,"sourceCodeEnd":256,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/search/transformation.py#L224-L256","documentation":"BaseSearchConfig.transform_search_response() converts the provider's raw httpx.Response into LiteLLM's normalized SearchResponse. It is an abstract stub raising NotImplementedError. Encountering it means a search request succeeded at the HTTP layer but the active config never implemented response parsing (base class or incomplete custom provider), so results cannot be normalized.","triggerScenarios":"A provider returns 2xx from the search endpoint, then litellm calls transform_search_response on a config lacking the override — custom providers, or fallback-to-base routing.","commonSituations":"Custom search provider implementations that built and sent the request but never wrote the response mapper; schema drift after a litellm upgrade changed SearchResponse expectations.","solutions":["Implement `def transform_search_response(self, raw_response, logging_obj, **kwargs) -> SearchResponse` mapping provider JSON (results, titles, urls, snippets) into SearchResponse.","Or use a built-in provider whose transformation is complete.","Mirror the structure of an existing implementation (e.g. litellm/llms/gemini or exa search transformation) to satisfy the SearchResponse contract."],"exampleFix":"# before\nclass MySearch(BaseSearchConfig):\n    ...  # no transform_search_response -> NotImplementedError on 2xx\n\n# after\nfrom litellm.types.llms.openai import SearchResponse, SearchResponseResult\n\nclass MySearch(BaseSearchConfig):\n    def transform_search_response(self, raw_response, logging_obj, **kwargs) -> SearchResponse:\n        data = raw_response.json()\n        return SearchResponse(results=[\n            SearchResponseResult(title=r[\"title\"], url=r[\"link\"], snippet=r[\"snippet\"])\n            for r in data[\"items\"]\n        ])","handlingStrategy":"type-guard","validationCode":"from litellm.llms.base_llm.search.transformation import BaseSearchConfig\n\nassert type(cfg).transform_search_response is not BaseSearchConfig.transform_search_response","typeGuard":"from litellm.llms.base_llm.search.transformation import BaseSearchConfig\n\ndef supports_search_response_transform(cfg: BaseSearchConfig) -> bool:\n    return type(cfg).transform_search_response is not BaseSearchConfig.transform_search_response","tryCatchPattern":null,"preventionTips":["Keep a recorded 2xx response fixture per provider and test the mapper against it.","Check SearchResponse schema on litellm upgrades; response shape changes surface here."],"tags":["search-api","not-implemented","response-transform","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}