| Name | Type | Description |
|---|---|---|
proxy_base_url | str | Default: 'http://localhost:4000'Base URL of the LiteLLM proxy server. Defaults to "http://localhost:4000". |
api_key | Optional[str] | Default: NoneOptional bearer token for proxy authentication. |
model | str | Default: 'azure-document' |
file_path | Optional[str] | Default: None |
url_path | Optional[str] | Default: None |
base64_content | Optional[str] | Default: None |
bytes_content | Optional[bytes] | Default: None |
mode | Literal['single', 'page'] | Default: 'single' |
timeout | float | Default: 300.0 |
max_retries | int | Default: 3 |
Load documents using LiteLLM proxy's OCR endpoint.
This loader makes HTTP requests to a LiteLLM proxy server configured with Azure Document Intelligence (or other OCR providers). The proxy handles all provider-specific authentication and configuration.
Note:
Exactly one of file_path, url_path, base64_content, or bytes_content must be provided.
Example:
Basic usage with default proxy:
from langchain_litellm import LiteLLMOCRLoader
loader = LiteLLMOCRLoader(
url_path="https://example.com/document.pdf",
model="azure-document",
mode="page"
)
documents = loader.load()
With custom proxy and authentication:
loader = LiteLLMOCRLoader(
proxy_base_url="https://my-proxy.com",
api_key="my-bearer-token",
file_path="/path/to/document.pdf",
model="azure-document",
mode="single"
)
documents = await loader.aload()Model name configured in the proxy (e.g., "azure-document"). Defaults to "azure-document".
Path to a local file to process.
URL to a remote document to process.
Base64-encoded document content.
Raw bytes of a document.
Output mode - "single" returns one document with all content, "page" returns one document per page. Defaults to "single".
Request timeout in seconds. Must be positive. Defaults to 300.0 (5 minutes).
Maximum number of retry attempts for failed requests. Must be non-negative. Defaults to 3.