lwant commited on
Commit
dad10fa
Β·
1 Parent(s): e04414b

Add `extract_pattern` utility function to support regex-based string extraction in `gaia_solving_agent`

Browse files
Files changed (1) hide show
  1. src/gaia_solving_agent/utils.py +7 -0
src/gaia_solving_agent/utils.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
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