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=31&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 346 results for "openai"(334ms)

researchAgentemailHandler2 matches

@kamalnrf•Updated 1 month ago
2import process from "node:process";
3import { marked } from "npm:marked";
4import { OpenAI } from "npm:openai";
5
6function pm(...lines: string[]): string {
16 );
17
18 const client = new OpenAI({ apiKey: process.env.PERPLEXITY_API_KEY, baseURL: "https://api.perplexity.ai" });
19 const response = await client.chat.completions.create({
20 model: "sonar",

research_agenttest.ts2 matches

@stevekrouse•Updated 1 month ago
1import { openai } from 'npm:@ai-sdk/openai';
2import { generateText, tool } from 'npm:ai';
3import * as mathjs from 'npm:mathjs';
5
6const response = await generateText({
7 model: openai('gpt-4o-2024-08-06', { structuredOutputs: true }),
8 tools: {
9 calculate: tool({

HTTP101HTTPguide1 match

@willthereader•Updated 1 month ago
178 <h4>API</h4>
179 <p>An API (Application Programming Interface) is a set of rules and protocols designed to make it easy
180 to communicate. For example OpenAI has an API designed to make it easy for ChatGPT to communicate with
181 many different kinds of softwares. It's very common for front ends to call APIs. You don't literally
182 call an API, you call it's endpoints. There are disadvantages to calling an API like the fact you're

researchAgentemailHandler2 matches

@saif•Updated 1 month ago
2import process from "node:process";
3import { marked } from "npm:marked";
4import { OpenAI } from "npm:openai";
5
6function pm(...lines: string[]): string {
16 );
17
18 const client = new OpenAI({ apiKey: process.env.PERPLEXITY_API_KEY, baseURL: "https://api.perplexity.ai" });
19 const response = await client.chat.completions.create({
20 model: "sonar",

RecipeCollectorRC-Parse-Recipe3 matches

@hunterparks•Updated 1 month ago
1import { OpenAI } from 'https://esm.town/v/std/openai';
2
3const devPrompt = 'You are a recipe parsing bot. You will be given a URL to a recipe. You will provide a JSON reponse. ONLY use data available from the provided URL. Do not add extra information to the JSON. Only respond with the properly formatted JSON.';
4
5export async function parseRecipe(recipeUrl: string): any {
6 const openAi = new OpenAI();
7
8 const completion = await openAi.chat.completions.create({
9 messages: [
10 { role: 'developer', content: devPrompt },

test_projectmain.js3 matches

@charmaine•Updated 1 month ago
1import { blob } from "https://esm.town/v/std/blob";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, servePublicFile } from "https://esm.town/v/stevekrouse/utils@187-main/serve-public/index.ts";
4import Algebrite from "npm:algebrite";
138 */
139async function handleProblemGeneration() {
140 const openai = new OpenAI();
141 const completion = await openai.chat.completions.create({
142 model: "gpt-4",
143 messages: [

Prompt_Improverorchestrator3 matches

@toowired•Updated 1 month ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3const openai = new OpenAI();
4const TIMEOUT_MS = 30000; // 30 second timeout
5
33 // Create API call promises with timeouts
34 const workerPromises = workerConfigs.map(config => {
35 const apiPromise = openai.chat.completions.create({
36 model: "gpt-4o-mini",
37 max_tokens: 500,

Prompt_ImproverPrompt_Improver3 matches

@toowired•Updated 1 month ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { ValTown } from "https://esm.town/v/stevekrouse/valtown";
3
4const openai = new OpenAI();
5const vt = new ValTown();
6const MAX_STEPS = 10;
34 }
35
36 const final = await openai.chat.completions.create({
37 model: "gpt-4o-mini",
38 max_tokens: 1000,

researchAgentemailHandler2 matches

@wasauce•Updated 1 month ago
2import process from "node:process";
3import { marked } from "npm:marked";
4import { OpenAI } from "npm:openai";
5
6function pm(...lines: string[]): string {
16 );
17
18 const client = new OpenAI({ apiKey: process.env.PERPLEXITY_API_KEY, baseURL: "https://api.perplexity.ai" });
19 const response = await client.chat.completions.create({
20 model: "sonar",

cakeOffReviewPlatformqueries.ts9 matches

@charmaine•Updated 1 month ago
35 }
36
37 // Prepare the data for OpenAI
38 const reviewData = reviews.map(review => ({
39 reviewer: review.name,
42 }));
43
44 // Format the prompt for OpenAI
45 const prompt = `
46 You are judging a cake competition. Based on the following reviews of two cakes,
57
58 try {
59 // Make the API call to OpenAI
60 const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");
61
62 const response = await fetch("https://api.openai.com/v1/chat/completions", {
63 method: "POST",
64 headers: {
65 "Content-Type": "application/json",
66 "Authorization": `Bearer ${OPENAI_API_KEY}`,
67 },
68 body: JSON.stringify({
85 if (!response.ok) {
86 const errorData = await response.json();
87 console.error("OpenAI API error:", errorData);
88 throw new Error(`OpenAI API error: ${errorData.error?.message || "Unknown error"}`);
89 }
90
92 return data.choices[0].message.content.trim();
93 } catch (error) {
94 console.error("Error analyzing reviews with OpenAI:", error);
95 }
96}

stevens-openai5 file matches

@yash_ing•Updated 1 day ago

openaiPricing9 file matches

@nbbaier•Updated 1 week ago
Project created from val URLs