choice_auto_accept =true not considered

Hi, I'm using a custom recipe that employs the choice view and offers multiple options for the users to choose one from. While having set choice_auto_accept=true in the recipe's code, prodigy does not auto accept. I tried the following variants (in the recipe.py file):

return {
        'dataset': dataset,  # save annotations in this dataset
        'view_id': 'choice',  # use the choice interface
        "choice_auto_accept": 'true',  # auto-accept example, once the users selects an option
        'stream': stream,
    }

as well as

return {
        ...
        "choice_auto_accept": True,  
    }

The full contents of recipe.py:

import prodigy
from prodigy.components.loaders import JSONL

@prodigy.recipe('newstsa',
                dataset=prodigy.recipe_args['dataset'],
                file_path=("Path to texts", "positional", None, str))
def sentiment(dataset, file_path):
    """Annotate the sentiment of texts using different mood options."""
    stream = JSONL(file_path)  # load in the JSONL file
    stream = add_options(stream)  # add options to each task

    return {
        'dataset': dataset,  # save annotations in this dataset
        'view_id': 'choice',  # use the choice interface
        "choice_auto_accept": 'true',  # auto-accept example, once the users selects an option
        'stream': stream,
    }


def add_options(stream):
    """Helper function to add options to every task in a stream."""
    options = [{'id': 'positive', 'text': '😀 positive'},
               {'id': 'negative', 'text': '😢 negative'},
               {'id': 'neutral', 'text': '😶 neutral'}]
    for task in stream:
        task['options'] = options
        yield task

Hi! Sorry if this was confusing: choice_auto_accept is a config option, so it can either go in the prodigy.json, or the "config" returned by your recipe. For example:

return {
    "config": {
        "choice_auto_accept": True
    }
}
2 Likes