Invalid db component in custom recipe

I create a Database object as described in the documentation to use a PostgreSQL database in a custom recipe, and I pass it in as the db component in the returned dict. This worked fine in Prodigy 1.8.4 but in 1.9.0 I'm getting the following error:

✘ Invalid components returned by recipe 'clinex.textcat.teach'
db   <prodigy.components.db.Database object at 0x1251ae2b0> is not callable
db   value could not be parsed to a boolean

How do I get this to work again in the new Prodigy version?

Ah, damn, sorry about that. Looks like the new validation is too strict now :woman_facepalming: Will fix this!

The easiest workaround is to just set "validate": False in your prodigy.json or recipe config to disable validation. You could also go into prodigy/types.py, find the RecipeComponents schema and change the db entry to something like db: Optional[Any] = True.

Edit: Should be fixed in the latest v1.9.1 :slightly_smiling_face:

1 Like