From 019f76f4f97e5458cdb7f577f3badfa06943aedd Mon Sep 17 00:00:00 2001 From: Matthias Reso <13337103+mreso@users.noreply.github.com> Date: Wed, 25 Dec 2024 12:30:08 -0800 Subject: [PATCH] Fix how stream flag is read from request (#1441) --- torchchat/usages/openai_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torchchat/usages/openai_api.py b/torchchat/usages/openai_api.py index b67cd0eac..0d1d3dce7 100644 --- a/torchchat/usages/openai_api.py +++ b/torchchat/usages/openai_api.py @@ -180,7 +180,10 @@ class CompletionRequest: user: Optional[str] = None # unimplemented def __post_init__(self): - self.stream = bool(self.stream) + if isinstance(self.stream, str): + self.stream = self.stream.lower() != "false" + else: + self.stream = bool(self.stream) @dataclass