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/$1?q=openai&page=25&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 2123 results for "openai"(643ms)

Townie.cursorrules4 matches

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

stevensDemo.cursorrules4 matches

@yanisurbis•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

@joma•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

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

Towniesystem_prompt.txt4 matches

@cangbenlai•Updated 1 week ago
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
89
90### OpenAI
91
92```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96 messages: [
97 { role: "user", content: "Say hello in a creative way" },

Townie.cursorrules4 matches

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

mechmain.tsx13 matches

@join•Updated 1 week ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { z } from "npm:zod";
4
534}
535
536async function callOpenAI(sysP: string, userP: string, mid: string, tid: string, log: LogFn): Promise<string | null> {
537 log("DB", "OpenAI", `Call tid=${tid}`, { sL: sysP.length, uL: userP.length }, mid, tid);
538 try { // @ts-ignore
539 const oai = new OpenAI();
540 const comp = await oai.chat.completions.create({
541 model: "gpt-4o-mini",
547 const usg = comp.usage;
548 if (!resT) {
549 log("WN", "OpenAI", `No text tid=${tid}.`, { usg, fin: comp.choices[0]?.finish_reason }, mid, tid);
550 return null;
551 }
552 log("IN", "OpenAI", `OK tid=${tid}`, { rL: resT.length, usg, fin: comp.choices[0]?.finish_reason }, mid, tid);
553 return resT.trim();
554 } catch (err: any) {
562 st: err.status,
563 };
564 log("ER", "OpenAI", `Fail tid=${tid}:${err.message}`, { e: eD }, mid, tid);
565 throw new Error(
566 `OpenAI API Call Failed: ${err.message}`
567 + (err.code ? ` (Code:${err.code}, Status:${err.status})` : (err.status ? ` (Status:${err.status})` : "")),
568 );
867 }
868 const filledUserPrompt = Utils.fillPromptTemplate(userPrompt, params);
869 const rawOpenAIResponse = await callOpenAI(systemPrompt, filledUserPrompt, mid, tid, logFn);
870 if (!rawOpenAIResponse) {
871 logFn("WN", agentConfig.name, `OpenAI call returned no content, tid=${tid}.`, {}, mid, tid);
872 return { mid, cid: tid, p: {} as TOD, e: `${agentConfig.name} Error: AI returned no content.` };
873 }
874 let outputData: TOD;
875 try {
876 outputData = agentConfig.outputParser(rawOpenAIResponse);
877 }
878 catch (parseError: any) {
881 agentConfig.name,
882 `Output parsing failed, tid=${tid}. M: ${parseError.message}`,
883 { rawResponsePreview: rawOpenAIResponse.slice(0, 500) },
884 mid,
885 tid,

MYHEALTHSOURCEREADME.md1 match

@SIR_FESTUS•Updated 1 week ago
99## Environment Variables
100
101- `OPENAI_API_KEY` - Required for AI chatbot functionality (automatically configured in Val Town)
102- No other API keys required - uses open health data sources and local storage

MYHEALTHSOURCEchatbot.ts4 matches

@SIR_FESTUS•Updated 1 week ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { email } from "https://esm.town/v/std/email";
4import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
7const chatbot = new Hono();
8
9// Initialize OpenAI
10const openai = new OpenAI();
11
12// System prompt for the health assistant
52
53 // Get AI response
54 const completion = await openai.chat.completions.create({
55 model: "gpt-4o-mini",
56 messages: [

Glancer-backup-as-of-5-31.cursorrules4 matches

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

openai-client1 file match

@cricks_unmixed4u•Updated 2 days ago

openai_enrichment6 file matches

@stevekrouse•Updated 3 days ago
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai"; import { sqlite } from "https://esm.town/v/stevekrouse/sqlite"; /** * Practical Implementation of Collective Content Intelligence * Bridging advanced AI with collaborative content creation */ exp
kwhinnery_openai