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=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 1576 results for "openai"(1200ms)

stevensDemo.cursorrules4 matches

@satcar•Updated 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

@ziipo•Updated 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

@BrandonSmith•Updated 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

@macbookandrew•Updated 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

@tnorthcutt•Updated 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.tsx13 matches

@Get•Updated 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";
237}
238
239// --- OpenAI Call Function ---
240async function callOpenAI(
241 systemPrompt: string,
242 userMessage: string,
248): Promise<{ role: "assistant" | "system"; content: string }> {
249 const callId = Math.random().toString(36).substring(2, 8);
250 const logPfx = `OpenAI Call [${agentName} ${taskId.split("-")[1] || taskId} ${callId}]`;
251 try {
252 log("DEBUG", agentName, `${logPfx}: Initiating (${model}, JSON: ${isJsonOutputRequired})...`);
253 const openai = new OpenAI();
254 const res = await openai.chat.completions.create({
255 model,
256 messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
260 const content = res.choices?.[0]?.message?.content;
261 if (!content) {
262 log("ERROR", agentName, `${logPfx}: OpenAI returned empty/invalid response.`);
263 throw new Error("Invalid/empty AI response.");
264 }
270 let code = err.status || (err.response ? err.response.status : null);
271 const errData = err.response?.data || err.error || err.response || err;
272 if (errData?.message) { errMsg = `OpenAI Err (${code || "?"}) via ${agentName}: ${errData.message}`; }
273 else if (errData?.error?.message) {
274 errMsg = `OpenAI Err (${code || "?"}) via ${agentName}: ${errData.error.message}`;
275 }
276 else if (err.message) { errMsg += ` Details: ${err.message}`; }
285 " (ACTION: Bad request/prompt issue)"; else if (
286 err.code === "ENOTFOUND" || err.code === "ECONNREFUSED" || err.cause?.code === "UND_ERR_CONNECT_TIMEOUT"
287 ) errMsg += " (ACTION: Network error)"; else if (code >= 500) errMsg += " (ACTION: OpenAI server issue)";
288 const escapedErr = errMsg.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n");
289 if (isJsonOutputRequired) {
595 const taskId = task.taskId;
596 log("INFO", agentName, `Task ${taskId}. Goals hash: ${hashCode(JSON.stringify(task.payload))}`);
597 const result = await callOpenAI(
598 tickerSuggestionAgentSystemPrompt,
599 JSON.stringify(task.payload),
938 context: { newsSentiment: context?.newsSentiment?.[ticker] ?? "N/A" },
939 });
940 const result = await callOpenAI(
941 tickerInterpretationAgentSystemPrompt,
942 input,
1054 pastPerformanceContext: pastPerformanceContext ?? "N/A",
1055 });
1056 const result = await callOpenAI(
1057 synthesisChartingDataAgentSystemPrompt,
1058 input,

vt-blog-1get-old-posts.ts5 matches

@charmaine•Updated 1 week ago
198 },
199 {
200 "title": "An Introduction to OpenAI fine-tuning",
201 "slug": "an-introduction-to-openai-fine-tuning",
202 "link": "/blog/an-introduction-to-openai-fine-tuning",
203 "description": "How to customize OpenAI to your liking",
204 "pubDate": "Fri, 25 Aug 2023 00:00:00 GMT",
205 "author": "Steve Krouse",
417 "slug": "val-town-newsletter-16",
418 "link": "/blog/val-town-newsletter-16",
419 "description": "Our seed round, growing team, Codeium completions, @std/openai, and more",
420 "pubDate": "Mon, 22 Apr 2024 00:00:00 GMT",
421 "author": "Steve Krouse",

stevensDemo.cursorrules4 matches

@stasistrap•Updated 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

@fredah•Updated 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" },

vt-blogget-old-posts.ts5 matches

@charmaine•Updated 1 week ago
198 },
199 {
200 "title": "An Introduction to OpenAI fine-tuning",
201 "slug": "an-introduction-to-openai-fine-tuning",
202 "link": "/blog/an-introduction-to-openai-fine-tuning",
203 "description": "How to customize OpenAI to your liking",
204 "pubDate": "Fri, 25 Aug 2023 00:00:00 GMT",
205 "author": "Steve Krouse",
417 "slug": "val-town-newsletter-16",
418 "link": "/blog/val-town-newsletter-16",
419 "description": "Our seed round, growing team, Codeium completions, @std/openai, and more",
420 "pubDate": "Mon, 22 Apr 2024 00:00:00 GMT",
421 "author": "Steve Krouse",

testOpenAI1 file match

@stevekrouse•Updated 19 hours ago

testOpenAI1 file match

@shouser•Updated 2 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": "*",