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%20%22Image%20title%22?q=openai&page=78&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 1691 results for "openai"(1504ms)

promptScorermain.tsx5 matches

@toowired•Updated 2 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export async function promptScorer({
8 evolved: string;
9}) {
10 const openai = new OpenAI();
11
12 const scoringPrompt =
29
30 try {
31 const completion = await openai.chat.completions.create({
32 model: "gpt-4o",
33 messages: [
49 return { score: isNaN(score) || score < 0 || score > 10 ? 5 : score }; // Default to 5 if parsing fails or score is out of range
50 } catch (error) {
51 console.error("Error calling OpenAI API:", error);
52 return { score: 5, error: "Failed to get score from OpenAI" };
53 }
54}

emojisearchindex4 matches

@maxm•Updated 2 months ago
13console.log(emojisWithInfo);
14
15import { OpenAI } from "npm:openai";
16
17// Initialize OpenAI client
18const openai = new OpenAI();
19
20async function getEmbedding(emoji: string): Promise<number[]> {
21 const result = await openai.embeddings.create({
22 input: emoji,
23 model: "text-embedding-3-small",

mathOfTheDayaccomplishedOrangePenguin3 matches

@charmaine•Updated 2 months ago
189
190export default async function server(request) {
191 const { OpenAI } = await import("https://esm.town/v/std/openai");
192 const { blob } = await import("https://esm.town/v/std/blob");
193 const url = new URL(request.url);
194
195 if (url.pathname === "/problem") {
196 const openai = new OpenAI();
197 const completion = await openai.chat.completions.create({
198 model: "gpt-4",
199 messages: [

chatAgentWithCustomPromptmain.tsx3 matches

@mjoshimanhar•Updated 2 months ago
1import { initializeAgentExecutorWithOptions } from "https://esm.sh/langchain/agents";
2import { ChatOpenAI } from "https://esm.sh/langchain/chat_models/openai";
3import { Calculator } from "https://esm.sh/langchain/tools/calculator";
4import { OpenAI } from "https://esm.town/v/std/openai";
5
6export default async function chatAgentWithCustomPrompt(input?: string) {
7 const model = new ChatOpenAI({
8 temperature: 0,
9 });

diverseAmberReindeerREADME.md1 match

@melissanf•Updated 2 months ago
25## **Tech Stack**
26- **Townie AI** – AI-based automation
27- **OpenAI API** – For generating blog content
28- **Built-in Databases** – To store and retrieve topics (if needed)
29

blogIdeaGeneratorAppmain.tsx4 matches

@melissanf•Updated 2 months ago
276 // Handle API and shared content routes
277 if (request.method === "POST") {
278 const { OpenAI } = await import("https://esm.town/v/std/openai");
279 const { blob } = await import("https://esm.town/v/std/blob");
280 const openai = new OpenAI();
281
282 const { topic, idea, type } = await request.json();
293 let response;
294 if (type === "ideas") {
295 response = await openai.chat.completions.create({
296 messages: [
297 {
317 });
318 } else if (type === "outline") {
319 response = await openai.chat.completions.create({
320 messages: [
321 {

blogIdeaGeneratorAppREADME.md1 match

@melissanf•Updated 2 months ago
15### Tech Stack
16* Townie AI – AI-based automation
17* OpenAI API – For generating blog content
18* Built-in Databases – To store and retrieve topics (if needed)
19* How to Deploy & Share

productiveIndigoJayREADME.md1 match

@melissanf•Updated 2 months ago
25## **Tech Stack**
26- **Townie AI** – AI-based automation
27- **OpenAI API** – For generating blog content
28- **Built-in Databases** – To store and retrieve topics (if needed)
29

shoppingPlatformAImain.tsx3 matches

@Priyansh•Updated 2 months ago
59 async function generateAIRecommendations() {
60 try {
61 const { OpenAI } = await import("https://esm.town/v/std/openai");
62 const openai = new OpenAI();
63
64 const recommendations = await openai.chat.completions.create({
65 messages: [
66 {

priyanshCartoonAppmain.tsx4 matches

@Priyansh•Updated 2 months ago
71 async function generateAIDescription() {
72 try {
73 const { OpenAI } = await import("https://esm.town/v/std/openai");
74 const openai = new OpenAI();
75
76 const aiVideoCompletion = await openai.chat.completions.create({
77 messages: [
78 {
85 });
86
87 const aiDescription = await openai.chat.completions.create({
88 messages: [
89 {

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 1 week ago

testOpenAI1 file match

@stevekrouse•Updated 1 week 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": "*",