Hi everyone.
I wanted to share a neat trick that you can do for prodigy.json
file. As you might know, these files allow you to override settings which can alter the annotation experience. This file is documented here and as you can see ... there really are a lot of settings .
It turns out though, if you're using VSCode, there's a way to add autocomplete to this file. You'd need to provide a $schema
file on disk and then the experience looks something like this:
It's pretty easy to construct a prodigy.schema.json
file because Prodigy uses Pydantic under the hood. The typical use-case for Pydantic is to use it to validate data, but in our case we can also re-use these objects to generate a json schema. Here's the code that can generate a local schema.json
file you.
from pathlib import Path
from prodigy.types import Config
schema = Config.schema_json(indent=2)
(Path.cwd() / "prodigy.schema.json").write_text(schema)
Note that if you don't feel like using a Python script, you can also use this one-liner instead:
python -c 'from pathlib import Path; from prodigy.types import Config; (Path.cwd() / "prodigy.schema.json").write_text(Config.schema_json(indent=2))'
Either way, this generates a file, prodigy.schema.json
, which can then be referred to in a prodigy.json
file. Like so:
{
"$schema": "prodigy.schema.json"
}
When you add this file, you should start seeing autocompletions appear when you type, like below.
We're curious on getting feedback on this autocomplete, so please let us know if you find it useful.