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/$%7Burl%7D?q=openai&page=96&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 1640 results for "openai"(1157ms)

sendSassyEmailmain.tsx4 matches

@transcendr•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email";
2import { OpenAI } from "https://esm.town/v/std/openai";
3
4// Configuration object for customizing the sassy message generation
10 },
11
12 // Prompt configuration for OpenAI
13 prompts: {
14 // Array of different prompt styles to rotate through
32
33export default async function() {
34 const openai = new OpenAI();
35
36 // Randomly select a prompt style
39 ];
40
41 const completion = await openai.chat.completions.create({
42 messages: [
43 {

Ms_Spanglermain.tsx4 matches

@arthrod•Updated 5 months ago
287
288 try {
289 const { OpenAI } = await import("https://esm.town/v/std/openai");
290 const openai = new OpenAI();
291
292 const completion = await openai.chat.completions.create({
293 messages: [
294 {
307 });
308 } catch (error) {
309 console.error("OpenAI error:", error);
310 return c.json({ response: "Neural networks malfunctioning. Try again, human." });
311 }

openai_structured_output_demoREADME.md3 matches

@arthrod•Updated 5 months ago
1# OpenAI Structured Output Demo
2
3Ensure responses follow JSON Schema for structured outputs
5The following demo uses zod to describe and parse the response to JSON.
6
7Learn more in the [OpenAI Structured outputs
8 docs](https://platform.openai.com/docs/guides/structured-outputs/introduction).
9

openai_structured_output_demomain.tsx4 matches

@arthrod•Updated 5 months ago
1import { zodResponseFormat } from "https://esm.sh/openai/helpers/zod";
2import { z } from "https://esm.sh/zod";
3import { OpenAI } from "https://esm.town/v/std/openai";
4
5const openai = new OpenAI();
6
7const CalendarEvent = z.object({
11});
12
13const completion = await openai.beta.chat.completions.parse({
14 model: "gpt-4o-mini",
15 messages: [

comfortableOrangeTyrannosaurusmain.tsx3 matches

@arthrod•Updated 5 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3const openai = new OpenAI();
4const completion = await openai.chat.completions.create({
5 "messages": [
6 { "role": "user", "content": "Say hello in a creative way" },

lazyCookmain.tsx3 matches

@dxaginfo•Updated 5 months ago
241export default async function server(request: Request): Promise<Response> {
242 if (request.method === "POST" && new URL(request.url).pathname === "/recipes") {
243 const { OpenAI } = await import("https://esm.town/v/std/openai");
244 const openai = new OpenAI();
245
246 const { numPeople, numRecipes, difficulty, cuisine, ingredients, unit, dietaryRestrictions } = await request.json();
255
256 try {
257 const completion = await openai.chat.completions.create({
258 messages: [{ role: "user", content: prompt }],
259 model: "gpt-4o-mini",

savvyTealCardinalmain.tsx3 matches

@dxaginfo•Updated 5 months ago
743 }
744
745 const { OpenAI } = await import("https://esm.town/v/std/openai");
746 const regenerateKey = request.headers.get("Regenerate-Key") || "0";
747 const openai = new OpenAI();
748
749 const { sport, skillLevel, ageGroup, groupSize, selectedSkills, sessionDuration } = await request.json();
790 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.`;
791
792 const completion = await openai.chat.completions.create({
793 messages: [{ role: "user", content: prompt + `\n\nRegenerate key: ${regenerateKey}` }],
794 model: "gpt-4o-mini",

ThankYouNoteGeneratormain.tsx3 matches

@prashamtrivedi•Updated 5 months ago
306 console.log(`Received ${request.method} request to ${request.url}`);
307
308 const { OpenAI } = await import("https://esm.town/v/std/openai");
309 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
310 const openai = new OpenAI();
311 const url = new URL(request.url);
312
337 console.log("Generated prompt:", prompt);
338
339 const completion = await openai.chat.completions.create({
340 messages: [{ role: "user", content: prompt }],
341 model: "gpt-4o-mini",

helpfulFuchsiaAmphibianmain.tsx3 matches

@Handlethis•Updated 5 months ago
12 try {
13 // Generate AI audio description
14 const { OpenAI } = await import("https://esm.town/v/std/openai");
15 const openai = new OpenAI();
16
17 const audioDescCompletion = await openai.chat.completions.create({
18 messages: [{
19 role: "user",

breakdownmain.tsx4 matches

@yawnxyz•Updated 5 months ago
39// export const model = "gpt-4o-mini"
40// export const model = "gpt-4o"
41// export const provider = "openai"
42
43export const summaryModel = "gpt-4o-mini"
44export const summaryProvider = "openai"
45
46
48// export const smartProvider = "google"
49export const smartModel = "gpt-4o-mini"
50export const smartProvider = "openai"
51
52export const cheapModel = "gpt-4o-mini"
53export const cheapProvider = "openai"
54
55const argschema = z.object({

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 1 week ago

testOpenAI1 file match

@stevekrouse•Updated 1 week 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": "*",