feat(utils.py): enable returning complete response when stream=true

This commit is contained in:
Krrish Dholakia 2023-11-09 09:17:43 -08:00
parent 3dae4e9cda
commit 8ee4b1f603
4 changed files with 22 additions and 7 deletions

View file

@ -24,6 +24,7 @@ function_schema = {
}
def test_stream_chunk_builder():
litellm.set_verbose = False
litellm.api_key = os.environ["OPENAI_API_KEY"]
response = completion(
model="gpt-3.5-turbo",
@ -35,10 +36,11 @@ def test_stream_chunk_builder():
chunks = []
for chunk in response:
print(chunk)
# print(chunk)
chunks.append(chunk)
try:
print(f"chunks: {chunks}")
rebuilt_response = stream_chunk_builder(chunks)
# exract the response from the rebuilt response