mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-17 04:17:43 +00:00
* [Feat] Add native litellm.ocr() functions (#15567) * fix get_supported_ocr_params * add get_provider_ocr_config * init OCR * init ocr functions * add OCRResponse Base Model * add ocr to llm http handlers * add main.py for OCR * fix linting for OCR * TestMistralOCR * update to use DocumentType for Mistral * fix _prepare_ocr_request * fix transform * add main.py for OCR * add spec to init * fix OCR * TestMistralOCR * ruff fix * Potential fix for code scanning alert no. 3521: Clear-text logging of sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * [Feat] Add /ocr route on LiteLLM AI Gateway - Adds support for native mistral ocr calling (#15571) * fix get_supported_ocr_params * add get_provider_ocr_config * init OCR * init ocr functions * add OCRResponse Base Model * add ocr to llm http handlers * add main.py for OCR * fix linting for OCR * TestMistralOCR * update to use DocumentType for Mistral * fix _prepare_ocr_request * fix transform * add main.py for OCR * add spec to init * fix OCR * TestMistralOCR * ruff fix * add router.ocr() methods * add OCR routes * feat add ocr routes * add OCR routes * feat: add OCR routes in proxy server * working /ocr routes * test_router_aocr_with_mistral * docs Mistral OCR * docs OCR * [Feat] Add Azure AI Mistral OCR Integration (#15572) * fix get_supported_ocr_params * add get_provider_ocr_config * init OCR * init ocr functions * add OCRResponse Base Model * add ocr to llm http handlers * add main.py for OCR * fix linting for OCR * TestMistralOCR * update to use DocumentType for Mistral * fix _prepare_ocr_request * fix transform * add main.py for OCR * add spec to init * fix OCR * TestMistralOCR * ruff fix * add router.ocr() methods * add OCR routes * feat add ocr routes * add OCR routes * feat: add OCR routes in proxy server * working /ocr routes * test_router_aocr_with_mistral * docs Mistral OCR * docs OCR * add azure ai to get_provider_ocr_config * add AzureAIOCRConfig * TestAzureAIOCR * TestAzureAIOCR * test fixes for azure ai ocr * fix async OCR transform for Azure * fix transform_ocr_request --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
28 lines
917 B
Python
28 lines
917 B
Python
"""
|
|
Test OCR functionality with Azure AI API.
|
|
|
|
Note: Azure AI OCR automatically converts URLs to base64 data URIs since
|
|
the Azure AI endpoint doesn't have internet access.
|
|
"""
|
|
import os
|
|
from base_ocr_unit_tests import BaseOCRTest
|
|
|
|
class TestAzureAIOCR(BaseOCRTest):
|
|
"""
|
|
Test class for Azure AI OCR functionality.
|
|
Inherits from BaseOCRTest and provides Azure AI-specific configuration.
|
|
|
|
Note: For Azure AI, LiteLLM will automatically convert URLs to base64 data URIs before
|
|
sending to the API, since Azure AI OCR endpoint doesn't have internet access.
|
|
"""
|
|
|
|
def get_base_ocr_call_args(self) -> dict:
|
|
"""
|
|
Return the base OCR call args for Azure AI.
|
|
"""
|
|
return {
|
|
"model": "azure_ai/mistral-document-ai-2505",
|
|
"api_key": os.getenv("AZURE_AI_API_KEY_MISTRAL"),
|
|
"api_base": os.getenv("AZURE_AI_API_BASE_MISTRAL"),
|
|
}
|