google / langfun

Empower LLMs with Symbols.
Apache License 2.0
89 stars 17 forks source link

Hello World Error #201

Open timscodebase opened 2 months ago

timscodebase commented 2 months ago

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.

ghchinoy commented 1 month ago

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