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/$%7Bart_info.art.src%7D?q=openai&page=71&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 1629 results for "openai"(518ms)

resumeAnalyzerHTTPmain.tsx3 matches

@azeem_rizvi72•Updated 2 months ago
184export default async function server(request: Request): Promise<Response> {
185 if (request.method === 'POST') {
186 const { OpenAI } = await import("https://esm.town/v/std/openai");
187 const openai = new OpenAI();
188
189 const formData = await request.formData();
196 const resumeText = await resumeFile.text();
197
198 const completion = await openai.chat.completions.create({
199 messages: [
200 {

researchAgentemailHandler2 matches

@charmainetest•Updated 2 months ago
2import process from "node:process";
3import { marked } from "npm:marked";
4import { OpenAI } from "npm:openai";
5
6function emailValHandlerExtra(inboundEmail: Email) {
33 );
34
35 const client = new OpenAI({ apiKey: process.env.PERPLEXITY_API_KEY, baseURL: "https://api.perplexity.ai" });
36 const response = await client.chat.completions.create({
37 model: "sonar",

test_projectindex.ts1 match

@charmainetest•Updated 2 months ago
2import { parseProject } from "https://esm.town/v/std/parseImportMeta/project";
3import { contentType } from "npm:mime-types@2.1.35";
4import openAI from "npm:openai";
5
6console.log("will this show up");

test_projectmain.js3 matches

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

researchAgentemailHandler2 matches

@charmaine•Updated 2 months 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",

researchAgentemailHandler2 matches

@thesephist•Updated 2 months 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",

GeminiVoiceCallAppmain.tsx3 matches

@srijanb69•Updated 2 months ago
148export default async function server(request: Request): Promise<Response> {
149 if (request.method === 'POST' && new URL(request.url).pathname === '/ai-response') {
150 const { OpenAI } = await import("https://esm.town/v/std/openai");
151 const openai = new OpenAI();
152
153 const body = await request.json();
154 const conversationHistory = body.conversation || [];
155
156 const completion = await openai.chat.completions.create({
157 messages: [
158 {

OpenAImain.tsx10 matches

@wangqiao1234•Updated 2 months ago
1import { type ClientOptions, OpenAI as RawOpenAI } from "npm:openai";
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
7 private rawOpenAIClient: RawOpenAI;
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
28
29 get chat() {
30 return this.rawOpenAIClient.chat;
31 }
32
33 readonly beta = {
34 get chat(): RawOpenAI["beta"]["chat"] {
35 return this.rawOpenAIClient.beta.chat;
36 },
37 };

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",

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 5 days 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": "*",