fix(anthropic.py): support streaming with function calling

This commit is contained in:
Krrish Dholakia 2024-03-12 09:52:11 -07:00
parent 10f5f342bd
commit 86ed0aaba8
4 changed files with 109 additions and 7 deletions

View file

@ -1073,7 +1073,11 @@ def completion(
logging_obj=logging,
headers=headers,
)
if "stream" in optional_params and optional_params["stream"] == True:
if (
"stream" in optional_params
and optional_params["stream"] == True
and not isinstance(response, CustomStreamWrapper)
):
# don't try to access stream object,
response = CustomStreamWrapper(
response,