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%22Optional%20title%22?q=openai&page=63&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 1718 results for "openai"(456ms)

memorySampleSummarymain.tsx1 match

@wangllm•Updated 1 month ago
4 const builder = await getMemoryBuilder({
5 type: "summary",
6 provider: "openai",
7 });
8 const memory = await builder();

tenaciousPeachHornetmain.tsx3 matches

@Argu•Updated 1 month ago
82
83 try {
84 const { OpenAI } = await import("https://esm.town/v/std/openai");
85 const openai = new OpenAI();
86
87 const completion = await openai.chat.completions.create({
88 messages: messages,
89 model: "gpt-4o-mini",

TopHackerNewsDailyEmailmain.tsx6 matches

@ianmenethil•Updated 1 month ago
1// import { loadPageContent } from "https://esm.town/v/charlypoly/browserbaseUtils";
2// import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3// import { z } from "npm:zod";
4// import { zodToJsonSchema } from "npm:zod-to-json-schema";
25// });
26
27// // we create a OpenAI Tool that takes our schema as argument
28// const extractContentTool: any = {
29// type: "function",
36// };
37
38// const openai = new OpenAI();
39
40// // We ask OpenAI to extract the content from the given web page.
41// // The model will reach out to our `extract_content` tool and
42// // by doing so, the model will extract the required data to satisfy
43// // the requirement of `extract_content`s argument.
44// const completion = await openai.chat.completions.create({
45// model: "gpt-4-turbo",
46// messages: [
55// });
56
57// // we retrieve the serialized arguments generated by OpenAI
58// const result = completion.choices[0].message.tool_calls![0].function.arguments;
59// // the serialized arguments are parsed into a valid JavaScript array of objects

MyProjectmain.tsx3 matches

@mercyngatia•Updated 1 month ago
281export default async function server(request: Request): Promise<Response> {
282 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
283 const { OpenAI } = await import("https://esm.town/v/std/openai");
284 const KEY = "MyProject";
285 const SCHEMA_VERSION = 3;
302 `);
303
304 const openai = new OpenAI();
305
306 if (request.method === "POST") {
328
329 if (request.url.includes("/ai-suggestion")) {
330 const completion = await openai.chat.completions.create({
331 messages: [
332 {

openaiStreamingDemomain.tsx4 matches

@stevekrouse•Updated 1 month ago
1import OpenAI from "npm:openai";
2const openai = new OpenAI();
3
4export default async (req) => {
8
9 // Create the stream with the signal
10 const stream = await openai.chat.completions.create({
11 model: "gpt-3.5-turbo",
12 messages: [{ role: "user", content: "Tell me a story" }],
20 // Handle connection closed event
21 req.signal.addEventListener("abort", () => {
22 console.log("Client disconnected, aborting OpenAI request");
23 controller.abort();
24 writer.close().catch(err => {

openaistreaminghtmlmain.tsx3 matches

@stevekrouse•Updated 1 month ago
1import OpenAI from "npm:openai";
2
3const openai = new OpenAI();
4
5export default async (req) => {
6 try {
7 const stream = await openai.chat.completions.create({
8 model: "gpt-3.5-turbo",
9 messages: [{

poorvis885README.md1 match

@poorvis885•Updated 1 month ago
12
13Frontend: React 18, TailwindCSS
14APIs: Open-Meteo, OpenAI GPT-4o
15Hosting: ESM-based module imports

poorvis885main.tsx3 matches

@poorvis885•Updated 1 month ago
53
54 // Fetch AI-powered weather insight
55 const { OpenAI } = await import("https://esm.town/v/std/openai");
56 const openai = new OpenAI();
57
58 const aiResponse = await openai.chat.completions.create({
59 messages: [
60 {

weatherDashboardmain.tsx3 matches

@poorvis885•Updated 1 month ago
53
54 // Fetch AI-powered weather insight
55 const { OpenAI } = await import("https://esm.town/v/std/openai");
56 const openai = new OpenAI();
57
58 const aiResponse = await openai.chat.completions.create({
59 messages: [
60 {

weatherDashboardREADME.md1 match

@poorvis885•Updated 1 month ago
12
13Frontend: React 18, TailwindCSS
14APIs: Open-Meteo, OpenAI GPT-4o
15Hosting: ESM-based module imports

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