-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run nested queries in python #189
Comments
Hi there, you almost got it right, there are only two small syntactic issues in your code. The nested query The second one is on how you call the nested function. Your main query code should just be:
You don't need to specify a separate So overall, you get: import lmql
@lmql.query
def chain_of_thought():
'''lmql
"A: Let's think step by step.\n [REASONING]"
"Therefore the answer is[ANSWER]" where STOPS_AT(ANSWER, ".")
return ANSWER.strip()
'''
@lmql.query
def hello():
'''lmql
"Q: It is August 12th, 2020. What date was it 100 days ago? [ANSWER: chain_of_thought]"
'''
r = hello()
print(r) # [LMQLResult(prompt='Q: It is August 12th, 2020. What date was it 100 days ago? May 4th, 2020.', variables={'ANSWER': 'May 4th, 2020.'}, distribution_variable=None, distribution_values=None)] |
thanks a lot for your response! |
I pulled the master and it works! Thanks a lot! |
Output I get:
RuntimeError: Failed to parse docstring of query function as LMQL code
The text was updated successfully, but these errors were encountered: