100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
74const trackedUsernames = [];
75
76const openai = new OpenAI();
77
78// Define Zod schemas for validation
315 try {
316 const completion = await retryWithBackoff(() =>
317 openai.chat.completions.create({
318 model: "gpt-4o-mini",
319 messages: [
352 console.log("gpt response", response, tweet);
353 } catch (validationError) {
354 console.error("Failed to validate OpenAI response:", validationError);
355 console.log("Raw completion:", completion);
356 return { isRelevant: false };
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },
237export default async function server(request: Request): Promise<Response> {
238 if (request.method === "POST" && new URL(request.url).pathname === "/generate-ppt") {
239 const { OpenAI } = await import("https://esm.town/v/std/openai");
240 const { blob } = await import("https://esm.town/v/std/blob");
241 const openai = new OpenAI();
242
243 try {
257 }
258
259 // Use OpenAI to analyze the code and generate slide structure
260 let slidesData;
261 try {
262 const analysis = await openai.chat.completions.create({
263 model: "gpt-4o-mini",
264 messages: [
219export default async function server(request: Request): Promise<Response> {
220 if (request.method === 'POST' && new URL(request.url).pathname === '/generate-ppt') {
221 const { OpenAI } = await import("https://esm.town/v/std/openai");
222 const { blob } = await import("https://esm.town/v/std/blob");
223 const openai = new OpenAI();
224
225 try {
236 }
237
238 // Use OpenAI to analyze the code and generate slide structure
239 const analysis = await openai.chat.completions.create({
240 model: "gpt-4o-mini",
241 messages: [
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3
4const openai = new OpenAI();
5const KEY = "productSummaryApi";
6const TABLE_NAME = `${KEY}_summaries_v4`;
38 const maxTokens = isLong ? 300 : 10;
39
40 const completion = await openai.chat.completions.create({
41 messages: [
42 {
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },
1/** @jsxImportSource npm:hono@3/jsx */
2import { chat } from "https://esm.town/v/stevekrouse/openai";
3import cronstrue from "npm:cronstrue";
4import { Hono } from "npm:hono@3";