datasette-enrichments-gpt by datasette

153 downloads this week        Star

README source code

datasette-enrichments-gpt

PyPI Changelog Tests License

Datasette enrichment for analyzing row data using OpenAI's GPT models

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-enrichments-gpt

Configuration

This plugin can optionally be configured with an OpenAI API key. You can set this as an environment variable:

export DATASETTE_SECRETS_OPENAPI_API_KEY=sk-..

Or you can configure it using the datasette-secrets plugin.

If you do not configure an OpenAI API key users will be asked to enter one any time they execute the enrichment. The key they provide will not be stored anywhere other than in-memory during the enrichment run.

Usage

Once installed, this plugin will allow users to select rows to enrich and run them through prompts using gpt-3.5-turbo or gpt-4o, saving the result of the prompt in the specified column.

The plugin also provides gpt-4o vision, which can run prompts against an image identified by a URL.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-enrichments-gpt
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest