BerriAI/litellm · error · NotImplementedError

Custom prompt management does not support compile prompt hel

Error message

Custom prompt management does not support compile prompt helper

What it means

CustomPromptManagement ships _compile_prompt_helper as a NotImplementedError stub: synchronous prompt compilation is only meaningful for concrete integrations that know their backend. Calling it on the base class or on a subclass that does not override it raises immediately with this message.

Source

Thrown at litellm/integrations/custom_prompt_management.py:64

    def should_run_prompt_management(
        self,
        prompt_id: str | None,
        prompt_spec: PromptSpec | None,
        dynamic_callback_params: StandardCallbackDynamicParams,
    ) -> bool:
        return True

    def _compile_prompt_helper(
        self,
        prompt_id: str | None,
        prompt_spec: PromptSpec | None,
        prompt_variables: dict | None,
        dynamic_callback_params: StandardCallbackDynamicParams,
        prompt_label: str | None = None,
        prompt_version: int | None = None,
    ) -> PromptManagementClient:
        raise NotImplementedError("Custom prompt management does not support compile prompt helper")

    async def async_compile_prompt_helper(
        self,
        prompt_id: str | None,
        prompt_variables: dict | None,
        dynamic_callback_params: StandardCallbackDynamicParams,
        prompt_spec: PromptSpec | None = None,
        prompt_label: str | None = None,
        prompt_version: int | None = None,
    ) -> PromptManagementClient:
        raise NotImplementedError("Custom prompt management does not support async compile prompt helper")

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use the async path (async_compile_prompt_helper) if the subclass implements it, or the higher-level prompt-management entry points
  2. Override _compile_prompt_helper in your subclass to build and return the PromptManagementClient
  3. Gate calls on whether the subclass actually overrides the method before invoking

Example fix

# before
class MyPrompts(CustomPromptManagement):
    def get_prompt(self, *a, **k): ...
manager._compile_prompt_helper(...)  # NotImplementedError

# after
class MyPrompts(CustomPromptManagement):
    def _compile_prompt_helper(self, prompt_id, prompt_spec, prompt_variables, dynamic_callback_params, **k):
        return PromptManagementClient(prompt=compile(prompt_id, prompt_variables))
Defensive patterns

Strategy: type-guard

Validate before calling

from litellm.integrations.custom_prompt_management import CustomPromptManagement

if type(manager)._compile_prompt_helper is CustomPromptManagement._compile_prompt_helper:
    raise NotImplementedError(f'{type(manager).__name__} does not implement sync prompt compilation')

Type guard

from litellm.integrations.custom_prompt_management import CustomPromptManagement

def implements_sync_compile(manager) -> bool:
    return type(manager)._compile_prompt_helper is not CustomPromptManagement._compile_prompt_helper

Try / catch

except NotImplementedError as e:
    if 'compile prompt helper' in str(e):
        fall back to async_compile_prompt_helper or the subclass's own compile API
    raise

Prevention

When it happens

Trigger: Calling handler._compile_prompt_helper(prompt_id, ...) on a CustomPromptManagement subclass that only implements get_prompt; generic orchestration code probing the sync helper unconditionally on arbitrary prompt managers.

Common situations: Building pluggable prompt-management abstractions over CustomPromptManagement; porting a read-only prompt integration that never compiled prompts; test harnesses iterating all helper methods.

Understand the failure class

Background: "NotImplementedError: Subclasses should override this method" / "must be implemented" — abstract method errors explained — this error's family across 40 libraries.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/e19a19132735622d. Report an issue: GitHub.