Skip to content

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]

test(guardrails): type the recording guardrail logging_obj as the logging object

yuchengb237c185db84
diff --git a/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.py b/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.py
index 2f56838cbb2..eaa2c4e8b9a 100644
--- a/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.py
+++ b/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.py
@@ -2637,7 +2637,7 @@ class TypedInputsRecordingGuardrail(CustomGuardrail):
inputs: GenericGuardrailAPIInputs,
request_data: dict,
input_type: Literal["request", "response"],
- logging_obj: Optional[Any] = None,
+ logging_obj: Optional[LiteLLMLoggingObj] = None,
) -> GenericGuardrailAPIInputs:
self.seen.append((input_type, inputs))
return inputs
diff --git a/tests/test_litellm/llms/openai/chat/guardrail_translation/test_openai_guardrail_handler.py b/tests/test_litellm/llms/openai/chat/guardrail_translation/test_openai_guardrail_handler.py
index c6ff16323d2..e4e9f5d33db 100644
--- a/tests/test_litellm/llms/openai/chat/guardrail_translation/test_openai_guardrail_handler.py
+++ b/tests/test_litellm/llms/openai/chat/guardrail_translation/test_openai_guardrail_handler.py
@@ -12,6 +12,7 @@ import pytest
from litellm.integrations.custom_guardrail import CustomGuardrail
+from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
from litellm.llms.base_llm.guardrail_translation.base_translation import StreamingScanKey
from litellm.llms.openai.chat.guardrail_translation.handler import (
OpenAIChatCompletionsHandler,
@@ -2262,7 +2263,7 @@ class InputsRecordingGuardrail(CustomGuardrail):
inputs: GenericGuardrailAPIInputs,
request_data: dict,
input_type: Literal["request", "response"],
- logging_obj: Optional[Any] = None,
+ logging_obj: Optional[LiteLLMLoggingObj] = None,
) -> GenericGuardrailAPIInputs:
self.seen.append((input_type, inputs))
return inputs
diff --git a/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py b/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py
index 0aba4d67206..d461b939553 100644
--- a/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py
+++ b/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py
@@ -3264,7 +3264,7 @@ class TypedInputsRecordingGuardrail(CustomGuardrail):
inputs: GenericGuardrailAPIInputs,
request_data: dict,
input_type: Literal["request", "response"],
- logging_obj: Optional[Any] = None,
+ logging_obj: Optional[LiteLLMLoggingObj] = None,
) -> GenericGuardrailAPIInputs:
self.seen.append((input_type, inputs))
return inputs