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=141&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 2573 results for "openai"(5695ms)

equitableMaroonCrabmain.tsx3 matches

@EmailscompellingUpdated 3 months ago
1export default async function (e: Email) {
2 const { OpenAI } = await import("https://esm.town/v/std/openai");
3 const openai = new OpenAI();
4
5 const skinkDescription = await openai.chat.completions.create({
6 messages: [
7 {

OpenTowniesystem_prompt.txt4 matches

@jxnblkUpdated 3 months ago
137Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
138
139### OpenAI
140```ts
141import { OpenAI } from "https://esm.town/v/std/openai";
142const openai = new OpenAI();
143const completion = await openai.chat.completions.create({
144 messages: [
145 { role: "user", content: "Say hello in a creative way" },

confidentWhiteOxmain.tsx3 matches

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

rousingBronzeMandrillmain.tsx4 matches

@LearnUpdated 3 months ago
112
113 try {
114 const { OpenAI } = await import("https://esm.town/v/std/openai");
115 const openai = new OpenAI();
116
117 const parseResponse = await openai.chat.completions.create({
118 messages: [{
119 role: "system",
128
129 const parsedQuery = parseResponse.choices[0].message.content || '';
130 Logger.log('OpenAI parsed query', { parsedQuery });
131
132 const [rootNode, context] = parsedQuery.split('|').map(s => s.trim());

EchoPromptermain.tsx9 matches

@LearnUpdated 3 months ago
936if (typeof document !== "undefined") { client(); }
937export default async function server(request: Request): Promise<Response> {
938 const { OpenAI } = await import("https://esm.town/v/std/openai");
939 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
940 const openai = new OpenAI();
941
942 // Use the val's URL as a unique key for database tables
1039 const echoPrompt = getEchoPrompt();
1040
1041 const completion = await openai.chat.completions.create({
1042 messages: [
1043 {
1095
1096 // First, generate the agent prompt
1097 const completion2 = await openai.chat.completions.create({
1098 messages: [
1099 {
1121
1122 // Then, generate commands for the agent based on its purpose and description
1123 const commandsCompletion = await openai.chat.completions.create({
1124 messages: [
1125 {
1227 }
1228
1229 // Format the history into OpenAI message format
1230 const messages = [
1231 {
1237 // Add conversation history if it exists
1238 if (history && history.length > 0) {
1239 // Filter out system messages and map to OpenAI format
1240 history.forEach(msg => {
1241 if (msg.role !== "system") {
1255
1256 // Chat with the agent using the stored prompt and history
1257 const completion = await openai.chat.completions.create({
1258 messages: messages,
1259 model: "gpt-4o-mini",
1374
1375 // Execute the command with the AI
1376 const completion = await openai.chat.completions.create({
1377 messages: messages,
1378 model: "gpt-4o-mini",

Blindaccessmain.tsx7 matches

@Nour112Updated 3 months ago
2import React, { useState, useEffect, useContext, createContext } from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4import { OpenAI } from "https://esm.town/v/std/openai";
5
6// Accessibility Utilities
71 const generateAIResponse = async (text) => {
72 try {
73 const openai = new OpenAI();
74 const completion = await openai.chat.completions.create({
75 messages: [
76 { role: "system", content: "أنت مساعد ذكي مخصص للمكفوفين، مهمتك تقديم مساعدة شاملة وداعمة" },
140 const imageData = canvas.toDataURL('image/jpeg');
141
142 const openai = new OpenAI();
143 const response = await openai.chat.completions.create({
144 model: "gpt-4o-mini",
145 messages: [
230
231 try {
232 const openai = new OpenAI();
233 const routeResponse = await openai.chat.completions.create({
234 model: "gpt-4o-mini",
235 messages: [

groqAudioChattts.ts1 match

@dcm31Updated 3 months ago
26 console.log("🔊 Sending request to Groq Speech API");
27 const start = Date.now();
28 const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
29 method: "POST",
30 headers: {

groqAudioChatchat.ts1 match

@dcm31Updated 3 months ago
20 console.log("🔵 Sending request to Groq API");
21 const start = Date.now();
22 const response = await fetch("https://api.groq.com/openai/v1/chat/completions", {
23 method: "POST",
24 headers: {

groqAudioChataudio.ts1 match

@dcm31Updated 3 months ago
63 console.log("🎤 Sending request to Groq Whisper API");
64 const start = Date.now();
65 const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", {
66 method: "POST",
67 headers: {

extractRecipeAImain.tsx3 matches

@SkeyeUpdated 3 months ago
198
199 app.post("/extract-recipe", async (c) => {
200 const { OpenAI } = await import("https://esm.town/v/std/openai");
201 const openai = new OpenAI();
202
203 const formData = await c.req.formData();
224
225 try {
226 const response = await openai.chat.completions.create({
227 model: "gpt-4o",
228 messages: [

openai2 file matches

@wangqiao1234Updated 2 weeks ago

openaiproxy2 file matches

@wangqiao1234Updated 2 weeks 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