Search

4,021 results found for openai (1241ms)

Code
3,916

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" },
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" },
- `main.tsx` - Main cron function and Discord webhook
- `fetch-vals.ts` - Fetches and filters new vals using Val Town SDK
- `ai-summarizer.ts` - Generates OpenAI summaries for vals without READMEs
## Additional logic
- Filter out commonly remixed utility vals like Blob Admin, SQLiteExplorer
- Skip shallow remixes (forks with ≤3 versions)
`main.tsx` files for AI summaries and limit code sent to OpenAI to 5KB to avoid token limits
## Setup
1. Set `DISCORD_WEBHOOK` environment variable
2. Set `OPENAI_API_KEY` environment variable
3. Set `testMode = false` in main.tsx for production
import { OpenAI } from "npm:openai";
import ValTown from "npm:@valtown/sdk";
const openai = new OpenAI();
const client = new ValTown();
}
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{
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" },
_2 or _3) to create a fresh table.
### 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" },
- Cron triggers: `*.cron.ts`, export default async function()
- Email triggers: `*.email.ts`, export default async function(email: Email)
- Use Val Town std libraries: `blob`, `sqlite`, `openai`, `email`
- Never use Deno KV, avoid external images, use Tailwind via CDN
import { z } from "npm:zod@4.0.5";
import { generateText, stepCountIs, tool } from "npm:ai@5.0.15";
import { openai } from "npm:@ai-sdk/openai@2.0.15";
import { Sandbox } from "npm:@e2b/code-interpreter";
const result = await generateText({
model: openai("gpt-4o"),
stopWhen: stepCountIs(5),
tools: {
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" },
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" },