use get_async_httpx_client for logging httpx

This commit is contained in:
Ishaan Jaff 2024-09-10 13:03:55 -07:00
parent 421b857714
commit 0f154abf9e
8 changed files with 57 additions and 20 deletions

View file

@ -26,7 +26,10 @@ from typing import List
from datetime import datetime
import aiohttp, asyncio
from litellm._logging import verbose_proxy_logger
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler
from litellm.llms.custom_httpx.http_handler import (
get_async_httpx_client,
httpxSpecialProvider,
)
import httpx
import json
from litellm.types.guardrails import GuardrailEventHooks
@ -40,8 +43,8 @@ class AporiaGuardrail(CustomGuardrail):
def __init__(
self, api_key: Optional[str] = None, api_base: Optional[str] = None, **kwargs
):
self.async_handler = AsyncHTTPHandler(
timeout=httpx.Timeout(timeout=600.0, connect=5.0)
self.async_handler = get_async_httpx_client(
llm_provider=httpxSpecialProvider.GuardrailCallback
)
self.aporia_api_key = api_key or os.environ["APORIO_API_KEY"]
self.aporia_api_base = api_base or os.environ["APORIO_API_BASE"]