mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-06 21:20:33 +00:00
matches colon and any number of white spaces after colon
This commit is contained in:
parent
64eb5a6082
commit
23ef836b48
@ -120,9 +120,9 @@ class BaseQAWithSourcesChain(Chain, ABC):
|
||||
|
||||
def _split_sources(self, answer: str) -> Tuple[str, str]:
|
||||
"""Split sources from answer."""
|
||||
if re.search(r"SOURCES?[:\s]", answer, re.IGNORECASE):
|
||||
if re.search(r"SOURCES?[:]\s", answer, re.IGNORECASE):
|
||||
answer, sources = re.split(
|
||||
r"SOURCES?[:]|QUESTION:\s", answer, flags=re.IGNORECASE
|
||||
r"SOURCES?[:]\s|QUESTION:\s", answer, flags=re.IGNORECASE
|
||||
)[:2]
|
||||
sources = re.split(r"\n", sources)[0].strip()
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user