Search
Code3,285
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";import { socialDataSearch, Tweet } from "https://esm.town/v/stevekrouse/socialDataSearch";import { OpenAI } from "https://esm.town/v/std/openai";interface AnalyzedTweet { if (!tweets.length) return []; const openai = new OpenAI(); const tweetsText = tweets.map((tweet, index) => try { const completion = await openai.chat.completions.create({ messages: [{ role: "user", content: prompt }], model: "gpt-4o-mini",
export default async function(req) { const { OpenAI } = await import("https://esm.town/v/std/openai"); const CORS_HEADERS = { "Access-Control-Allow-Origin": "*", const action = url.searchParams.get("action"); const sourceUrl = import.meta.url.replace("esm.town", "val.town"); const openai = new OpenAI(); const jsonResponse = (body, status) => new Response(JSON.stringify(body), { status, headers: { ...CORS_HEADERS, "Content-Type": "application/json" } }); async function callAI(systemPrompt, userMessage) { try { const response = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
import askOpenAI from "./openai.tsx"const PROMPT = ` const data = matchData(matchJson) const message = PROMPT + "\n\n" + JSON.stringify(data) return await askOpenAI(message)}
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" },
export default async function(req: Request) { const { OpenAI } = await import("https://esm.town/v/std/openai"); const { PDFExtract } = await import("npm:pdf.js-extract"); const action = url.searchParams.get("action"); const sourceUrl = import.meta.url.replace("esm.town", "val.town"); const openai = new OpenAI(); const MAX_TEXT_SUGGEST = 20000; const MAX_TEXT_ANALYZE = 30000; agentName: string, ): Promise<object> { log.push({ agent: agentName, type: "step", message: `Calling OpenAI gpt-4o...` }); try { const response = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
Configure the following variables in your environment: - `AGENT_API_KEY` (This is a secure token that you choose to secure the agent.tsx POST endpoint)- `OPENAI_API_KEY` (An OpenAI API Key)- `EXA_API_KEY` (Optional, though needed if you use the web search tool)
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" },
export default async function(req: Request) { const { OpenAI } = await import("https://esm.town/v/std/openai"); const { PDFExtract } = await import("npm:pdf.js-extract"); const action = url.searchParams.get("action"); const sourceUrl = import.meta.url.replace("esm.town", "val.town"); const openai = new OpenAI(); const MAX_TEXT_SUGGEST = 20000; const MAX_TEXT_ANALYZE = 30000; agentName: string, ): Promise<object> { log.push({ agent: agentName, type: "step", message: `Calling OpenAI gpt-4o...` }); try { const response = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
const aiTools: AITool[] = [ // AI Assistants & Chatbots { name: "ChatGPT", url: "https://chatgpt.com/", category: "Assistant", description: "OpenAI's conversational AI assistant" }, { name: "Claude", url: "https://claude.ai/", category: "Assistant", description: "Anthropic's AI assistant for various tasks and conversations" }, { name: "Gemini", url: "https://gemini.google.com/", category: "Assistant", description: "Google's advanced AI assistant" }, // Image Generation & Editing { name: "Midjourney", url: "https://www.midjourney.com/", category: "Images", description: "AI art and image generation platform" }, { name: "DALL·E 3", url: "https://openai.com/dall-e-3", category: "Images", description: "OpenAI's advanced image generation model" }, { name: "Stable Diffusion", url: "https://stability.ai/", category: "Images", description: "Open-source AI image generation" }, { name: "Lexica", url: "https://lexica.art/", category: "Images", description: "AI art search engine and generator" }, { name: "Runway", url: "https://runwayml.com/", category: "Video", description: "AI video editing and generation tools" }, { name: "Synthesia", url: "https://www.synthesia.io/", category: "Video", description: "AI video generation with virtual avatars" }, { name: "Sora", url: "https://openai.com/sora", category: "Video", description: "OpenAI's text-to-video generation model" }, { name: "Kling", url: "https://klingai.com/", category: "Video", description: "AI video generation platform" }, { name: "Hailuo", url: "https://hailuo.ai/", category: "Video", description: "AI video creation tool" }, // AI Research & Platforms { name: "OpenAI", url: "https://openai.com/", category: "Research", description: "AI research and deployment company" }, { name: "Anthropic", url: "https://www.anthropic.com/", category: "Research", description: "AI safety research company" }, { name: "xAI", url: "https://x.ai/", category: "Research", description: "Elon Musk's AI company" },
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