mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
Fix httpx deprecation warning during LLM API calls (#9261)
Co-authored-by: Rohit Malhotra <rohitvinodmalhotra@gmail.com> Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -288,7 +288,20 @@ class LLM(RetryMixin, DebugMixin):
|
||||
# Record start time for latency measurement
|
||||
start_time = time.time()
|
||||
# we don't support streaming here, thus we get a ModelResponse
|
||||
resp: ModelResponse = self._completion_unwrapped(*args, **kwargs)
|
||||
|
||||
# Suppress httpx deprecation warnings during LiteLLM calls
|
||||
# This prevents the "Use 'content=<...>' to upload raw bytes/text content" warning
|
||||
# that appears when LiteLLM makes HTTP requests to LLM providers
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings(
|
||||
'ignore', category=DeprecationWarning, module='httpx.*'
|
||||
)
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
message=r'.*content=.*upload.*',
|
||||
category=DeprecationWarning,
|
||||
)
|
||||
resp: ModelResponse = self._completion_unwrapped(*args, **kwargs)
|
||||
|
||||
# Calculate and record latency
|
||||
latency = time.time() - start_time
|
||||
|
||||
Reference in New Issue
Block a user