mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-06 04:23:40 +00:00
fix(utils.py): fix azure streaming logic
This commit is contained in:
@@ -222,14 +222,12 @@ tools_schema = [
|
||||
|
||||
def test_completion_azure_stream_special_char():
|
||||
litellm.set_verbose = True
|
||||
messages = [
|
||||
{"role": "user", "content": "Respond with the '<' sign and nothing else."}
|
||||
]
|
||||
messages = [{"role": "user", "content": "hi. respond with the <xml> tag only"}]
|
||||
response = completion(model="azure/chatgpt-v-2", messages=messages, stream=True)
|
||||
response_str = ""
|
||||
for part in response:
|
||||
response_str += part.choices[0].delta.content or ""
|
||||
|
||||
print(f"response_str: {response_str}")
|
||||
assert len(response_str) > 0
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -8842,11 +8842,11 @@ class CustomStreamWrapper:
|
||||
Output parse <s> / </s> special tokens for sagemaker + hf streaming.
|
||||
"""
|
||||
hold = False
|
||||
# if (
|
||||
# self.custom_llm_provider != "huggingface"
|
||||
# and self.custom_llm_provider != "sagemaker"
|
||||
# ):
|
||||
# return hold, chunk
|
||||
if (
|
||||
self.custom_llm_provider != "huggingface"
|
||||
and self.custom_llm_provider != "sagemaker"
|
||||
):
|
||||
return hold, chunk
|
||||
|
||||
if finish_reason:
|
||||
for token in self.special_tokens:
|
||||
|
||||
Reference in New Issue
Block a user