Search
Code3,166
import OpenAI from "openai";import STARTER_PROMPTS from "../public/starter-prompts.js"; }; } else { const openai = new OpenAI({ apiKey: Deno.env.get( "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", ), }); const completion = await openai.chat.completions.create({ messages: [ { }, ].filter(Boolean), model: "gpt-4-turbo-preview", // Or another suitable OpenAI model max_tokens: 2000, // Adjust as needed }); return { code: extractCodeFromFence(completion.choices[0].message.content), time: 0, // OpenAI doesn't directly provide completion time totalTokens: completion.usage?.total_tokens || 1, };
export default async function server(request: Request): Promise<Response> { if (request.method === "POST" && new URL(request.url).pathname === "/chat") { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); const { messages, rawInput } = await request.json(); ]; const stream = await openai.chat.completions.create({ model: "gpt-4o-mini", messages: constrainedMessages,
setIsLoading(true); try { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); const analysisPrompt = `Comprehensive Medical Report Analysis:Respond with a structured, compassionate, and informative analysis that prioritizes patient understanding and next steps.`; const analysis = await openai.chat.completions.create({ model: "gpt-4o-mini", messages: [export default async function server(request: Request): Promise<Response> { if (request.method === 'POST' && new URL(request.url).pathname === '/chat') { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); const { messages } = await request.json(); const stream = await openai.chat.completions.create({ model: "gpt-4o-mini", messages: messages,
import { openai } from "npm:@ai-sdk/openai";import { generateText } from "npm:ai"; try { const { text: compliments } = await generateText({ model: openai("gpt-4o-mini"), system: "You are a creative compliment generator.", prompt: "Generate 5 unique, thoughtful, and specific compliments about a person named Traves.",
import { openai } from "npm:@ai-sdk/openai";import { generateText } from "npm:ai";
import { openai } from "npm:@ai-sdk/openai";import { generateText } from "npm:ai"; const { text: generatedCompliment } = await generateText({ model: openai("gpt-4o-mini"), system: "You are a creative compliment generator.", prompt: `Generate a compliment for: ${compliment}`,
import { openai } from "npm:@ai-sdk/openai";import { generateText } from "npm:ai"; } const { text: processedOutput } = await generateText({ model: openai("gpt-4o-mini"), system: "You are a helpful assistant.", prompt: "Process the following input based on the requirements: " + body.input,
export default async function server(request: Request): Promise<Response> { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); // Enhanced server-side logging `; const completion = await openai.chat.completions.create({ model: "gpt-4o-mini", response_format: { type: "json_object" }, `; const completion = await openai.chat.completions.create({ model: "gpt-4o-mini", response_format: { type: "json_object" }, `; const completion = await openai.chat.completions.create({ model: "gpt-4o-mini", messages: [{ role: "user", content: prompt }],
import { openai } from "npm:@ai-sdk/openai";import { generateText } from "npm:ai";
method: "POST", body: JSON.stringify({ "url": "https://en.wikipedia.org/wiki/OpenAI", "elements": [{ // The second <p> element on the page
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