diff --git a/strix/llm/llm.py b/strix/llm/llm.py index 507e8c8..d941361 100644 --- a/strix/llm/llm.py +++ b/strix/llm/llm.py @@ -145,11 +145,9 @@ class LLM: if delta: accumulated += delta if "" in accumulated or "" in accumulated: - for end_tag in ("", ""): - pos = accumulated.find(end_tag) - if pos != -1: - accumulated = accumulated[: pos + len(end_tag)] - break + end_tag = "" if "" in accumulated else "" + pos = accumulated.find(end_tag) + accumulated = accumulated[: pos + len(end_tag)] yield LLMResponse(content=accumulated) done_streaming = 1 continue diff --git a/strix/llm/utils.py b/strix/llm/utils.py index b866661..1ba6a5f 100644 --- a/strix/llm/utils.py +++ b/strix/llm/utils.py @@ -3,8 +3,8 @@ import re from typing import Any -_INVOKE_OPEN = re.compile(r'') -_PARAM_NAME_ATTR = re.compile(r'') +_INVOKE_OPEN = re.compile(r'') +_PARAM_NAME_ATTR = re.compile(r'') _FUNCTION_CALLS_TAG = re.compile(r"") _QUOTED_FUNCTION = re.compile(r"""""") _QUOTED_PARAMETER = re.compile(r"""""")