eth-sri / lmql

A language for constraint-guided and efficient LLM programming.
https://lmql.ai
Apache License 2.0
3.6k stars 194 forks source link

Documentation: Add note on double escaping "\n" being necessary for lmql.run, but not for @lmql.query. #62

Open JasperDekoninck opened 1 year ago

JasperDekoninck commented 1 year ago

In the following query, I am still required to write "\n" instead of "\n" in order to be able to compile the query in the Python package (note that this specific query also fails for other reasons, see #61):

argmax(chatty_openai=True, max_len=256)
   "A rhyme:\\n"
   "Verse: [RHYME_START]\\n"
   for i in range(5):
      "Verse: [RHYME]\\n"
from
   'openai/text-davinci-003'
where
   len(TOKENS(RHYME)) == 5 and len(TOKENS(RHYME_START)) == 5
lbeurerkellner commented 1 year ago

Are you using lmql.run or LMQL via decorator functions @lmql.query.

JasperDekoninck commented 1 year ago

Aah yes, I am using lmql.run, forgot that the problem cannot be really fixed there. Maybe something to add to the documentation?