jncraton / languagemodels

Explore large language models in 512MB of RAM
https://jncraton.github.io/languagemodels/
MIT License
1.18k stars 78 forks source link

store response in variable #30

Closed mycomedico closed 8 months ago

mycomedico commented 8 months ago

How do I store the model's response in a variable. When I tried to do this I received the error:

SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?

jncraton commented 8 months ago

Most of the inference functions will simply return a string, so you can assign the result to a variable as follows:

import languagemodels as lm

response = lm.do("What is the capital of France?")

print(response)
mycomedico commented 8 months ago

i had a syntax error when i tried to but now i see there were some other unescaped characters in my query that probably led to that... thanks `

jncraton commented 8 months ago

Sounds good. I'm glad that you were able to get this resolved.