litellm/docs/my-website/docs
Noah Nistler d13508c1c5
Enable local file support for OCR (#22133)
* [Docs] Enable local file support

Implemented internal handling for converting file-type documents to the required format for OCR processing, ensuring seamless integration with various providers.

* Refactor OCR file handling and improve security checks

Removed deprecated MIME type mapping and file conversion functions, replacing them with updated implementations. Enhanced security by rejecting 'file' document types in JSON requests, ensuring file uploads are handled via multipart/form-data. Updated tests to reflect these changes and ensure proper functionality.

* Enhance MIME type validation in OCR processing

Added a regular expression check to validate MIME types in the convert_file_document_to_url_document function, raising a ValueError for invalid types. Updated tests to ensure proper error handling for unsupported MIME types.

* Enhance type safety in OCR file handling

Added type casting for the uploaded file in the _parse_multipart_form function to ensure proper handling of UploadFile instances. This change improves type safety and reduces potential runtime errors during file processing.

* Refactor MIME type handling in document uploads

Updated the MIME type extraction logic to strip parameters from the Content-Type header, ensuring only the base type is used. Added tests to verify that MIME parameters are correctly handled and stripped in various scenarios.

* Update OCR documentation for MIME type recommendations and remove unnecessary tips

Clarified the recommended usage of MIME types for raw bytes in document uploads. Simplified the documentation by removing the tip about multipart file uploads from tools like Postman, ensuring a more concise and focused guide.

* Enhance multipart form handling in OCR endpoints

Updated the _parse_multipart_form function to ignore both 'file' and 'document' fields during form parsing, ensuring that the document built from the uploaded file is not overridden. Added a new test to verify that injected document fields do not affect the constructed document, improving security and robustness of the file upload process.
2026-02-27 10:50:02 -08:00
..
adding_provider Merge pull request #21326 from BerriAI/litellm_oss_staging_02_16_2026 2026-02-18 17:47:57 +05:30
anthropic_unified fix: prompt registry 2026-02-18 00:34:54 +05:30
caching fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
completion fix: add prompt_cache_key and prompt_cache_retention support for OpenAI 2026-02-24 16:42:54 -08:00
contribute_integration
contributing
debugging
embedding
extras fix: prompt registry 2026-02-18 00:34:54 +05:30
guides fix: prompt registry 2026-02-18 00:34:54 +05:30
integrations fix: prompt registry 2026-02-18 00:34:54 +05:30
langchain
observability fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
pass_through fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
projects fix: prompt registry 2026-02-18 00:34:54 +05:30
provider_registration
providers feat(vertex_ai): Vertex AI Gemini Live via unified /realtime endpoint (#22153) 2026-02-25 22:11:06 -08:00
proxy Merge pull request #22087 from BerriAI/litellm_fix_anthropic_responses 2026-02-27 21:18:04 +05:30
search Add duckcukgo in docs 2026-02-18 16:17:39 +05:30
secret_managers fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
troubleshoot Update docs/my-website/docs/troubleshoot/rollback.md 2026-02-21 10:40:41 +05:30
tutorials fix(guardrails): prevent presidio crash on non-json responses 2026-02-25 16:11:24 +05:30
vector_stores
a2a_agent_permissions.md
a2a_cost_tracking.md fix: prompt registry 2026-02-18 00:34:54 +05:30
a2a_invoking_agents.md fix: prompt registry 2026-02-18 00:34:54 +05:30
a2a.md fix: prompt registry 2026-02-18 00:34:54 +05:30
aiohttp_benchmarks.md
anthropic_count_tokens.md fix: prompt registry 2026-02-18 00:34:54 +05:30
apply_guardrail.md
assistants.md
audio_transcription.md
batches.md fix: prompt registry 2026-02-18 00:34:54 +05:30
bedrock_converse.md
bedrock_invoke.md
benchmarks.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
budget_manager.md
contact.md
container_files.md fix: prompt registry 2026-02-18 00:34:54 +05:30
containers.md
contributing.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
data_retention.md fix: prompt registry 2026-02-18 00:34:54 +05:30
data_security.md
default_code_snippet.md
enterprise.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
evals_api.md fix: prompt registry 2026-02-18 00:34:54 +05:30
exception_mapping.md
files_endpoints.md
fine_tuning.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
generateContent.md fix: Metadata / Trace ID Missing in S3 Streaming Callbacks 2026-02-25 14:16:42 +05:30
image_edits.md fix: prompt registry 2026-02-18 00:34:54 +05:30
image_generation.md fix: prompt registry 2026-02-18 00:34:54 +05:30
image_variations.md
index.md fix: prompt registry 2026-02-18 00:34:54 +05:30
interactions.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
load_test_advanced.md fix: prompt registry 2026-02-18 00:34:54 +05:30
load_test_rpm.md
load_test_sdk.md
load_test.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_control.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_cost.md
mcp_guardrail.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_oauth.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_public_internet.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_semantic_filter.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_troubleshoot.md fix: prompt registry 2026-02-18 00:34:54 +05:30
mcp_usage.md
mcp.md Merge pull request #20509 from ryan-crabbe/docs/mcp-trailing-slash 2026-02-24 16:38:29 -08:00
migration_policy.md
migration.md
moderation.md
ocr.md Enable local file support for OCR (#22133) 2026-02-27 10:50:02 -08:00
oidc.md fix: prompt registry 2026-02-18 00:34:54 +05:30
old_guardrails.md
projects.md
proxy_api.md
proxy_auth.md fix: prompt registry 2026-02-18 00:34:54 +05:30
proxy_server.md
rag_ingest.md fix: prompt registry 2026-02-18 00:34:54 +05:30
rag_query.md fix: prompt registry 2026-02-18 00:34:54 +05:30
realtime.md feat(realtime): guardrails support for /v1/realtime WebSocket endpoint (#22152) 2026-02-25 21:34:22 -08:00
reasoning_content.md Add support for reasoning and tools viaconfig 2026-02-20 16:22:19 +05:30
rerank.md feat: Add IBM watsonx.ai rerank support (#21303) 2026-02-16 20:12:16 -08:00
response_api_compact.md fix: prompt registry 2026-02-18 00:34:54 +05:30
response_api.md feat: add session_id to have better routing 2026-02-21 18:45:50 +05:30
router_architecture.md
routing.md fix: prompt registry 2026-02-18 00:34:54 +05:30
rules.md
scheduler.md
sdk_custom_pricing.md
secret.md fix(ollama): thread api_base to get_model_info + graceful fallback (#21970) 2026-02-23 21:00:37 -08:00
set_keys.md
skills.md
text_completion.md
text_to_speech.md fix: prompt registry 2026-02-18 00:34:54 +05:30
traffic_mirroring.md fix: prompt registry 2026-02-18 00:34:54 +05:30
troubleshoot.md fix: prompt registry 2026-02-18 00:34:54 +05:30
vector_store_files.md
vertex_batch_passthrough.md
videos.md
wildcard_routing.md