Search
Code3,181
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// @ts-ignoreimport { DOMParser } from "npm:linkedom";// --- AI & TOOL DEFINITIONS ---const openai = new OpenAI();// This is the "mind" of Campy. It defines its persona, goals, and available tools. `; const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [async function generate_talking_points(subject: string, context: string) { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ const { messages } = await req.json(); // 1. Send the conversation to OpenAI const response = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: CAMPY_SYSTEM_PROMPT }, ...messages], // 4. After executing tools, let the model process the results const secondResponse = await openai.chat.completions.create({ model: "gpt-4o", messages: [
import { Hono } from "npm:hono@4.4.12";import { OpenAI } from "https://esm.town/v/std/openai";import type { Context } from "npm:hono@4.4.12";import { streamText } from "npm:hono/streaming";// --- BACKEND SERVICES ---const services = { async callOpenAI( systemPrompt: string, userContent: string | object, } = options; const openai = new OpenAI(); const messages: any[] = [ { role: "system", content: systemPrompt }, try { const completion = await openai.chat.completions.create(requestPayload); if (stream && c) { return completion; } catch (e) { console.error(`Error calling OpenAI: ${e.message}`); throw new Error("AI service failed."); } try { const completion = await services.callOpenAI( "You are a helpful assistant following strict output rules.", prompt, const body = await c.req.json(); const userContent = { type, ...body }; return services.callOpenAI( config.prompts.DYNAMIC_LIST_GENERATOR, userContent, JSON.stringify(company_context) }\n\nOccupation: ${occupation_title}\n\nTask: ${task}`; return services.callOpenAI(config.prompts.PROMPT_REFINER, userContent, { c, isJson: true,app.post("/api/inputs", async (c: Context) => { const { refined_prompt } = await c.req.json<InputsBody>(); return services.callOpenAI(config.prompts.INPUT_EXTRACTOR, refined_prompt, { c, isJson: true, return streamText(c, async (stream) => { try { const openai = new OpenAI(); const initialResponse = await openai.chat.completions.create({ model: config.models.major, messages, } const finalStream = await openai.chat.completions.create({ model: config.models.major, messages, JSON.stringify(company_context) }\n\nTask Briefing:\n${refined_prompt}`; return services.callOpenAI( config.prompts.EVALUATION_CRITERIA_GENERATOR, userContent, return streamText(c, async (stream) => { try { const openai = new OpenAI(); const initialResponse = await openai.chat.completions.create({ model: config.models.major, // Use the powerful model for evaluation messages, } const finalStream = await openai.chat.completions.create({ model: config.models.major, messages, return streamText(c, async (stream) => { try { const openai = new OpenAI(); const initialResponse = await openai.chat.completions.create({ model: config.models.major, messages, } const finalStream = await openai.chat.completions.create({ model: config.models.major, messages, const systemPrompt = `${config.prompts.REFINER_AGENT}\n\nOutput Language: ${language}`; return services.callOpenAI(systemPrompt, userContent, { c, stream: true });});
}, { "owner": "openai", "name": "gpt-oss-120b", "type": "text-generation", "id": "openai/gpt-oss-120b", "description": "gpt-oss-120b is an open-weight, 117B-parameter Mixture-of-Experts (MoE) language model from OpenAI designed for high-reasoning, agentic, and general-purpose production use cases. The model supports configurable reasoning depth, full chain-of-thought access, and native tool use, including function calling, browsing, and structured output generation.", "cover_img_url": "https://shared.deepinfra.com/models/openai/gpt-oss-120b/cover_image.a422aaee1b1d6446e2ccb86489f79eb77a2143a4d2eef7f4e32a314679cc204a.webp", "tags": [], "pricing": { const response = await fetch( "https://api.deepinfra.com/v1/openai/chat/completions", { method: "POST",
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" },
let response; try { response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: {
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" },
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// @ts-ignoreimport { blob } from "https://esm.town/v/std/blob?v=11"; if (req.method === "POST") { try { const openai = new OpenAI(); const body = await req.json(); switch (action) { case "decide": { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ case "cureGoal": { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ case "reflect": { const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
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