Search

4,018 results found for openai (9535ms)

Code
3,914

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" },
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" },
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- CONFIGURATION & PROMPTS ---
try {
const body = await req.json();
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
/** @jsxImportSource npm:preact */
import { blob } from "https://esm.town/v/std/blob?v=11";
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- CONSTANTS & CONFIGURATION ---
// --- AI GENERATION LOGIC ---
async function synthesizeRefinements(context: string): Promise<ConceptNode[]> {
const openai = new OpenAI();
const prompt = `
The user is engaging in a process of conceptual distillation.
`;
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: prompt }],
}
const apiKey = __secrets['OPENAI_API_KEY'];
if (!apiKey) {
return Response.json(
{ error: 'OpenAI API key not configured' },
{ status: 500 }
);
- For explanation, provide conceptual understanding and why this approach works`;
const response = await fetch('https://api.openai.com/v1/chat/completions', {
method: 'POST',
headers: {
if (!response.ok) {
console.error('OpenAI API error:', response.status);
return Response.json(
{ error: 'Failed to get solution from AI' },
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" },
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function () {
const openai = new OpenAI();
const careerUrls = [
console.log(`Fetched HTML from ${url}:`, html);
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: `Summarize the job listings from the following HTML content f
bomb/sb/main.ts
11 matches
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { nanoid } from "npm:nanoid";
async function generateBettingStrategies(gameContext: string) {
const openai = new OpenAI();
const prompt = `
You are a master sports handicapper. Based on the matchup data, generate the MOST RELEVANT betti
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
async function generateSportsAnalysts(gameContext: string, frameworks: any) {
const openai = new OpenAI();
const prompt = `
You are a Syndicate Boss building a team to analyze a specific game. Based on the game and frame
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
// --- The Architect ---
async function runArchitect(textSample: string, agentPersonas: any) {
const openai = new OpenAI();
const context = `
GAME DATA: """${textSample.substring(0, 3000)}"""
`;
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
// --- The Analysts ---
async function runAgentAnalysis(agent: any, text: string, frameworks: any) {
const openai = new OpenAI();
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
// --- The Synthesizer ---
async function synthesizeReport(results: any[]) {
const openai = new OpenAI();
const validResults = results.filter((r) => r.success);
if (validResults.length === 0) {
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: prompt }],
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" },