137Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
138
139### OpenAI
140```ts
141import { OpenAI } from "https://esm.town/v/std/openai";
142const openai = new OpenAI();
143const completion = await openai.chat.completions.create({
144 messages: [
145 { role: "user", content: "Say hello in a creative way" },
137Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
138
139### OpenAI
140```ts
141import { OpenAI } from "https://esm.town/v/std/openai";
142const openai = new OpenAI();
143const completion = await openai.chat.completions.create({
144 messages: [
145 { role: "user", content: "Say hello in a creative way" },
408 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
409 const { email: sendEmail } = await import("https://esm.town/v/std/email");
410 const { OpenAI } = await import("https://esm.town/v/std/openai");
411 const openai = new OpenAI();
412
413 const KEY = "bhaavsynthlandipgpage";
1import { readFile } from "https://esm.town/v/std/utils@71-main/index.ts";
2import { createOpenAI } from "npm:@ai-sdk/openai";
3import { streamText, tool } from "npm:ai";
4import { z } from "npm:zod";
56});
57
58const openai = createOpenAI({
59 baseURL: "https://std-openaiproxy.web.val.run/v1",
60 apiKey: Deno.env.get("valtown"),
61 organization: undefined,
79 try {
80 const result = await streamText({
81 model: openai("gpt-4o-mini"),
82 messages,
83 tools: {
111 });
112 } catch (error) {
113 console.error("OpenAI API error:", error);
114 return new Response("An error occurred during the analysis.");
115 }
137Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
138
139### OpenAI
140```ts
141import { OpenAI } from "https://esm.town/v/std/openai";
142const openai = new OpenAI();
143const completion = await openai.chat.completions.create({
144 messages: [
145 { role: "user", content: "Say hello in a creative way" },
4
5import { email } from "https://esm.town/v/std/email";
6import { OpenAI } from "https://esm.town/v/std/openai";
7import { Project, EmailSubscriber } from "../shared/types.ts";
8import { logger } from "./utils.ts";
9
10const openai = new OpenAI();
11
12/**
44
45 try {
46 // Generate welcome email content using OpenAI
47 const prompt = `
48 You are writing a personalized welcome email to someone who just subscribed to "${project.name}".
59 `;
60
61 const completion = await openai.chat.completions.create({
62 messages: [
63 { role: "system", content: "You are a helpful assistant that writes excellent, personalized emails." },
26 console.log("🔊 Sending request to Groq Speech API");
27 const start = Date.now();
28 const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
29 method: "POST",
30 headers: {
20 console.log("🔵 Sending request to Groq API");
21 const start = Date.now();
22 const response = await fetch("https://api.groq.com/openai/v1/chat/completions", {
23 method: "POST",
24 headers: {
63 console.log("🎤 Sending request to Groq Whisper API");
64 const start = Date.now();
65 const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", {
66 method: "POST",
67 headers: {
137Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
138
139### OpenAI
140```ts
141import { OpenAI } from "https://esm.town/v/std/openai";
142const openai = new OpenAI();
143const completion = await openai.chat.completions.create({
144 messages: [
145 { role: "user", content: "Say hello in a creative way" },