Public
Edited
Feb 14, 2023
Paused
1 fork
Importers
Insert cell
Insert cell
Insert cell
openai_module = import("https://cdn.skypack.dev/openai@3.1?min")
Insert cell
Insert cell
import {secret} from "@tmcw/secret"
Insert cell
// The importing notebook should import this notebook with a `with` statement that initializes this values. See the instructions at the top of this notebook.
API_KEY = undefined
Insert cell
viewof openaiApiKey = secret("OPENAI_API_KEY", {
description:
"This is an OpenAI API token whose value is only available to your notebooks.",
submit: "Save OpenAI API key"
})
Insert cell
Insert cell
Insert cell
openai = {
const { OpenAIApi, Configuration } = openai_module;
const apiKey = API_KEY || openaiApiKey;
if (!apiKey) {
throw new Error(
"The @osteele/openai-wrapper module must be imported with a `with` statement. See that notebook for usage instructions."
);
}
const configuration = new Configuration({ apiKey });
return new OpenAIApi(configuration);
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more