mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-26 11:58:28 +02:00
use re.search instead of re.match (which searches from start of string only)
This commit is contained in:
committed by
Chris Weaver
parent
9eb48ca2c3
commit
bdaaebe955
@@ -26,9 +26,7 @@ from danswer.utils.text_processing import shared_precompare_cleanup
|
||||
|
||||
|
||||
logger = setup_logger()
|
||||
answer_pattern = re.compile(
|
||||
r'(?:```(?:json)?)?\s*{\s*"answer"\s*:\s*"', re.DOTALL | re.IGNORECASE
|
||||
)
|
||||
answer_pattern = re.compile(r'{\s*"answer"\s*:\s*"', re.IGNORECASE)
|
||||
|
||||
|
||||
def _extract_answer_quotes_freeform(
|
||||
@@ -232,7 +230,7 @@ def process_model_tokens(
|
||||
model_output += token
|
||||
|
||||
if not found_answer_start:
|
||||
m = answer_pattern.match(model_output)
|
||||
m = answer_pattern.search(model_output)
|
||||
if m:
|
||||
found_answer_start = True
|
||||
|
||||
|
Reference in New Issue
Block a user