lwant commited on
Commit
cfb1f9f
Β·
1 Parent(s): 0f23fa9

rework prompts

Browse files
Files changed (1) hide show
  1. src/gaia_solving_agent/utils.py +7 -4
src/gaia_solving_agent/utils.py CHANGED
@@ -1,7 +1,10 @@
1
  import re
2
 
3
 
4
- def extract_pattern(pattern: str, text: str) -> str:
5
- search = re.search(pattern, text)
6
- extracted = search.group(1) if search else ""
7
- return extracted
 
 
 
 
1
  import re
2
 
3
 
4
+ def extract_pattern(pattern: str, text: str) -> str | None:
5
+ matches = re.findall(pattern, text)
6
+ if matches:
7
+ extracted = matches[-1]
8
+ return extracted
9
+ else:
10
+ return None