Search

4,005 results found for openai (8332ms)

Code
3,901

/**
* AI Command Parsing Module
* Handles OpenAI integration for natural language command interpretation
*/
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
// AI Command Interface
- Don't use both placeholderType and elementId in the same response`;
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: prompt }],
model: "gpt-4o-mini",
For "replace" commands, identify what they want to replace (even if descriptive like "large text
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: prompt }],
model: "gpt-4o-mini",
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" },
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" },
bomb/whim/main.ts
3 matches
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// @ts-ignore
import { blob } from "https://esm.town/v/std/blob?v=11";
// --- CONSTANTS ---
const MAX_DEPTH = 15; // Safety brake for distillation
const openai = new OpenAI();
const INDEX_KEY = "wim_distillation_index";
}
const completion = await openai.chat.completions.create({
model: "gpt-4o",
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" },
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// @ts-ignore
import { blob } from "https://esm.town/v/std/blob?v=11";
const MAX_DEPTH = 50; // Max number of sentences
const NUM_CHOICES = 3; // Number of branches to generate at each step
const openai = new OpenAI();
const INDEX_KEY = "scribe_index";
}
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// @ts-ignore
import { blob } from "https://esm.town/v/std/blob?v=11";
// --- CONSTANTS ---
const MAX_STEPS = 30; // Safety brake
const openai = new OpenAI();
const INDEX_KEY = "vs_story_index";
}
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
Note: When changing a SQLite table's schema, change the table's name (e.g., add \_2 or \_3) to c
### 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" }],
model: "gpt-4o-mini",
"a cinematic portrait of a creator in a neon studio";
const apiKey = Deno.env.get("OPENAI_API_KEY");
if (!apiKey) {
// This means the secret isn't set or readable
return new Response(
JSON.stringify({ error: "Missing OPENAI_API_KEY in secrets/env" }),
{ status: 500, headers: { "Content-Type": "application/json" } },
);
}
const openaiRes = await fetch(
"https://api.openai.com/v1/images/generations",
{
method: "POST",
);
const text = await openaiRes.text();
if (!openaiRes.ok) {
// Return the actual OpenAI error so we can see it
return new Response(
JSON.stringify({
error: "OpenAI request failed",
status: openaiRes.status,
details: text,
}),