-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design the class structure and plugin hook #3
Comments
Some enrichments are going to run entirely in-process - in which case the class itself will implement the code that gets run within Datasette to apply the enrichment. Others are going to require an external partner via the API in #4. So the class design should be able to handle both of these cases. The external ones still need a class, because they need information about what the enrichment is called, how it should be described to the user and what settings (if any) the user can add to an enrichment run - things like the API key to use, and the input columns. |
This API design needs to take async into account, since enrichments that call external HTTP APIs might want to do so using |
I'm going to call the plugin hook It will look like I think this: @hookspec
def register_enrichments(datasette):
"""A list of Enrichment subclasses""" |
Might be simpler if I enforce ALL enrichment implementations to use Based on the table structure in:
This class will have a method that gets called with a batch of rows and Does Stuff to them, then returning information that helps update the |
I'm going to try to implement this using |
Core class method is Should |
Where does the code live that adds the Need to think about how errors will work. They need to be recorded somewhere, ideally the run should continue. |
Here's the class structure for my first working OpenAI embeddings prototype: datasette-enrichments/datasette_enrichments/__init__.py Lines 213 to 324 in 06b423b
|
Next step: wire up the plugin hook so it actually does something, and rewrite the Uppercase example to use the new WTForms mechanism. |
To help test this, I'm going to build a |
Originally posted by @simonw in #1 (comment)
The text was updated successfully, but these errors were encountered: