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]

fix(ocr): add missing ocr and aocr to CallTypes enum (#17435)

Cesar Garcia6d831ffff4e2
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 65457fd3039..4861510da24 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -340,6 +340,12 @@ class CallTypes(str, Enum):
generate_content_stream = "generate_content_stream"
agenerate_content_stream = "agenerate_content_stream"
+ #########################################################
+ # OCR Call Types
+ #########################################################
+ ocr = "ocr"
+ aocr = "aocr"
+
#########################################################
# MCP Call Types
#########################################################
diff --git a/tests/test_litellm/test_main.py b/tests/test_litellm/test_main.py
index 71ede0958f5..d2416f8db8c 100644
--- a/tests/test_litellm/test_main.py
+++ b/tests/test_litellm/test_main.py
@@ -1461,3 +1461,43 @@ async def test_async_mock_completion_stream_with_model_response():
accumulated_content += chunk.choices[0].delta.content
assert "This is an async test response" in accumulated_content or len(chunks) > 0
+
+
+class TestCallTypesOCR:
+ """Test that OCR call types are properly defined in CallTypes enum.
+
+ Fixes https://github.com/BerriAI/litellm/issues/17381
+ """
+
+ def test_ocr_call_type_exists(self):
+ """Test that CallTypes.ocr exists and has correct value."""
+ from litellm.types.utils import CallTypes
+
+ assert hasattr(CallTypes, "ocr")
+ assert CallTypes.ocr.value == "ocr"
+
+ def test_aocr_call_type_exists(self):
+ """Test that CallTypes.aocr exists and has correct value."""
+ from litellm.types.utils import CallTypes
+
+ assert hasattr(CallTypes, "aocr")
+ assert CallTypes.aocr.value == "aocr"
+
+ def test_ocr_call_type_from_string(self):
+ """Test that CallTypes can be constructed from 'ocr' string."""
+ from litellm.types.utils import CallTypes
+
+ call_type = CallTypes("ocr")
+ assert call_type == CallTypes.ocr
+
+ def test_aocr_call_type_from_string(self):
+ """Test that CallTypes can be constructed from 'aocr' string.
+
+ This is the actual use case that was failing - the OCR endpoint
+ uses route_type='aocr' and guardrails try to instantiate
+ CallTypes('aocr').
+ """
+ from litellm.types.utils import CallTypes
+
+ call_type = CallTypes("aocr")
+ assert call_type == CallTypes.aocr