fix(utils.py): only return cached streaming object for streaming calls

This commit is contained in:
Krrish Dholakia 2024-02-21 21:27:40 -08:00
parent f1742769a2
commit fb2ae3a032
2 changed files with 10 additions and 8 deletions

View file

@ -2330,13 +2330,13 @@ def client(original_function):
model_response_object=ModelResponse(),
stream=kwargs.get("stream", False),
)
cached_result = CustomStreamWrapper(
completion_stream=cached_result,
model=model,
custom_llm_provider="cached_response",
logging_obj=logging_obj,
)
if kwargs.get("stream", False) == True:
cached_result = CustomStreamWrapper(
completion_stream=cached_result,
model=model,
custom_llm_provider="cached_response",
logging_obj=logging_obj,
)
elif call_type == CallTypes.embedding.value and isinstance(
cached_result, dict
):