Search
Code3,203
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES ---async function generateNoiseShaderCode() { try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
{ "title": "What is the base url / path for Groq API?", "content": "The base path for Groq's OpenAI-compatible API is `https://api.groq.com/openai/v1`. For example, the chat completions endpoint is `https://api.groq.com/openai/v1/chat/completions`.\n\nReview the full API documentation here: `https://console.groq.com/docs/overview`" }, { { "title": "What models are available on Groq?", "content": "To see available models on GroqCloud, you can programmatically check by sending a request to our models endpoint for a JSON list of all models or visit our [API documentation](https://console.groq.com/docs/models):\n\n```python\nimport requests\nimport os\n\napi_key = os.environ.get(\"GROQ_API_KEY\")\nurl = \"https://api.groq.com/openai/v1/models\"\n\nheaders = {\n \"Authorization\": f\"Bearer {api_key}\",\n \"Content-Type\": \"application/json\"\n}\n\nresponse = requests.get(url, headers=headers)\n\nprint(response.json())\n```" }, { { "title": "What is GroqCloud?", "content": "GroqCloud is Groq's cloud-based AI inference platform providing easy access ultra-fast inference to open-source AI models through API endpoints with OpenAI compatibility." }, {
// --- Imports ---import { blob } from "https://esm.town/v/std/blob"; // Val.town Blob Storage :contentReference[oaicite:14]{index=14}import OpenAI from "npm:openai"; // Official OpenAI SDK (works in Deno via npm:) :contentReference[oaicite:15]{index=15}// --- Types --- ) : undefined);const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");const OPENAI_MODEL = Deno.env.get("OPENAI_MODEL") ?? "gpt-5";const ORG_EMAIL_DOMAIN = (Deno.env.get("ORG_EMAIL_DOMAIN") ?? "wingspan.app") .toLowerCase();const LOOKBACK_HOURS = 48;const TRANSCRIPT_BATCH = 30; // callIds per /transcript request (safe batch size)const MAX_OPENAI_INPUT_CHARS = 120_000; // guard rails per call extraction// Color cycle for the bottom bar (Vestaboard char codes) // 3) Build diarized text & extract quotes per call const openai = new OpenAI({ apiKey: OPENAI_API_KEY }); const extracted: Quote[] = []; { name: undefined, domain: undefined }; const quotes = await extractQuotes(openai, diarized, { accountName: account?.name, accountDomain: account?.domain, // Truncate to protect token usage if (buf.length > MAX_OPENAI_INPUT_CHARS) { buf = buf.slice(0, MAX_OPENAI_INPUT_CHARS) + "\n[TRUNCATED]\n"; } return buf;}// -------------------- OpenAI extraction --------------------async function extractQuotes( openai: OpenAI, diarized: string, ctx: {`; const r = await openai.responses.create({ model: OPENAI_MODEL, input, // Force structured JSON output ); } if (!OPENAI_API_KEY) throw new Error("Set OPENAI_API_KEY."); if (!VESTABOARD_RW_KEY) throw new Error("Set VESTABOARD_RW_KEY.");}
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";import { OpenAI } from "https://esm.town/v/std/openai";const TABLE_NAME = 'kilo_code_mentions'; if (mentions.length === 0) return "No mentions to analyze."; const openai = new OpenAI(); const summary = mentions.map(m => ({ title: m.title, })); const completion = await openai.chat.completions.create({ messages: [{ role: "user",
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" },
name: 'Open in ChatGPT', icon: '๐ฎ', url: `https://chat.openai.com/?q=${encodeURIComponent(promptText)}`, }, {
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" },
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" },
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