langfun
langfun copied to clipboard
Hello World Error
Your "Hello World" example is giving the following error:
(venv) timothysmith@MacBook-Pro auto % /Volumes/Storage/python/auto/venv/bin/python /Volumes/Storage/python/auto/ai.py
/Volumes/Storage/python/auto/ai.py:16: SyntaxWarning: invalid escape sequence '\d'
output_transform = lf.transforms.Match('\d+').to_int()
Traceback (most recent call last):
File "/Volumes/Storage/python/auto/ai.py", line 3, in <module>
class NumericAnswerExtractor(lf.LangFunc):
File "/Volumes/Storage/python/auto/ai.py", line 16, in NumericAnswerExtractor
output_transform = lf.transforms.Match('\d+').to_int()
I tried both:
pip install langfun
and
pip install langfun --pre
Python 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin Type "help", "copyright", "credits" or "license" for more information.
Hi, please try:
output_transform = lf.transforms.Match('\\d+').to_int()
Sorry the documentation was stale. Now it's updated.