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/$2?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 2237 results for "openai"(2849ms)

Change-Logs-Generator

Change-Logs-Generatorprocess-commits.tsx3 matches

@charmaine•Updated 1 week ago
5import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
6import { Octokit } from "npm:octokit";
7import { OpenAI } from "https://esm.town/v/std/openai";
8
9// Environment variables, set them in the left sidebar
25 */
26async function generateUserFocusedSummary(fullCommitMessage: string, commitType: string): Promise<string> {
27 const openai = new OpenAI();
28
29 const prompt = `You are writing release notes for a developer tool. Based on this commit message, write a concise one-liner.
51
52 try {
53 const completion = await openai.chat.completions.create({
54 messages: [{ role: "user", content: prompt }],
55 model: "gpt-4o-mini",

Townie-09system_prompt.txt4 matches

@jxnblk•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-09.cursorrules4 matches

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

autonomous-valREADME.md1 match

@charmaine•Updated 1 week ago
9Configure the following variables in your environment:
10- `AGENT_API_KEY` (This is a secure token that you choose to secure the agent.tsx POST endpoint)
11- `OPENAI_API_KEY` (An OpenAI API Key)
12- `EXA_API_KEY` (Optional, though needed if you use the web search tool)
13

autonomous-valagent.tsx2 matches

@charmaine•Updated 1 week ago
1import { anthropic } from "npm:@ai-sdk/anthropic";
2import { openai } from "npm:@ai-sdk/openai";
3import { generateText, streamText } from "npm:ai";
4import { getSystemPrompt } from "./prompt.tsx";
34 const maxSteps = 10;
35
36 const model = Deno.env.get("ANTHROPIC_API_KEY") ? anthropic("claude-3-7-sonnet-latest") : openai("gpt-4.1");
37
38 const options = {

markdown-embed.cursorrules4 matches

@stevekrouse•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-clientmain.tsx9 matches

@cricks_unmixed4u•Updated 1 week ago
1import { OpenAI } from "https://esm.sh/openai@4.85.1";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
7};
8
9interface ChatOpenAI {
10 invoke(messages: Message[]): Promise<string>;
11}
12
13export function ChatOpenAI(model: string): ChatOpenAI {
14 const openai = new OpenAI();
15
16 return {
17 invoke: async (messages: Message[]): Promise<string> => {
18 const completion = await openai.chat.completions.create({
19 messages: messages.map(message => ({
20 role: message.role as "user" | "assistant" | "system",
29}
30
31// Decorator for ChatOpenAI that will eventually add rate limiting
32export function GlobalRateLimitedChatOpenAI(model: string, requestsPerSecond: number): ChatOpenAI {
33 const openAi = ChatOpenAI(model);
34
35 const rateLimiter = new GlobalRateLimiter(requestsPerSecond);
39 await rateLimiter.check();
40
41 return openAi.invoke(messages);
42 },
43 };

stevensDemo.cursorrules4 matches

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

thirdTimerval-town.mdc4 matches

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

realtymain.tsx10 matches

@legal•Updated 1 week ago
953// --- Main Request Handler (Server Code - MODIFIED) ---
954export default async function(req: Request) {
955 const { OpenAI } = await import("https://esm.town/v/std/openai");
956 const { fetch } = await import("https://esm.town/v/std/fetch");
957 // PDFExtract is kept if you want to add document features later, but not primary for this use case.
965 const action = url.searchParams.get("action"); // New: "loanAssumptionInfo"
966 const sourceUrl = import.meta.url.replace("esm.town", "val.town");
967 const openai = new OpenAI();
968 const MAX_TEXT_LENGTH_ANALYSIS = 10000; // Reduced as input is smaller now
969
992 }
993
994 // callOpenAI function (same as original, but uses gpt-4o by default)
995 async function callOpenAI(
996 openaiInstance: OpenAI,
997 systemPrompt: string,
998 userMessage: string, // For this app, userMessage to AI might be empty if all info is in systemPrompt
1003 ): Promise<object | string> {
1004 // ... (implementation from original)
1005 log.push({ agent: agentName, type: "step", message: `Calling OpenAI model ${model}...` });
1006 try {
1007 const response = await openaiInstance.chat.completions.create({
1008 model: model,
1009 messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
1124 .replace("%%USER_NAME%%", analysisInput.userName);
1125 // The %%INPUT_SOURCE_DESCRIPTION%% and %%LEGAL_TASK_QUERY%% are not in the new prompt in this direct way.
1126 // The userMessage to openAI can be kept minimal or empty as the system prompt is rich.
1127 const userMessageForAI = ""; // Or analysisInput.documentText if you want to provide more context there.
1128
1129 const analysisAgentName = "HomeAdvantage AI";
1130 const aiResponse = await callOpenAI(
1131 openai,
1132 finalSystemPrompt,
1133 userMessageForAI,

openai-client1 file match

@cricks_unmixed4u•Updated 1 week ago

openai_enrichment6 file matches

@stevekrouse•Updated 1 week ago
kwhinnery_openai
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