mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Apply agentic searching. (#5196)
### What problem does this PR solve? #5173 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
import logging
|
||||
import random
|
||||
from collections import Counter
|
||||
from typing import Optional
|
||||
|
||||
from rag.utils import num_tokens_from_string
|
||||
from . import rag_tokenizer
|
||||
@ -601,3 +602,11 @@ def naive_merge_docx(sections, chunk_token_num=128, delimiter="\n。;!?"):
|
||||
add_chunk(sec, image, '')
|
||||
|
||||
return cks, images
|
||||
|
||||
|
||||
def extract_between(text: str, start_tag: str, end_tag: str) -> Optional[str]:
|
||||
pattern = re.escape(start_tag) + r"(.*?)" + re.escape(end_tag)
|
||||
matches = re.findall(pattern, text, flags=re.DOTALL)
|
||||
if matches:
|
||||
return matches[-1].strip()
|
||||
return None
|
||||
Reference in New Issue
Block a user