Search
Code3,275
For example:```javascriptconsole.log("Scrape result:", await ScrapeWebsite("https://en.wikipedia.org/wiki/OpenAI", "p:nth-of-type(2)"));```
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";import { Hono } from "npm:hono@4.4.12"; } const openai = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY") }); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// @ts-ignoreimport { sqlite } from "https://esm.town/v/std/sqlite?v=4"; } const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
import { OpenAI } from "https://esm.town/v/std/openai";export interface CalendarEvent {// Extract events from web page content using GPT-4export async function extractEventsFromContent(content: string, url: string): Promise<CalendarEvent[]> { const openai = new OpenAI(); // Clean and truncate content to avoid token limits try { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ const response = completion.choices[0]?.message?.content?.trim(); if (!response) { throw new Error("No response from OpenAI"); }
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// @ts-ignoreimport { sqlite } from "https://esm.town/v/std/sqlite?v=4";// --- CORE LOGIC & SEEDING ---async function updateCustomerAiProfile(customerId: number, openai) { const { rows } = await sqlite.execute({ sql: }); if (rows.length === 0) return; const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: CUSTOMER_PROFILE_ANALYST_PROMPT }, {}async function seedDatabase(openai) { await sqlite.batch([ "DELETE FROM feedback;", }); } for (const c of customersToSeed) { await updateCustomerAiProfile(c.id, openai); }} const url = new URL(req.url); const action = url.searchParams.get("action"); const openai = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY") }); await initializeDatabase(); try { switch (action) { case "seedDatabase": await seedDatabase(openai); return new Response(JSON.stringify({ success: true })); case "ingestInteraction": { ], }); await updateCustomerAiProfile(customerId, openai); return new Response(JSON.stringify({ success: true, customerId })); } }); if (rows.length === 0) return new Response(JSON.stringify({ success: true, segments: [] })); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: ADVANCED_SEGMENTATION_PROMPT }, {
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { 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-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- const { initialPositions, shotParams } = await req.json(); const { collisionLog } = await runServerPhysics(initialPositions, shotParams); const openai = new OpenAI(); 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 create a fresh table.### OpenAI```tsimport { 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 create a fresh table.### OpenAI```tsimport { 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";import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";import { Octokit } from "npm:octokit"; commitType: string,): Promise<string> { const openai = new OpenAI(); const prompt = try { const completion = await openai.chat.completions.create({ messages: [{ role: "user", content: prompt }], model: "gpt-4o-mini",
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
/**
* Practical Implementation of Collective Content Intelligence
* Bridging advanced AI with collaborative content creation
*/
exp
kwhinnery_openai
lost1991
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
No docs found