langfun icon indicating copy to clipboard operation
langfun copied to clipboard

Hello World Error

Open timscodebase opened this issue 9 months ago • 1 comments

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.

timscodebase avatar May 02 '24 19:05 timscodebase

Hi, please try: output_transform = lf.transforms.Match('\\d+').to_int()

ghchinoy avatar May 24 '24 18:05 ghchinoy

Sorry the documentation was stale. Now it's updated.

daiyip avatar Jul 19 '24 22:07 daiyip