Spaces:
Runtime error
Runtime error
rework prompts
Browse files
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 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|