Search

3,361 results found for openai (6148ms)

Code
3,266

- [ ] Get OpenTownie or Gemini or Claude or OpenAI to synthesize the core of these patterns into
- [ ] Convert this or into the basic react router guest book (and preserve this forum app in ano
- [ ] To what extent can these patterns be packaged up into a Val Town Router project? Would be
// @ts-nocheck
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- AI BEHAVIORAL GUIDELINES ---
let words = ["LOOPING"]; // Fallback word
try {
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: AI_LIST_PROMPT }],
}
} catch (error) {
console.error("Failed to fetch from OpenAI, using fallback list.", error);
}
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to cre
### OpenAI
```ts
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },
// @ts-nocheck
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- AI BEHAVIORAL GUIDELINES ---
let words = ["LOVE"];
try {
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: AI_LIST_PROMPT }],
}
} catch (error) {
console.error("Failed to fetch from OpenAI, utilizing fallback lexicon.", error);
}
// @ts-nocheck
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- AI BEHAVIORAL DIRECTIVE ---
}
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
import { Hono } from "https://esm.sh/hono@3.11.7";
import { OpenAI } from "https://esm.town/v/std/openai";
import { blob } from "https://esm.town/v/std/blob";
import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
});
const openai = new OpenAI();
// Serve static files
}
// Generate story with OpenAI
const storyPrompt = `Create an engaging story about "${subject}" that is divided into exactl
Make sure the story flows well between chapters and has a satisfying, happy conclusion. Retu
const completion = await openai.chat.completions.create({
messages: [
{ role: "system", content: "You are a creative storyteller who writes engaging stories f
## Features
- OpenAI integration for story generation
- AI image generation for story and chapter visuals
- Blob storage for caching generated content
## Environment Variables
The app uses OpenAI through Val Town's standard library, which handles API keys automatically.
- **Frontend**: React with TypeScript
- **Styling**: TailwindCSS
- **AI Services**: OpenAI for story generation, AI image generation
- **Text-to-Speech**: Web Speech API with male voice preference
- **Storage**: Val Town Blob storage for caching
join/fun2/main.tsx
3 matches
import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- CONSTANTS & CONFIGURATION ---
if (session.credits < totalCost) return c.json({ error: "Not enough credits." }, 402);
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: VIBE_CHECK_PROMPT }, { role: "user", content: text }],
import { type OpenAI } from "npm:openai";
import { dedent } from "npm:ts-dedent";
`.trim();
const developerPrompt: OpenAI.ChatCompletionDeveloperMessageParam = {
"role": "developer",
"content": promptContent,