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?q=openai&page=14&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 1581 results for "openai"(1179ms)

valreadmegeneratormain.tsx3 matches

@dcm31Updated 1 week ago
177 }
178
179 const { OpenAI } = await import("https://esm.town/v/std/openai");
180 const openai = new OpenAI();
181
182 const valTownClient = new ValTown({
197
198 try {
199 const completion = await openai.chat.completions.create({
200 model: "gpt-4o",
201 messages: [

valreadmegeneratorREADME.md1 match

@dcm31Updated 1 week ago
43- **Deno:** The server-side environment.
44- **ValTown SDK:** Integrated to fetch Val details.
45- **OpenAI GPT-4:** To generate natural language README content.
46- **JavaScript Modules (ESM):** For seamless module imports.
47

stevensDemo.cursorrules4 matches

@sajtosmUpdated 1 week 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" },

stevensDemo.cursorrules4 matches

@arawlinsUpdated 1 week 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" },

Futuremain.tsx12 matches

@salonUpdated 1 week ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import * as ta from "npm:technicalindicators";
362}
363
364async function callOpenAI(
365 systemPrompt: string,
366 userMessage: string,
372): Promise<{ role: "assistant" | "system"; content: string }> {
373 const callId = Math.random().toString(36).substring(2, 8);
374 const logPfx = `OpenAI Call [${agentName} ${taskId.split("-")[1] || taskId} ${callId}]`;
375 try {
376  log("DEBUG", agentName, `${logPfx}: Initiating (${model}, JSON: ${isJsonOutputRequired})...`);
377  const openai = new OpenAI();
378  const res = await openai.chat.completions.create({
379   model,
380   messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
384  const content = res.choices?.[0]?.message?.content;
385  if (!content) {
386   log("ERROR", agentName, `${logPfx}: OpenAI returned empty/invalid response.`);
387   throw new Error("Invalid/empty AI response.");
388  }
394  let code = err.status || (err.response ? err.response.status : null);
395  const errData = err.response?.data || err.error || err.response || err;
396  if (errData?.message) { errMsg = `OpenAI Err (${code || "?"}) via ${agentName}: ${errData.message}`; }
397  else if (errData?.error?.message) { errMsg = `OpenAI Err (${code || "?"}) via ${agentName}: ${errData.error.message}`; }
398  else if (err.message) { errMsg += ` Details: ${err.message}`; }
399  else { try { errMsg += ` Unknown err: ${JSON.stringify(errData)}`; } catch { errMsg += " Unknown non-serializable err."; }}
402  else if (code === 400) errMsg += " (ACTION: Bad request/prompt issue)";
403  else if (err.code === "ENOTFOUND" || err.code === "ECONNREFUSED" || err.cause?.code === "UND_ERR_CONNECT_TIMEOUT") errMsg += " (ACTION: Network error)";
404  else if (code >= 500) errMsg += " (ACTION: OpenAI server issue)";
405  const escapedErr = errMsg.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n");
406  if (isJsonOutputRequired) {
659 const taskId = task.taskId;
660 log("INFO", agentName, `Task ${taskId}. Processing goals. Hash: ${hashCode(JSON.stringify(task.payload))}`);
661 const result = await callOpenAI(
662  tickerSuggestionAgentSystemPrompt,
663  JSON.stringify(task.payload),
999  },
1000 });
1001 const result = await callOpenAI(
1002  tickerInterpretationAgentSystemPrompt,
1003  input,
1111  pastPerformanceContext: pastPerformanceContext ?? "N/A",
1112 });
1113 const result = await callOpenAI(
1114  synthesisChartingDataAgentSystemPrompt,
1115  input,

stevensDemo.cursorrules4 matches

@satcarUpdated 1 week 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" },

stevensDemo.cursorrules4 matches

@ziipoUpdated 1 week 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" },

stevensDemo.cursorrules4 matches

@BrandonSmithUpdated 1 week 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" },

stevensDemo.cursorrules4 matches

@macbookandrewUpdated 1 week 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" },

stevensDemo.cursorrules4 matches

@tnorthcuttUpdated 1 week 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" },

testOpenAI1 file match

@stevekrouseUpdated 1 day ago

testOpenAI1 file match

@shouserUpdated 3 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": "*",