From 30ad040b25ef8f6b8eac74f791fdf65cc49f1f04 Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Tue, 15 Sep 2026 08:54:44 -0700 Subject: [PATCH] refactor(ocr): remove stateless config fields --- .../llms/azure_ai/ocr/cohere_parse_transformation.rs | 10 +++------- .../core/src/llms/azure_ai/ocr/transformation.rs | 10 +++------- .../core/src/llms/vertex_ai/ocr/transformation.rs | 10 +++------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/litellm-rust/crates/core/src/llms/azure_ai/ocr/cohere_parse_transformation.rs b/litellm-rust/crates/core/src/llms/azure_ai/ocr/cohere_parse_transformation.rs index 0c82e2e3ee4..2a3b10b64d4 100644 --- a/litellm-rust/crates/core/src/llms/azure_ai/ocr/cohere_parse_transformation.rs +++ b/litellm-rust/crates/core/src/llms/azure_ai/ocr/cohere_parse_transformation.rs @@ -13,9 +13,7 @@ use crate::url_utils::ApiUrl; const AZURE_AI_API_BASE_ENV: &str = "AZURE_AI_API_BASE"; #[derive(Default)] -pub(crate) struct AzureAICohereParseConfig { - cohere: CohereParseConfig, -} +pub(crate) struct AzureAICohereParseConfig; impl BaseOcrConfig for AzureAICohereParseConfig { type ProviderResponse = CohereResponse; @@ -63,9 +61,7 @@ impl BaseOcrConfig for AzureAICohereParseConfig { &request.connection, ) .await?; - let body = self - .cohere - .transform_ocr_request(&request.model, document, params)?; + let body = CohereParseConfig.transform_ocr_request(&request.model, document, params)?; transform_request_body( client, request, @@ -86,7 +82,7 @@ impl BaseOcrConfig for AzureAICohereParseConfig { request: &LiteLLMOcrRequest, response: CohereResponse, ) -> Result { - self.cohere.transform_ocr_response(request, response) + CohereParseConfig.transform_ocr_response(request, response) } } diff --git a/litellm-rust/crates/core/src/llms/azure_ai/ocr/transformation.rs b/litellm-rust/crates/core/src/llms/azure_ai/ocr/transformation.rs index b87b5a6fe66..f3f43de48e2 100644 --- a/litellm-rust/crates/core/src/llms/azure_ai/ocr/transformation.rs +++ b/litellm-rust/crates/core/src/llms/azure_ai/ocr/transformation.rs @@ -18,9 +18,7 @@ const AZURE_AI_API_KEY_ENV: &str = "AZURE_AI_API_KEY"; const AZURE_AI_API_BASE_ENV: &str = "AZURE_AI_API_BASE"; #[derive(Clone, Debug, Default)] -pub(crate) struct AzureAIOCRConfig { - mistral: MistralOCRConfig, -} +pub(crate) struct AzureAIOCRConfig; impl BaseOcrConfig for AzureAIOCRConfig { type ProviderResponse = MistralOcrResponse; @@ -52,9 +50,7 @@ impl BaseOcrConfig for AzureAIOCRConfig { &request.connection, ) .await?; - let body = self - .mistral - .transform_ocr_request(&request.model, document, ¶ms)?; + let body = MistralOCRConfig.transform_ocr_request(&request.model, document, ¶ms)?; transform_request_body( client, request, @@ -72,7 +68,7 @@ impl BaseOcrConfig for AzureAIOCRConfig { request: &LiteLLMOcrRequest, response: MistralOcrResponse, ) -> Result { - self.mistral.transform_ocr_response(request, response) + MistralOCRConfig.transform_ocr_response(request, response) } } diff --git a/litellm-rust/crates/core/src/llms/vertex_ai/ocr/transformation.rs b/litellm-rust/crates/core/src/llms/vertex_ai/ocr/transformation.rs index eb03577d19b..35a48ceb69a 100644 --- a/litellm-rust/crates/core/src/llms/vertex_ai/ocr/transformation.rs +++ b/litellm-rust/crates/core/src/llms/vertex_ai/ocr/transformation.rs @@ -15,9 +15,7 @@ use crate::url_utils::ApiUrl; const DEFAULT_LOCATION: &str = "us-central1"; #[derive(Clone, Debug, Default)] -pub(crate) struct VertexAIOCRConfig { - mistral: MistralOCRConfig, -} +pub(crate) struct VertexAIOCRConfig; impl BaseOcrConfig for VertexAIOCRConfig { type ProviderResponse = MistralOcrResponse; @@ -63,9 +61,7 @@ impl BaseOcrConfig for VertexAIOCRConfig { &request.connection, ) .await?; - let body = self - .mistral - .transform_ocr_request(&request.model, document, ¶ms)?; + let body = MistralOCRConfig.transform_ocr_request(&request.model, document, ¶ms)?; transform_request_body( client, request, @@ -83,7 +79,7 @@ impl BaseOcrConfig for VertexAIOCRConfig { request: &LiteLLMOcrRequest, response: MistralOcrResponse, ) -> Result { - self.mistral.transform_ocr_response(request, response) + MistralOCRConfig.transform_ocr_response(request, response) } }