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=88&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 1619 results for "openai"(514ms)

byobREADME.md1 match

@mrshorts•Updated 4 months ago
11
12### Toolings
13* Llms can uses [tools](https://platform.openai.com/docs/guides/function-calling), meaning you can make this an agent and a whole lot more useful.
14
15

byobmain.tsx3 matches

@mrshorts•Updated 4 months ago
1import { zodResponseFormat } from "https://esm.sh/openai/helpers/zod";
2import { z } from "https://esm.sh/zod";
3import { email } from "https://esm.town/v/std/email";
4import { OpenAI } from "https://esm.town/v/std/openai";
5
6export default async function(e: Email) {
7 const client = new OpenAI();
8
9 const Messages = z.object({

spotlessMagentaSilverfishmain.tsx3 matches

@Pushpam•Updated 4 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: "Say hello in a creative way" },

pythonLearningAppmain.tsx9 matches

@mrshorts•Updated 4 months ago
173 console.log('Parsed topic:', topic);
174
175 // Dynamically import OpenAI with error handling
176 let OpenAI;
177 try {
178 const module = await import("https://esm.town/v/std/openai");
179 OpenAI = module.OpenAI;
180 } catch (importError) {
181 console.error('OpenAI import error:', importError);
182 return new Response(JSON.stringify({
183 error: `Failed to import OpenAI: ${importError.message}`
184 }), {
185 status: 500,
188 }
189
190 // Create OpenAI instance
191 const openai = new OpenAI();
192
193 // Generate explanation
194 const completion = await openai.chat.completions.create({
195 messages: [
196 {

zyloxAIChatAppmain.tsx4 matches

@gigmx•Updated 4 months ago
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4import OpenAI from "https://esm.sh/openai@4.28.4";
5
6function App() {
184export default async function server(request: Request): Promise<Response> {
185 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
186 const { OpenAI } = await import("https://esm.town/v/std/openai");
187 const openai = new OpenAI();
188
189 const { message, characterPrompt } = await request.json();
190
191 const stream = await openai.chat.completions.create({
192 model: "gpt-4o-mini",
193 messages: [

compassionateBlackCatfishmain.tsx3 matches

@gigmx•Updated 4 months ago
1import OpenAI from "https://esm.sh/openai@4.28.4";
2
3export default async function(req: Request): Promise<Response> {
309 try {
310 const LEPTON_API_TOKEN = Deno.env.get('LEPTON_API_TOKEN') || '';
311 const openai = new OpenAI({
312 apiKey: LEPTON_API_TOKEN,
313 baseURL: 'https://llama3-3-70b.lepton.run/api/v1/',
329 };
330
331 const response = await openai.chat.completions.create(apiConfig);
332
333 return new Response(JSON.stringify(response), {

openAIStreamingExamplemain.tsx3 matches

@peterqliu•Updated 4 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2export default async function(req: Request): Promise<Response> {
3 const openai = new OpenAI();
4 const stream = await openai.chat.completions.create({
5 stream: true,
6 messages: [{ role: "user", content: "Write a poem in the style of beowulf about the DMV" }],

generateFunctionmain.tsx3 matches

@wolf•Updated 4 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3function extractCode(str: string): string {
19 }
20
21 const openai = new OpenAI();
22 const prompt =
23 `Generate a TypeScript function named "${functionName}" with the following parameters: ${parameters}. ONLY RETURN VALID JAVASCRIPT DO NOT INCLUDE ANY CONTEXT.`;
24 const completion = await openai.chat.completions.create({
25 messages: [
26 {

laudableCrimsonCoyotemain.tsx4 matches

@slinfo•Updated 4 months ago
168 );
169
170 const { OpenAI } = await import("https://esm.town/v/std/openai");
171 const openai = new OpenAI();
172
173 try {
174 const imageAnalysis = await withTimeout(openai.chat.completions.create({
175 model: "gpt-4o",
176 messages: [
199 : '';
200
201 const story = await withTimeout(openai.chat.completions.create({
202 model: "gpt-4o-mini",
203 messages: [

Storyweavermain.tsx4 matches

@slinfo•Updated 4 months ago
168 );
169
170 const { OpenAI } = await import("https://esm.town/v/std/openai");
171 const openai = new OpenAI();
172
173 try {
174 const imageAnalysis = await withTimeout(openai.chat.completions.create({
175 model: "gpt-4o",
176 messages: [
199 : '';
200
201 const story = await withTimeout(openai.chat.completions.create({
202 model: "gpt-4o-mini",
203 messages: [

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 4 days ago

testOpenAI1 file match

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