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/$2?q=openai&page=169&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 2111 results for "openai"(1274ms)

exampleTopHackerNewsDailyEmailmain.tsx7 matches

@charlypoly•Updated 11 months ago
1import { loadPageContent } from "https://esm.town/v/charlypoly/browserbaseUtils";
2import { email } from "https://esm.town/v/std/email?v=12";
3import { OpenAI } from "https://esm.town/v/std/openai?v=4";
4import { z } from "npm:zod";
5import { zodToJsonSchema } from "npm:zod-to-json-schema";
26 });
27
28 // we create a OpenAI Tool that takes our schema as argument
29 const extractContentTool: any = {
30 type: "function",
37 };
38
39 const openai = new OpenAI();
40
41 // We ask OpenAI to extract the content from the given web page.
42 // The model will reach out to our `extract_content` tool and
43 // by doing so, the model will extract the required data to satisfy
44 // the requirement of `extract_content`s argument.
45 const completion = await openai.chat.completions.create({
46 model: "gpt-4-turbo",
47 messages: [
56 });
57
58 // we retrieve the serialized arguments generated by OpenAI
59 const result = completion.choices[0].message.tool_calls![0].function.arguments;
60
64 const parsed = schema.parse(JSON.parse(result));
65
66 const completion2 = await openai.chat.completions.create({
67 model: "gpt-4-turbo",
68 messages: [
7import cosSimilarity from "npm:cos-similarity";
8import _ from "npm:lodash";
9import OpenAI from "npm:openai";
10
11export default async function blogPostEmbeddingsDimensionalityReduction() {
23 ];
24
25 const openai = new OpenAI();
26 async function getEmbedding(str) {
27 return (await openai.embeddings.create({
28 model: "text-embedding-3-large",
29 input: str,

compareEmbeddingsmain.tsx3 matches

@janpaul123•Updated 11 months ago
6import cosSimilarity from "npm:cos-similarity";
7import _ from "npm:lodash";
8import OpenAI from "npm:openai";
9
10const comparisons = [
20];
21
22const openai = new OpenAI();
23const cache = {};
24async function getEmbedding(str) {
25 cache[str] = cache[str] || (await openai.embeddings.create({
26 model: "text-embedding-3-large",
27 input: str,

indexValsBlobsmain.tsx4 matches

@janpaul123•Updated 11 months ago
4import { db as allValsDb } from "https://esm.town/v/sqlite/db?v=9";
5import { blob } from "https://esm.town/v/std/blob";
6import OpenAI from "npm:openai";
7import { truncateMessage } from "npm:openai-tokens";
8
9const dimensions = 1536;
39);
40
41const openai = new OpenAI();
42for (const newValsBatch of newValsBatches) {
43 const batchDataIndex = nextDataIndex;
47 const code = getValCode(val);
48
49 const embedding = await openai.embeddings.create({
50 model: "text-embedding-3-small",
51 input: truncateMessage(code, "text-embedding-3-small"),

semanticSearchNeonmain.tsx3 matches

@janpaul123•Updated 11 months ago
3import { db as allValsDb } from "https://esm.town/v/sqlite/db?v=9";
4import { blob } from "https://esm.town/v/std/blob";
5import OpenAI from "npm:openai";
6
7const dimensions = 1536;
11 await client.connect();
12
13 const openai = new OpenAI();
14 const queryEmbedding = (await openai.embeddings.create({
15 model: "text-embedding-3-small",
16 input: query,

indexValsNeonmain.tsx4 matches

@janpaul123•Updated 11 months ago
5import { db as allValsDb } from "https://esm.town/v/sqlite/db?v=9";
6import { blob } from "https://esm.town/v/std/blob";
7import OpenAI from "npm:openai";
8import { truncateMessage } from "npm:openai-tokens";
9
10// CREATE TABLE vals_embeddings (id TEXT PRIMARY KEY, embedding VECTOR(1536));
41 }
42
43 const openai = new OpenAI();
44 for (const newValsBatch of newValsBatches) {
45 await Promise.all([...Array(newValsBatch.length).keys()].map(async (valIndex) => {
47 const code = getValCode(val);
48
49 const embedding = await openai.embeddings.create({
50 model: "text-embedding-3-small",
51 input: truncateMessage(code, "text-embedding-3-small"),

caloriesmain.tsx1 match

@chriswmartin•Updated 11 months ago
2import { fileToDataURL } from "https://esm.town/v/stevekrouse/fileToDataURL";
3import { modifyImage } from "https://esm.town/v/stevekrouse/modifyImage";
4import { chat } from "https://esm.town/v/stevekrouse/openai";
5import { Hono } from "npm:hono@3";
6

convertResumemain.tsx1 match

@iamseeley•Updated 11 months ago
122 event.preventDefault();
123 const resumeContent = document.getElementById('resumeContent').value;
124 const apiKey = '${Deno.env.get("OPENAI_API_KEY")}';
125 const spinner = document.getElementById('spinner');
126 const jsonOutput = document.getElementById('jsonOutput');

weatherGPTmain.tsx3 matches

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

purpleKangarooREADME.md1 match

@willthereader•Updated 11 months ago
1# ChatGPT Implemented in Val Town
2
3Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events.
4
5<p align=center>

openai-client1 file match

@cricks_unmixed4u•Updated 12 hours ago

openai_enrichment6 file matches

@stevekrouse•Updated 1 day ago
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
kwhinnery_openai