The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(arize): decline prompt management runs without a prompt_id
mateo-berrib780b1e23c16
diff --git a/litellm/integrations/arize/arize_phoenix_prompt_manager.py b/litellm/integrations/arize/arize_phoenix_prompt_manager.pyindex fa178a02752..71f4902bbe5 100644--- a/litellm/integrations/arize/arize_phoenix_prompt_manager.py+++ b/litellm/integrations/arize/arize_phoenix_prompt_manager.py@@ -359,10 +359,10 @@ class ArizePhoenixPromptManager(CustomPromptManagement):"""Determine if prompt management should run based on the prompt_id.- For Arize Phoenix, we always return True and handle the prompt loading- in the _compile_prompt_helper method.+ Arize Phoenix needs a prompt_id to compile, so it declines requests without one;+ prompt loading itself happens in the _compile_prompt_helper method."""- return True+ return prompt_id is not Nonedef _compile_prompt_helper(self,diff --git a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py b/tests/test_litellm/litellm_core_utils/test_litellm_logging.pyindex 05aa65034fb..db64340f895 100644--- a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py+++ b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py@@ -5113,6 +5113,7 @@ def test_prompt_hooks_skip_prompt_managers_when_no_prompt_id(logging_obj, tmp_pawith a registered prompt manager (e.g. dotprompt): requests without a prompt_id 500'd with"prompt_id is required for Prompt Management Base class" instead of completing normally."""+ from litellm.integrations.arize.arize_phoenix_prompt_manager import ArizePhoenixPromptManagerfrom litellm.integrations.dotprompt.dotprompt_manager import DotpromptManagerfrom litellm.integrations.vector_store_integrations.vector_store_pre_call_hook import (VectorStorePreCallHook,@@ -5122,7 +5123,9 @@ def test_prompt_hooks_skip_prompt_managers_when_no_prompt_id(logging_obj, tmp_pa(tmp_path / "stem.prompt").write_text("---\nmodel: gemini-2.5-flash\n---\nyou are a stem tutor\n")dotprompt_manager = DotpromptManager(prompt_directory=str(tmp_path))+ arize_manager = ArizePhoenixPromptManager(api_key="fake-key", api_base="http://127.0.0.1:9")litellm.logging_callback_manager.add_litellm_callback(dotprompt_manager)+ litellm.logging_callback_manager.add_litellm_callback(arize_manager)monkeypatch.setattr(litellm,"vector_store_registry",@@ -5154,6 +5157,10 @@ def test_prompt_hooks_skip_prompt_managers_when_no_prompt_id(logging_obj, tmp_padynamic_callback_params={},) == ("gemini-2.5-flash", messages, {})+ assert not arize_manager.should_run_prompt_management(+ prompt_id=None, prompt_spec=None, dynamic_callback_params={}+ )+assert logging_obj.should_run_prompt_management_hooks(prompt_id=None, non_default_params={"vector_store_ids": ["vs_123"]})@@ -5177,9 +5184,10 @@ def test_prompt_hooks_skip_prompt_managers_when_no_prompt_id(logging_obj, tmp_paDotpromptManager,)finally:- litellm.logging_callback_manager.remove_callback_from_list_by_object(litellm.callbacks, dotprompt_manager)- litellm.logging_callback_manager.remove_callback_from_list_by_object(- litellm._async_success_callback, dotprompt_manager- )+ for manager in (dotprompt_manager, arize_manager):+ litellm.logging_callback_manager.remove_callback_from_list_by_object(litellm.callbacks, manager)+ litellm.logging_callback_manager.remove_callback_from_list_by_object(+ litellm._async_success_callback, manager+ )for hook in [cb for cb in litellm.callbacks if isinstance(cb, VectorStorePreCallHook)]:litellm.logging_callback_manager.remove_callback_from_list_by_object(litellm.callbacks, hook)