Search

3,281 results found for โ€œopenaiโ€ (5461ms)

Code
3,186

// @ts-nocheck
import { 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
const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: message
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 cre
### OpenAI
```ts
import { 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 cre
### OpenAI
```ts
import { 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";
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 cre
### OpenAI
```ts
import { 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-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// For parsing HTML content from web requests
import * 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 cre
### OpenAI
```ts
import { 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 tokens
export 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()
}), {
โ€ฆ
46
โ€ฆ
Next