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

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more