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/image-url.jpg%20%22Optional%20title%22?q=openai&page=3&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 1586 results for "openai"(775ms)

openai_svg2 file matches

@stevekrouse•Updated 4 months ago

openai_structured_output_demo2 file matches

@arthrod•Updated 5 months ago

honoOpenai2 file matches

@wizos•Updated 5 months ago

openai_structured_output_demo2 file matches

@stevekrouse•Updated 6 months ago

openaiDefiner2 file matches

@willthereader•Updated 6 months ago

openai2 file matches

@std•Updated 6 months ago

OpenAIUsage2 file matches

@std•Updated 6 months ago

OpenAI2 file matches

@It_FITS_Marketing•Updated 7 months ago

openaiproxy2 file matches

@roadlabs•Updated 7 months ago

OpenAI2 file matches

@hash0000ff•Updated 8 months ago

stevensDemo.cursorrules4 matches

@lm3m•Updated 57 mins ago
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },

untitled-2512new-file-9861.tsx11 matches

@Get•Updated 1 hour ago
11 * and also to upload new resources.
12 * * It utilizes the LLM-Safe Fork of @std/sqlite (adjust import if necessary).
13 * Assumes 'openai' secret is set in Val Town environment variables.
14 * * Last Updated: 2025-05-08 (SQLite refactor, Glassmorphic UI, and Upload Form)
15 */
625export default async function(req: Request) {
626 // --- Dynamic Imports (Inside Handler for Val Town) ---
627 const { OpenAI } = await import("https://esm.town/v/std/openai");
628 const val_fetch = (await import("https://esm.town/v/std/fetch")).fetch;
629 const { PDFExtract } = await import("npm:pdf.js-extract");
653 }
654
655 // --- Helper Function: Call OpenAI API ---
656 async function callOpenAI(
657 openai: OpenAI,
658 systemPrompt: string,
659 userMessage: string,
662 ): Promise<{ role: "assistant" | "system"; content: string | object }> {
663 try {
664 const response = await openai.chat.completions.create({
665 model,
666 messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
680 return { role: "assistant", content };
681 } catch (error) {
682 console.error(`OpenAI call failed (ExpectJSON: ${expectJson}):`, error);
683 let msg = "Error communicating with AI.";
684 if (error.message) msg += ` Details: ${error.message}`;
685 if ((error as any).status === 401) msg = "OpenAI Auth Error. Check your 'openai' secret in Val Town.";
686 if ((error as any).status === 429) msg = "OpenAI Rate Limit Exceeded.";
687 return { role: "system", content: msg };
688 }
694 log: LogEntry[],
695 ): Promise<{ finalLog: LogEntry[]; extractedTagsCount: number; documentIdentifier: string | null }> {
696 const openai = new OpenAI();
697 log.push({ agent: "System", type: "step", message: "Workflow started." });
698
805 log.push({ agent: "System", type: "step", message: "Extracting searchable tags with LLM..." });
806 const tagAgent = "Autism Tag Extraction Agent";
807 const llmResponse = await callOpenAI(openai, autismTagExtractionSystemPrompt, textToAnalyze, "gpt-4o", true);
808
809 let extractedTags: string[] = [];
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": "*",