guidance icon indicating copy to clipboard operation
guidance copied to clipboard

Error: No valid option generated in #select!

Open jurijsk opened this issue 2 years ago • 4 comments

Message continues: Please post a GitHub issue since this should not happen :)

So here I am.

Raised from:

  File "[..]\guidance\_program_executor.py", line 94, in run
    await self.visit(self.parse_tree)
  File "[..]\guidance\_program_executor.py", line 423, in visit
    visited_children.append(await self.visit(child, inner_next_node, inner_next_next_node, inner_prev_node, node, parent_node))
  File "[..]\guidance\_program_executor.py", line 423, in visit
    visited_children.append(await self.visit(child, inner_next_node, inner_next_next_node, inner_prev_node, node, parent_node))
  File "[..]\guidance\_program_executor.py", line 390, in visit
    command_output = await command_function(*positional_args, **named_args)
  File "[..]\guidance\library\_select.py", line 138

Running the following from tutorial.ipynb:

import guidance
guidance.llm = guidance.llms.OpenAI("text-davinci-003")

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}} No{{or}} Maybe{{/select}}''')
prompt = prompt(example="I hate pineapple on pizza, so that I am ready to kill because of it") //not my actual opinion, was trying to get it to reply "Yes".
print(prompt)

option_logprobs is:

{' Yes': -1000, ' No': -1000, ' Maybe': -1000}

jurijsk avatar May 18 '23 17:05 jurijsk

Can you share the version you are using? I fix went out recently for this, and I can't reproduce it right now: image

slundberg avatar May 18 '23 19:05 slundberg

https://github.com/microsoft/guidance/issues/36#issuecomment-1553723123

amanape avatar May 18 '23 22:05 amanape

@slundberg installed today.

Version: 0.0.47

and the with 0.0.48

jurijsk avatar May 18 '23 22:05 jurijsk

It is an issue regarding whitespace looks like https://github.com/microsoft/guidance/issues/53

amanape avatar May 19 '23 08:05 amanape

Thanks for reporting this! This should now be fixed in 0.0.49 :)

slundberg avatar May 19 '23 19:05 slundberg