Search
Code3,221
export default async function server(request: Request): Promise<Response> { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); if (request.method === "POST" && new URL(request.url).pathname === "/chat") { async start(controller) { try { const chatCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ } } catch (error) { console.error("OpenAI Error:", error); controller.enqueue( new TextEncoder().encode(
export default async function server(request: Request): Promise<Response> { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); if (request.method === "POST" && new URL(request.url).pathname === "/chat") { async start(controller) { try { const chatCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ } } catch (error) { console.error("OpenAI Error:", error); controller.enqueue( new TextEncoder().encode(
export default async function server(request: Request): Promise<Response> { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); if (request.method === "POST" && new URL(request.url).pathname === "/chat") { async start(controller) { try { const chatCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ } } catch (error) { console.error("OpenAI Error:", error); controller.enqueue( new TextEncoder().encode(
const { text } = await req.json(); const apiKey = Deno.env.get("OPENAI_API_KEY"); const apiUrl = "https://api.openai.com/v1/chat/completions"; const body = {
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" },
"express": "^4.18.2", "node-fetch": "^3.3.2", "openai": "^4.11.0", "tesseract.js": "^2.1.4" }
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";import { OpenAI } from "https://esm.town/v/std/openai";import EmailReplyParser from "https://esm.sh/email-reply-parser@2.0.1";const openai = new OpenAI(); })); const completion = await openai.chat.completions.create({ messages: [ { role: "system", content: system_prompt },
brian@airbnb.com,Brian Cheskydrew@dropbox.com,Drew Houstonsam@openai.com,Sam Altmantim@apple.com,Tim Cookjeff@amazon.com,Jeff Bezos
// It uses the Hono web framework to serve a Single-Page Application (SPA).import { OpenAI } from "https://esm.town/v/std/openai";import { Hono } from "npm:hono@4.4.12";import type { Context } from "npm:hono@4.4.12"; if (!industry) return c.json({ error: "Industry is a required field." }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { if (!occupation) return c.json({ error: "Occupation is a required field." }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: PROMPT_REFINER_SYSTEM_PROMPT }, { role: "user", content: userInput }], if (!refined_prompt) return c.json({ error: "refined_prompt is required" }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: INPUT_EXTRACTOR_SYSTEM_PROMPT }, { if (!refined_prompt) return c.json({ error: "refined_prompt is required" }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: CLARIFICATION_AGENT_SYSTEM_PROMPT }, { try { const openai = new OpenAI(); const agentCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: systemPromptWithContext }, { if (!agentOutput) throw new Error("The agent returned no content."); const htmlCompletion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: HTML_FORMATTER_SYSTEM_PROMPT }, { role: "user", content: agentOutput }],
}, { "title": "An Introduction to OpenAI fine-tuning", "slug": "an-introduction-to-openai-fine-tuning", "link": "/blog/an-introduction-to-openai-fine-tuning", "description": "How to customize OpenAI to your liking", "pubDate": "Fri, 25 Aug 2023 00:00:00 GMT", "author": "Steve Krouse", "slug": "val-town-newsletter-16", "link": "/blog/val-town-newsletter-16", "description": "Our seed round, growing team, Codeium completions, @std/openai, and more", "pubDate": "Mon, 22 Apr 2024 00:00:00 GMT", "author": "Steve Krouse",
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