BerriAI/litellm · error · NotImplementedError

Custom prompt management does not support async compile prom

Error message

Custom prompt management does not support async compile prompt helper

What it means

The async twin: async_compile_prompt_helper is a NotImplementedError stub on CustomPromptManagement. Subclasses that only implement sync compilation (or none) will raise this when awaited, telling you the subclass must provide the async implementation.

Source

Thrown at litellm/integrations/custom_prompt_management.py:75

        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. Implement async_compile_prompt_helper in your subclass (async def ... returning PromptManagementClient)
  2. Or call the sync _compile_prompt_helper if that is what your subclass implements
  3. Guard with a capability check before awaiting the helper

Example fix

# before
class MyPrompts(CustomPromptManagement):
    def _compile_prompt_helper(self, *a, **k): ...  # sync only
await manager.async_compile_prompt_helper(...)  # NotImplementedError

# after
class MyPrompts(CustomPromptManagement):
    async def async_compile_prompt_helper(self, prompt_id, prompt_variables, dynamic_callback_params, **k):
        return PromptManagementClient(prompt=await compile_async(prompt_id, prompt_variables))
Defensive patterns

Strategy: type-guard

Validate before calling

from litellm.integrations.custom_prompt_management import CustomPromptManagement

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

Type guard

from litellm.integrations.custom_prompt_management import CustomPromptManagement

def implements_async_compile(manager) -> bool:
    return type(manager).async_compile_prompt_helper is not CustomPromptManagement.async_compile_prompt_helper

Try / catch

except NotImplementedError as e:
    if 'async compile prompt helper' in str(e):
        call the sync _compile_prompt_helper instead if the subclass implements it
    raise

Prevention

When it happens

Trigger: await handler.async_compile_prompt_helper(...) on a subclass overriding only _compile_prompt_helper or only get_prompt; framework code defaulting to the async API across all prompt managers.

Common situations: Migrating a sync prompt integration into an async proxy pipeline; partially-implemented subclasses caught by generic callers.

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/4e625e7a9595b7a4. Report an issue: GitHub.