mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix streaming stuff
This commit is contained in:
parent
8f10066966
commit
58568d51e8
1 changed files with 6 additions and 3 deletions
|
@ -214,7 +214,7 @@ def test_completion_cohere_stream():
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
test_completion_cohere_stream()
|
# test_completion_cohere_stream()
|
||||||
|
|
||||||
|
|
||||||
def test_completion_openai():
|
def test_completion_openai():
|
||||||
|
@ -369,10 +369,10 @@ def test_completion_openai_with_stream():
|
||||||
print(response)
|
print(response)
|
||||||
for chunk in response:
|
for chunk in response:
|
||||||
print(chunk)
|
print(chunk)
|
||||||
|
if chunk["choices"][0]["finish_reason"] == "stop":
|
||||||
|
break
|
||||||
print(chunk["choices"][0]["finish_reason"])
|
print(chunk["choices"][0]["finish_reason"])
|
||||||
print(chunk["choices"][0]["delta"]["content"])
|
print(chunk["choices"][0]["delta"]["content"])
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_openai_with_stream()
|
# test_completion_openai_with_stream()
|
||||||
|
@ -404,8 +404,11 @@ def test_completion_openai_with_functions():
|
||||||
print(response)
|
print(response)
|
||||||
for chunk in response:
|
for chunk in response:
|
||||||
print(chunk)
|
print(chunk)
|
||||||
|
if chunk["choices"][0]["finish_reason"] == "stop":
|
||||||
|
break
|
||||||
print(chunk["choices"][0]["finish_reason"])
|
print(chunk["choices"][0]["finish_reason"])
|
||||||
print(chunk["choices"][0]["delta"]["content"])
|
print(chunk["choices"][0]["delta"]["content"])
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_openai_with_functions()
|
# test_completion_openai_with_functions()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue