Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix code QA checks

Ishaan Jaffera48705bfaf50
diff --git a/litellm/rag/ingestion/base_ingestion.py b/litellm/rag/ingestion/base_ingestion.py
index 3d2e72f8538..538a72b5ca4 100644
--- a/litellm/rag/ingestion/base_ingestion.py
+++ b/litellm/rag/ingestion/base_ingestion.py
@@ -16,12 +16,14 @@ import base64
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, cast
-import httpx
-
import litellm
from litellm._logging import verbose_logger
from litellm._uuid import uuid4
from litellm.constants import DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE
+from litellm.llms.custom_httpx.http_handler import (
+ get_async_httpx_client,
+ httpxSpecialProvider,
+)
from litellm.rag.text_splitters import RecursiveCharacterTextSplitter
from litellm.types.rag import RAGIngestOptions, RAGIngestResponse
@@ -86,12 +88,12 @@ class BaseRAGIngestion(ABC):
return filename, file_content, content_type, None
if file_url:
- async with httpx.AsyncClient() as http_client:
- response = await http_client.get(file_url)
- response.raise_for_status()
- file_content = response.content
- filename = file_url.split("/")[-1] or "document"
- content_type = response.headers.get("content-type", "application/octet-stream")
+ http_client = get_async_httpx_client(llm_provider=httpxSpecialProvider.RAG)
+ response = await http_client.get(file_url)
+ response.raise_for_status()
+ file_content = response.content
+ filename = file_url.split("/")[-1] or "document"
+ content_type = response.headers.get("content-type", "application/octet-stream")
return filename, file_content, content_type, None
if file_id:
diff --git a/litellm/types/llms/custom_http.py b/litellm/types/llms/custom_http.py
index 46956fedc8e..4d5ca02f032 100644
--- a/litellm/types/llms/custom_http.py
+++ b/litellm/types/llms/custom_http.py
@@ -23,6 +23,7 @@ class httpxSpecialProvider(str, Enum):
SSO_HANDLER = "sso_handler"
Search = "search"
MCP = "mcp"
+ RAG = "rag"
VerifyTypes = Union[str, bool, ssl.SSLContext]