{"record":{"id":"384b09970ab79fa5","repo":"BerriAI/litellm","slug":"transform-search-request-must-be-implemented-by-pr","errorCode":null,"errorMessage":"transform_search_request must be implemented by provider","messagePattern":"transform_search_request must be implemented by provider","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/search/transformation.py","lineNumber":230,"sourceCode":"\n    def transform_search_request(\n        self,\n        query: str | list[str],\n        optional_params: dict,\n        **kwargs,\n    ) -> dict | list[dict]:\n        \"\"\"\n        Transform Search request to provider-specific format.\n        Override in provider-specific implementations.\n\n        Args:\n            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,","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/search/transformation.py#L212-L248","documentation":"BaseSearchConfig.transform_search_request() is the abstract hook converting a normalized search query (str or list[str]) plus optional_params into the provider's request body. The base raises NotImplementedError. The error means the search path executed against the base/incomplete config, so no provider payload could be built.","triggerScenarios":"litellm.search(...) dispatching to a search config that does not override transform_search_request — custom providers with partial implementations, or a misregistered handler.","commonSituations":"Implementing a custom search provider and finishing get_complete_url but not the body transformer; upgrading litellm to a version that formalized this interface on your subclass.","solutions":["Implement `def transform_search_request(self, query, optional_params, **kwargs) -> dict | list[dict]` in your custom config, mapping query/params into the provider schema.","Or route the request to a built-in provider config that already implements it.","Add unit tests instantiating each custom search config and calling all four hooks to catch gaps before runtime."],"exampleFix":"# before\nclass MySearch(BaseSearchConfig):\n    def get_complete_url(self, *a, **k): ...\n    # no transform_search_request -> NotImplementedError\n\n# after\nclass MySearch(BaseSearchConfig):\n    def transform_search_request(self, query, optional_params, **kwargs):\n        return {\"q\": query, \"num\": optional_params.get(\"num_results\", 10), **optional_params}","handlingStrategy":"type-guard","validationCode":"from litellm.llms.base_llm.search.transformation import BaseSearchConfig\n\nassert type(cfg).transform_search_request is not BaseSearchConfig.transform_search_request","typeGuard":"from litellm.llms.base_llm.search.transformation import BaseSearchConfig\n\ndef supports_search_request_transform(cfg: BaseSearchConfig) -> bool:\n    return type(cfg).transform_search_request is not BaseSearchConfig.transform_search_request","tryCatchPattern":null,"preventionTips":["Implement the full search-provider trio (url, request, response) in one commit; partial ports are the common cause.","Unit-test request transformation against a recorded provider payload fixture."],"tags":["search-api","not-implemented","request-transform","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}