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/...?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 2221 results for "openai"(3027ms)

Plantfo

Plantfoindex.ts8 matches

@Llad•Updated 1 day ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile } from "https://esm.town/v/std/utils/index.ts";
4import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
20});
21
22// Initialize OpenAI
23const openai = new OpenAI();
24
25// Initialize cache on startup with error handling
87 }
88
89 console.log(`Fetching fresh data from OpenAI for: "${plantName}"`);
90 // If not cached, fetch from OpenAI
91 const prompt = `Please provide detailed information about the plant "${plantName}" in the following JSON format. Be specific and accurate:
92
104Only return the JSON object, no additional text.`;
105
106 const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: prompt }
116
117 if (!responseText) {
118 return c.json({ error: "No response from OpenAI" }, 500);
119 }
120
128 }
129
130 // Parse the JSON response from OpenAI
131 const plantInfo: PlantInfo = JSON.parse(cleanedResponse);
132

Towniesystem_prompt.txt4 matches

@bipin0005•Updated 2 days 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

@bipin0005•Updated 2 days 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" },

untitled-9078main.tsx1 match

@navya_k•Updated 2 days ago
63Backend & Flask (Python) \\
64Database & MongoDB / Firebase \\
65NLP API & OpenAI GPT \\
66Styling & TailwindCSS / Bootstrap \\
67\hline

autonomous-valREADME.md1 match

@nbbaier•Updated 2 days 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

@nbbaier•Updated 2 days 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 = {

LeaseLensmain.tsx4 matches

@svc•Updated 2 days ago
839
840export default async function(req: Request) {
841 const { OpenAI } = await import("https://esm.town/v/std/openai");
842 const { PDFExtract } = await import("npm:pdf.js-extract");
843
853 const action = url.searchParams.get("action");
854 const sourceUrl = import.meta.url.replace("esm.town", "val.town");
855 const openai = new OpenAI();
856 const MAX_TEXT_SUGGEST = 20000;
857 const MAX_TEXT_ANALYZE = 30000;
882 agentName: string,
883 ): Promise<object> {
884 log.push({ agent: agentName, type: "step", message: `Calling OpenAI gpt-4o...` });
885 try {
886 const response = await openai.chat.completions.create({
887 model: "gpt-4o",
888 messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
6 */
7
8import { OpenAI } from "https://esm.town/v/std/openai";
9import { Octokit } from "https://esm.sh/@octokit/rest@20.0.2";
10import { WebClient } from "https://esm.sh/@slack/web-api@7.0.2";
129async function isBugReportLLM(text: string): Promise<boolean> {
130 try {
131 // Check if OpenAI API key is available
132 if (!Deno.env.get("OPENAI_API_KEY")) {
133 console.warn("OpenAI API key not found - bug detection disabled");
134 return false;
135 }
136
137 const openai = new OpenAI();
138 const completion = await openai.chat.completions.create({
139 messages: [
140 {
249async function findRelatedIssues(slackMessage: string, issues: any[]): Promise<any[]> {
250 try {
251 // Check if OpenAI API key is available
252 if (!Deno.env.get("OPENAI_API_KEY")) {
253 return [];
254 }
271 }).join("\n\n");
272
273 const openai = new OpenAI();
274 const completion = await openai.chat.completions.create({
275 messages: [
276 {

GitHub-PR-Automation-akiREADME.md2 matches

@akj•Updated 2 days ago
119
1201. When a new message is posted in a configured Slack channel (ie. #bugs, or #support), Slack sends an event to this Val
1212. The val makes an OpenAI call to determine if the message is a bug
1223. If it is, then it searches GitHub for semantically related open issues with a separate OpenAI call
1234. It posts a comment in the Slack thread with links to related GitHub issues, with a "Relevance Score"
124
6 */
7
8import { OpenAI } from "https://esm.town/v/std/openai";
9import { Octokit } from "https://esm.sh/@octokit/rest@20.0.2";
10import { WebClient } from "https://esm.sh/@slack/web-api@7.0.2";
129async function isBugReportLLM(text: string): Promise<boolean> {
130 try {
131 // Check if OpenAI API key is available
132 if (!Deno.env.get("OPENAI_API_KEY")) {
133 console.warn("OpenAI API key not found - bug detection disabled");
134 return false;
135 }
136
137 const openai = new OpenAI();
138 const completion = await openai.chat.completions.create({
139 messages: [
140 {
249async function findRelatedIssues(slackMessage: string, issues: any[]): Promise<any[]> {
250 try {
251 // Check if OpenAI API key is available
252 if (!Deno.env.get("OPENAI_API_KEY")) {
253 return [];
254 }
271 }).join("\n\n");
272
273 const openai = new OpenAI();
274 const completion = await openai.chat.completions.create({
275 messages: [
276 {

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