Update app.py
Browse files
app.py
CHANGED
@@ -50,11 +50,13 @@ os.environ.update({
|
|
50 |
"TOKENIZERS_PARALLELISM": "false",
|
51 |
"CUDA_LAUNCH_BLOCKING": "1"
|
52 |
})
|
|
|
53 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
54 |
src_path = os.path.abspath(os.path.join(current_dir, "src"))
|
55 |
sys.path.insert(0, src_path)
|
56 |
|
57 |
from txagent.txagent import TxAgent
|
|
|
58 |
# Initialize cache with 10GB limit
|
59 |
cache = Cache(file_cache_dir, size_limit=10 * 1024**3)
|
60 |
|
@@ -235,6 +237,7 @@ def clean_response(text: str) -> str:
|
|
235 |
(re.compile(r"Retrieving tools.*?\.", re.IGNORECASE), ""),
|
236 |
(re.compile(r"I will start by retrieving.*?\.", re.IGNORECASE), ""),
|
237 |
(re.compile(r"This requires reviewing.*?\.", re.IGNORECASE), ""),
|
|
|
238 |
(re.compile(r"\s+"), " "),
|
239 |
(re.compile(r"[^\w\s\.\,\(\)\-]"), ""),
|
240 |
(re.compile(r"(No missed diagnoses identified\.)\s*\1+", re.IGNORECASE), r"\1"), # Deduplicate
|
@@ -339,9 +342,6 @@ def init_agent():
|
|
339 |
step_rag_num=4,
|
340 |
seed=100,
|
341 |
additional_default_tools=[],
|
342 |
-
disable_tools=True, # Disable tools to avoid unnecessary calls
|
343 |
-
max_retries=2, # Limit retries to prevent loops
|
344 |
-
max_tokens=4096, # Increase token limit for complex inputs
|
345 |
)
|
346 |
agent.init_model()
|
347 |
|
|
|
50 |
"TOKENIZERS_PARALLELISM": "false",
|
51 |
"CUDA_LAUNCH_BLOCKING": "1"
|
52 |
})
|
53 |
+
|
54 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
55 |
src_path = os.path.abspath(os.path.join(current_dir, "src"))
|
56 |
sys.path.insert(0, src_path)
|
57 |
|
58 |
from txagent.txagent import TxAgent
|
59 |
+
|
60 |
# Initialize cache with 10GB limit
|
61 |
cache = Cache(file_cache_dir, size_limit=10 * 1024**3)
|
62 |
|
|
|
237 |
(re.compile(r"Retrieving tools.*?\.", re.IGNORECASE), ""),
|
238 |
(re.compile(r"I will start by retrieving.*?\.", re.IGNORECASE), ""),
|
239 |
(re.compile(r"This requires reviewing.*?\.", re.IGNORECASE), ""),
|
240 |
+
(re.compile(r"Given the context, it is important to review.*?\.", re.IGNORECASE), ""),
|
241 |
(re.compile(r"\s+"), " "),
|
242 |
(re.compile(r"[^\w\s\.\,\(\)\-]"), ""),
|
243 |
(re.compile(r"(No missed diagnoses identified\.)\s*\1+", re.IGNORECASE), r"\1"), # Deduplicate
|
|
|
342 |
step_rag_num=4,
|
343 |
seed=100,
|
344 |
additional_default_tools=[],
|
|
|
|
|
|
|
345 |
)
|
346 |
agent.init_model()
|
347 |
|