mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
refactor(ocr): remove stateless config fields
This commit is contained in:
parent
9ee2f0bdca
commit
30ad040b25
3 changed files with 9 additions and 21 deletions
|
|
@ -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<LiteLLMOcrResponse, OcrResponseError> {
|
||||
self.cohere.transform_ocr_response(request, response)
|
||||
CohereParseConfig.transform_ocr_response(request, response)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<LiteLLMOcrResponse, OcrResponseError> {
|
||||
self.mistral.transform_ocr_response(request, response)
|
||||
MistralOCRConfig.transform_ocr_response(request, response)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<LiteLLMOcrResponse, OcrResponseError> {
|
||||
self.mistral.transform_ocr_response(request, response)
|
||||
MistralOCRConfig.transform_ocr_response(request, response)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue