guidance
guidance copied to clipboard
ValueError: No valid option generated in #select!
Error was raised running the following:
prompt = guidance('''Is the following sentence offensive? Please answer with a single word, either "Yes", "Nein", or "Vielleicht".
Sentence: {{example}}
Answer:{{#select "answer" logprobs='logprobs'}} Ja{{or}} Nein{{or}} Vielleicht{{/select}}''')
prompt = prompt(example='I hate tacos.')
prompt
I tried multiple variations. When the answer format specified at the beginning of the prompt and the options inside the select tag vary then very often this error happens.
Can you share what version of guidance you are using? I can't get similar errors on the latest 0.0.47
Maybe try importing differently:
from guidance import Guidance
from guidance.llms import OpenAI
# example llm setup
# There is also a `token` parameter if necessary.
davinci = OpenAI(model='text-davinci-003')
guidance = Guidance('guidance-name')
prompt = guidance('''
Is the following sentence offensive? Please answer with a single word, either "Yes", "Nein", or "Vielleicht".
Sentence: {{example}}
Answer:{{#select "answer" logprobs='logprobs'}} Ja{{or}} Nein{{or}} Vielleicht{{/select}}
''', llm=davinci)
executed_prompt = prompt(example='I hate tacos.')
@slundberg my version is indeed 0.0.47. I tried the way you suggested @amanape but it also raised the same error.
This is another example that causes the error and is the closest to the example given in the readme:
import guidance
guidance.llm = guidance.llms.OpenAI('text-davinci-003')
guidance.llms.OpenAI.cache.clear()
prompt = guidance('''Is the following sentence offensive? Please answer with a single word, either "Yes", "No", or "Maybe".
Sentence: {{example}}
Answer:{{#select "answer" logprobs='logprobs'}} Yes{{or}} Nein{{or}} Maybe{{/select}}''')
prompt = prompt(example='I hate tacos.')
prompt
@Sam1320 This seems to have worked for me https://github.com/microsoft/guidance/issues/40#issuecomment-1554084184
Thanks for reporting this! This should now be fixed in 0.0.49 :)