forked from phoenix/litellm-mirror
fix(utils.py): ensure streaming output parsing only applied for hf / sagemaker models
selectively applies the <s> </s> checking
This commit is contained in:
parent
53df916f69
commit
7d0086d742
2 changed files with 23 additions and 0 deletions
|
@ -8856,7 +8856,16 @@ class CustomStreamWrapper:
|
|||
raise e
|
||||
|
||||
def check_special_tokens(self, chunk: str, finish_reason: Optional[str]):
|
||||
"""
|
||||
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 finish_reason:
|
||||
for token in self.special_tokens:
|
||||
if token in chunk:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue