Using module level client

This commit is contained in:
Tim O'Farrell 2025-02-21 16:59:02 +00:00
parent e981476ffe
commit d5215d428f

View file

@ -403,10 +403,8 @@ class AnthropicChatCompletion(BaseLLM):
) )
else: else:
_close_client = False
if client is None or not isinstance(client, HTTPHandler): if client is None or not isinstance(client, HTTPHandler):
client = HTTPHandler(timeout=timeout) # type: ignore client = client = litellm.module_level_client
_close_client = True
try: try:
response = client.post( response = client.post(
@ -429,9 +427,6 @@ class AnthropicChatCompletion(BaseLLM):
status_code=status_code, status_code=status_code,
headers=error_headers, headers=error_headers,
) )
finally:
if _close_client:
client.close()
return config.transform_response( return config.transform_response(
model=model, model=model,