fix(utils.py): fix azure streaming bug

This commit is contained in:
Krrish Dholakia 2023-12-04 12:38:15 -08:00
parent 90c13d39ac
commit 728b879c33
4 changed files with 91 additions and 7 deletions

View file

@ -110,4 +110,26 @@ def test_stream_chunk_builder_litellm_tool_call():
except Exception as e:
pytest.fail(f"An exception occurred - {str(e)}")
test_stream_chunk_builder_litellm_tool_call()
# test_stream_chunk_builder_litellm_tool_call()
def test_stream_chunk_builder_litellm_tool_call_regular_message():
try:
messages = [{"role": "user", "content": "Hey, how's it going?"}]
litellm.set_verbose = False
response = litellm.completion(
model="azure/gpt-4-nov-release",
messages=messages,
tools=tools_schema,
stream=True,
api_key="os.environ/AZURE_FRANCE_API_KEY",
api_base="https://openai-france-1234.openai.azure.com",
complete_response = True
)
print(f"complete response: {response}")
print(f"complete response usage: {response.usage}")
assert response.system_fingerprint is not None
except Exception as e:
pytest.fail(f"An exception occurred - {str(e)}")
test_stream_chunk_builder_litellm_tool_call_regular_message()