Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bart_info.art.src%7D?q=openai&page=95&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=openai

Returns an array of strings in format "username" or "username/projectName"

Found 1605 results for "openai"(859ms)

chatgptchessmain.tsx4 matches

@tmcw•Updated 5 months ago
1import { OpenAI } from "https://esm.town/v/std/openai?v=5"
2import { sqlite } from "https://esm.town/v/std/sqlite?v=6"
3import { Chess } from "npm:chess.js"
131 return c.html(`<body>
132 <div class='p-4'>
133 <h2 class='font-bold'>OpenAI Chess</h2>
134 <p class='pb-4'>Play chess against ChatGPT-4</p>
135 <div id="myBoard" style="width: 400px"></div>
171 chess.move(san)
172
173 const openai = new OpenAI()
174
175 let messages = []
182 args: [c.req.param().id, `Requesting response to ${san}`],
183 })
184 const completion = await openai.chat.completions.create({
185 messages: [
186 {

reflectiveBrownCowmain.tsx3 matches

@CoachCompanion•Updated 5 months ago
670 }
671
672 const { OpenAI } = await import("https://esm.town/v/std/openai");
673 const regenerateKey = request.headers.get("Regenerate-Key") || "0";
674 const openai = new OpenAI();
675
676 const { sport, skillLevel, ageGroup, groupSize, selectedSkills, sessionDuration } = await request.json();
707 Ensure that the conclusion ties together all the main concepts covered in the training, reinforces the learning objectives, and provides clear takeaways for both participants and coaches. The questions in the conclusion should prompt critical thinking about the skills practiced and their application in the sport.`;
708
709 const completion = await openai.chat.completions.create({
710 messages: [{ role: "user", content: prompt + `\n\nRegenerate key: ${regenerateKey}` }],
711 model: "gpt-4o-mini",

yuktiVoiceAssistantmain.tsx15 matches

@Aditya230•Updated 5 months ago
209
210 try {
211 // More robust OpenAI import and initialization
212 const openaiModule = await import("https://esm.town/v/std/openai");
213
214 // Detailed logging and error checking
215 console.log("OpenAI Module:", Object.keys(openaiModule));
216
217 // Use a more flexible approach to accessing OpenAI
218 const OpenAI = openaiModule.default || openaiModule.OpenAI;
219
220 if (!OpenAI) {
221 throw new Error("Unable to find OpenAI constructor in the imported module");
222 }
223
224 const openai = new OpenAI({
225 // Add any necessary configuration if required
226 // For example: apiKey might be needed depending on the library version
227 });
228
229 // Verify the openai object has the required methods
230 if (!openai.chat || !openai.chat.completions || !openai.chat.completions.create) {
231 throw new Error("OpenAI object does not have the expected chat completion method");
232 }
233
244 };
245
246 const completion = await openai.chat.completions.create({
247 messages: [systemPrompt, ...messages],
248 model: "gpt-4o-mini",
259 if (url.pathname === '/generate-image') {
260 // Verify images method exists
261 if (!openai.images || !openai.images.generate) {
262 throw new Error("OpenAI object does not have the expected image generation method");
263 }
264
266 const { prompt, style, count } = body;
267
268 const imageResponse = await openai.images.generate({
269 model: "dall-e-3",
270 prompt: `A ${style} image of: ${prompt}.

plantIdentifierAppmain.tsx3 matches

@mahtabtattur•Updated 5 months ago
2import React, { useState, useRef, useCallback, useEffect } from "https://esm.sh/react";
3import { createRoot } from "https://esm.sh/react-dom/client";
4import OpenAI from "https://esm.sh/openai";
5
6// Plant Database
121 const base64Image = reader.result.split(',')[1];
122
123 const openai = new OpenAI({
124 apiKey: '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',
125 dangerouslyAllowBrowser: true
127
128 try {
129 const response = await openai.chat.completions.create({
130 model: "gpt-4o",
131 messages: [

generateQuizmain.tsx3 matches

@rayyan•Updated 5 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { z } from "npm:zod";
3
33 }
34
35 const openai = new OpenAI();
36
37 const completion = await openai.chat.completions.create({
38 messages: [
39 { role: "user", content: prompt(topic, level.data, stage, difficulty.data) },

pageshotmain.tsx1 match

@yawnxyz•Updated 5 months ago
30 "settings": {
31 "model": "gpt-4o-mini",
32 "provider": "openai",
33 "system": "please summarize the following article in a 2-4 sentences, describing it from a 3rd person point of view",
34 "prompt": "{jina.content}"

yc_findermain.tsx1 match

@stevekrouse•Updated 5 months ago
18brian@airbnb.com,Brian Chesky
19drew@dropbox.com,Drew Houston
20sam@openai.com,Sam Altman
21tim@apple.com,Tim Cook
22jeff@amazon.com,Jeff Bezos

weatherGPTmain.tsx3 matches

@serkanokur•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { OpenAI } from "npm:openai";
3
4let location = "munchen";
8).then(r => r.json());
9
10const openai = new OpenAI();
11let chatCompletion = await openai.chat.completions.create({
12 messages: [{
13 role: "user",

robustCopperCardinalmain.tsx3 matches

@sky_porie_fire443•Updated 5 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3const openai = new OpenAI();
4
5const completion = await openai.chat.completions.create({
6 messages: [
7 { role: "user", content: "C#怎么实现一个线程安全的求和" },

sqlitemain.tsx5 matches

@granin•Updated 5 months ago
149
150 try {
151 // Dynamic imports for SQLite and OpenAI
152 const [{ sqlite }, { OpenAI }] = await Promise.all([
153 import("https://esm.town/v/stevekrouse/sqlite"),
154 import("https://esm.town/v/std/openai")
155 ]);
156
157 const openai = new OpenAI();
158 const SPECIFICATIONS_TABLE = "val_town_agent_specifications";
159 const IMPLEMENTATIONS_TABLE = "val_town_agent_implementations";
227
228 // Generate implementation using GPT-4o-mini
229 const completion = await openai.chat.completions.create({
230 messages: [
231 {

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 2 days ago

testOpenAI1 file match

@stevekrouse•Updated 4 days ago
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": "*",