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?q=openai&page=126&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 1604 results for "openai"(765ms)

semanticSearchREADME.md1 match

@yawnxyz•Updated 11 months ago
1In-memory semantic search; load it up with valtown KV.
2
3This is a "dumb" version of vector search, for prototyping RAG responses and UIs — with both regular search (w/ Lunr) and vector search (with OpenAI embeddings + cosine similarity)
4
5Usage:

embeddingsSearchExampleREADME.md1 match

@yawnxyz•Updated 11 months ago
1This is an example of in-memory search, using a combination of lunr, OpenAI embeddings, and cosine similarity
2
3Migrated from folder: Libraries/SemanticSearch/embeddingsSearchExample

nighthawksmain.tsx2 matches

@yawnxyz•Updated 11 months ago
57 const characterModel = new ModelProvider({
58 id: `${characterName}`,
59 // for web search / tool use, use openai
60 provider: 'openai',
61 model: 'gpt-4o',
62

booksmain.tsx3 matches

@laidlaw•Updated 11 months ago
3import { modifyImage } from "https://esm.town/v/stevekrouse/modifyImage";
4import { Hono } from "npm:hono@3";
5import { OpenAI } from "npm:openai";
6
7const openai = new OpenAI();
8
9function esmTown(url) {
95 const dataURL = await fileToDataURL(file);
96 try {
97 const response = await openai.chat.completions.create({
98 messages: [
99 {

key_safe_linkREADME.md2 matches

@stevekrouse•Updated 11 months ago
6
7```
8<a href="https://www.val.town/settings/environment-variables?name=OpenAI&value=sk-123...">
9 Add OpenAI key to Val Town
10</a>
11```

weatherGPTmain.tsx4 matches

@jcoleman•Updated 11 months ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { OpenAI } from "npm:openai";
3import { createHeaders, PORTKEY_GATEWAY_URL } from "npm:portkey-ai";
4
9).then(r => r.json());
10
11const openai = new OpenAI({
12 baseURL: PORTKEY_GATEWAY_URL,
13 defaultHeaders: createHeaders({
14 apiKey: Deno.env.get("PORTKEY_API_KEY"),
15 virtualKey: Deno.env.get("PORTKEY_OPENAI_VIRTUAL_KEY"),
16 }),
17});
18let chatCompletion = await openai.chat.completions.create({
19 messages: [{
20 role: "user",

aiImageExamplemain.tsx2 matches

@yawnxyz•Updated 11 months ago
2import { z } from "npm:zod";
3
4// Function to handle image and text input using OpenAI's GPT-4-turbo
5async function handleImageChat() {
6 const initialMessages = [
13 const response = await modelProvider.gen({
14 model: "gpt-4-turbo",
15 provider: "openai",
16 messages: [
17 ...initialMessages,

gpt4o_imagesmain.tsx3 matches

@jdan•Updated 11 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3const openai = new OpenAI();
4const completion = await openai.chat.completions.create({
5 "messages": [
6 {

weatherGPTmain.tsx3 matches

@developersdigest•Updated 11 months ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { OpenAI } from "npm:openai";
3
4let location = "toronto on";
8).then(r => r.json());
9
10const openai = new OpenAI();
11let chatCompletion = await openai.chat.completions.create({
12 messages: [{
13 role: "user",

semanticSearchBlobsmain.tsx3 matches

@janpaul123•Updated 11 months ago
6import cosSimilarity from "npm:cos-similarity";
7import _ from "npm:lodash";
8import OpenAI from "npm:openai";
9
10const dimensions = 1536;
27 await Promise.all(allBatchDataIndexesPromises);
28
29 const openai = new OpenAI();
30 const queryEmbedding = (await openai.embeddings.create({
31 model: "text-embedding-3-small",
32 input: query,

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 1 day ago

testOpenAI1 file match

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