Merge pull request #2472 from BerriAI/litellm_anthropic_streaming_tool_calling

fix(anthropic.py): support claude-3 streaming with function calling
This commit is contained in:
Krish Dholakia 2024-03-12 21:36:01 -07:00 committed by GitHub
commit ce3c865adb
5 changed files with 150 additions and 27 deletions

View file

@ -1144,7 +1144,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,