Search
Code3,186
// @ts-nocheckimport { Hono } from "npm:hono@4.4.12";import { OpenAI } from "https://esm.town/v/std/openai?v=4";import { blob } from "https://esm.town/v/std/blob?v=11";const app = new Hono();const openai = new OpenAI();async function getSim(run_id) { messages.push({ role: "user", content: `Current State: ${JSON.stringify(status)}. Formulate a plan and use 'execute_command_sequence'.` }); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: messages, tools: getToolSpec(), tool_choice: "auto" }); const responseMessage = completion.choices[0].message; messages.pop();
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 { Hono } from "npm:hono@4.4.12";import { streamSSE } from "npm:hono@4.4.12/streaming";import { OpenAI } from "https://esm.town/v/std/openai?v=4";import { blob } from "https://esm.town/v/std/blob?v=11";const app = new Hono();const openai = new OpenAI();async function getSim(run_id) { }); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: messages,
import { getIssueContentAsMarkdown } from "../../api/index.tsx";import { GreenPTClient } from "https://esm.town/v/cricks_unmixed4u/openai-client@45-main/main.tsx";import { fetchIssuesUpdatedSince } from "../../shared/github-client.ts";
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";// For parsing HTML content from web requestsimport * as cheerio from "npm:cheerio@1.0.0-rc.12"; if (!prompt) throw new Error("Prompt is required."); const openai = new OpenAI(); const stream = new ReadableStream({ }); const workerResponseStream = await openai.chat.completions.create( { model: "gpt-4o", }); const verifierResponse = await openai.chat.completions.create({ model: "gpt-4o", messages: [ }); const formatterResponse = await openai.chat.completions.create({ model: "gpt-4o", messages: [
* Stage 2: Synthesize consensus across all individual analyses * * Uses actual OpenAI Chat Completions API with proper error handling */import { OpenAI } from "https://esm.town/v/std/openai";/*** Types ***/async function analyzeIndividualTranscript( openai: OpenAI, model: string, question: string, try { const completion = await openai.chat.completions.create({ model, messages: [ const content = completion.choices[0]?.message?.content; if (!content) { throw new Error("No response content from OpenAI"); }async function synthesizeConsensus( openai: OpenAI, model: string, question: string, try { const completion = await openai.chat.completions.create({ model, messages: [ const content = completion.choices[0]?.message?.content; if (!content) { throw new Error("No response content from OpenAI"); } // Validation if (!request?.apiKey) { return { success: false, error: "Missing OpenAI API key", timestamp }; } if (!request?.question?.trim()) { const config = { ...DEFAULTS, ...options }; const openai = new OpenAI({ apiKey: request.apiKey }); try { const analysis = await analyzeIndividualTranscript( openai, config.extractModel, request.question, console.log("๐ค Stage 2: Consensus synthesis..."); const consensus = await synthesizeConsensus( openai, config.consensusModel, request.question,
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" },
/** * Test endpoint for OpenAI consensus analysis * Tests the simplified two-stage approach with timeout protection */import { analyzeTranscriptsWithConsensus } from "../services/openai.service.ts";// Sample test data - small, controlled transcripts */function estimateCost(inputTokens: number, outputTokens: number): number { // GPT-5 pricing (approximate - check current OpenAI pricing) const INPUT_COST_PER_1K = 0.01; // $0.01 per 1K input tokens const OUTPUT_COST_PER_1K = 0.03; // $0.03 per 1K output tokensexport default async function(req: Request): Promise<Response> { const startTime = Date.now(); console.log("๐งช Starting OpenAI service test..."); try { // Get API key from environment const apiKey = Deno.env.get("OPENAI_API_KEY"); if (!apiKey) { return new Response(JSON.stringify({ success: false, error: "Missing OPENAI_API_KEY environment variable", timestamp: new Date().toISOString() }), {
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