✘ Invalid components returned by recipe 'cat-facts-ner'

I cannot reproduce the effect of recipe blocks.

After running the command, it prompts:

✘ Invalid components returned by recipe 'cat-facts-ner'

config -> blocks -> 0 -> _input_hash   field required
config -> blocks -> 0 -> _task_hash   field required
import prodigy
from prodigy.components.preprocess import add_tokens
import requests
import spacy
from prodigy.components.loaders import JSONL

@prodigy.recipe(
    "cat-facts-ner",
    dataset=("The dataset to save to", "positional", None, str),
    file_path=("Path to texts", "positional", None, str),
)
def cat_facts_ner(dataset,file_path,lang="en"):

    stream = JSONL(file_path)  
    
    return {
        "dataset": dataset,
        "stream": stream,
        "view_id": "blocks",
        "config": {
            "validate": False,
            "blocks": [
                {"view_id": "ner_manual"},
            ]
        }
    }

Sorry about that – we added new and more detailed validation, and it seems to have caused a few problems because it ended up being a bit too strict in places.

If I run your code with the "validate": False in the config, it does work for me, though, and the validation is skipped.

The follwing is my data.json. I installed a brand new prodigy, it still come up with the same error. What did miss?

{
  "text": "First look at the new MacBook Pro",
  "spans": [
    {"start": 22, "end": 33, "label": "PRODUCT", "token_start": 5, "token_end": 6}
  ],
  "tokens": [
    {"text": "First", "start": 0, "end": 5, "id": 0},
    {"text": "look", "start": 6, "end": 10, "id": 1},
    {"text": "at", "start": 11, "end": 13, "id": 2},
    {"text": "the", "start": 14, "end": 17, "id": 3},
    {"text": "new", "start": 18, "end": 21, "id": 4},
    {"text": "MacBook", "start": 22, "end": 29, "id": 5},
    {"text": "Pro", "start": 30, "end": 33, "id": 6}
  ],
}

Setting "validate": False should work around the problem – so I'm not sure why this isn't disabling the validation for you. Do you maybe have a prodigy.json in your current working directory or your Prodigy home directory that sets "validate": True?

Alternatively, you could also trick it into accepting your block by setting {"view_id": "ner_manual", "_input_hash": 0, "_task_hash": 0} or something like that.

Thanks!Actually, after setting "validate":false in prodigy.json file, it finally worked! I don't understand why "validate": False in the recipe confic section didn't work.

Glad it worked! We'll also release the new version soon which will fix the underlying validation problem.

The global and local prodigy.json will overwrite the recipe config. I agree that it's a bit unintuitive and maybe we should change this behaviour – but the underlying idea was to allow a reusable recipe to define defaults, and then let the user overwrite those settings in their personal config.

Perhaps you can give prodigy.json the priority for official recipes, but for personal config recipes, the settings in that specific file should have priority.

Okay, v1.93, which resolves the too strict validation here should be live now :slightly_smiling_face:

Yes, that'd make sense! At the moment, Prodigy doesn't really distinguish between built-in recipes and user recipes, though, and it might be tricky to handle cases like recipes supplied via entry points (e.g. via a third-party user package).