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=5&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 1566 results for "openai"(1083ms)

stevensDemogenerateFunFacts.ts6 matches

@Shmully•Updated 1 day ago
2import { nanoid } from "https://esm.sh/nanoid@5.0.5";
3import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
4import OpenAI from "npm:openai@4.24.1";
5
6const TABLE_NAME = `memories`;
78 try {
79 // Get API key from environment
80 const apiKey = Deno.env.get("OPENAI_API_KEY");
81 if (!apiKey) {
82 console.error("OpenAI API key is not configured.");
83 return null;
84 }
85
86 // Initialize OpenAI client
87 const openai = new OpenAI({ apiKey });
88
89 // Format previous facts for the prompt
139 console.log({ message });
140
141 const response = await openai.chat.completions.create({
142 model: "gpt-4",
143 max_tokens: 1000,

stevensDemo.cursorrules4 matches

@Shmully•Updated 1 day ago
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },

GitHub-trending-summarysummarize-to-email3 matches

@ynonp•Updated 2 days ago
1import { email } from "https://esm.town/v/std/email";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { JSDOM } from "npm:jsdom";
4import { NodeHtmlMarkdown, NodeHtmlMarkdownOptions } from "npm:node-html-markdown";
16);
17
18const openai = new OpenAI();
19console.log(trendingMarkdown);
20
21const completion = await openai.chat.completions.create({
22 messages: [
23 {

minemain.tsx3 matches

@yassinreg•Updated 2 days ago
125 if (request.method === "POST") {
126 try {
127 const { OpenAI } = await import("https://esm.town/v/std/openai");
128 const openai = new OpenAI();
129
130 const formData = await request.formData();
138 const cvText = new TextDecoder().decode(cvBuffer);
139
140 const completion = await openai.chat.completions.create({
141 messages: [
142 {

discord-botapi-server.js9 matches

@boucher•Updated 2 days ago
1import express from 'express';
2import { getMessages, getLinks, getCategories, updateLinkCategory } from './database.js';
3import { Configuration, OpenAIApi } from 'openai';
4import 'dotenv/config';
5
8app.use(express.json());
9
10// Initialize OpenAI for AI-powered queries
11const configuration = new Configuration({
12 apiKey: process.env.OPENAI_API_KEY,
13});
14const openai = new OpenAIApi(configuration);
15
16/**
17 * Function to analyze messages with OpenAI
18 * @param {Array} messages - Array of message objects
19 * @param {string} query - User query to analyze messages with
20 * @returns {Object} - OpenAI response
21 */
22async function analyzeMessagesWithAI(messages, query) {
23 try {
24 // Format messages for OpenAI
25 const formattedConversation = messages.map(msg => {
26 const author = msg.author_id === process.env.DISCORD_USER_ID ? 'You' : 'Partner';
37 `;
38
39 // Call OpenAI API
40 const response = await openai.createCompletion({
41 model: "gpt-3.5-turbo-instruct",
42 prompt: prompt,

discord-botquery-service.js1 match

@boucher•Updated 2 days ago
115 const links = getLinks(linkFilters);
116
117 // If no specific categories, use OpenAI to help filter relevant links
118 if ((!categories || categories.length === 0) && links.length > 0) {
119 const relevantLinks = await filterRelevantLinks(links, query);

discord-bot.env.example2 matches

@boucher•Updated 2 days ago
5SPOUSE_USER_ID=spouse_user_id_here
6
7# OpenAI API key (for AI-powered querying)
8OPENAI_API_KEY=your_openai_api_key_here
9
10# Val.town settings

discord-botREADME.md3 matches

@boucher•Updated 2 days ago
25- Node.js 16+ and npm
26- Discord account with Bot token
27- OpenAI API key (for AI-powered queries)
28- Val.town account (for deployment)
29
51 - `DISCORD_USER_ID`: Your Discord user ID
52 - `SPOUSE_USER_ID`: Your partner's Discord user ID
53 - `OPENAI_API_KEY`: Your OpenAI API key
54
555. Initialize the database
146
147- Discord.js for Discord API integration
148- OpenAI for AI-powered querying
149- Val.town for hosting and scheduling
150- Better-SQLite3 for database management

discord-bot.cursorrules4 matches

@boucher•Updated 2 days ago
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },

discord-botDISCORD_BOT_SETUP.md3 matches

@boucher•Updated 2 days ago
57 ```
58
59## 7. Get OpenAI API Key
60
611. Go to [OpenAI's website](https://platform.openai.com/)
622. Sign up or log in
633. Navigate to the API keys section
666. Add it to your `.env` file:
67 ```
68 OPENAI_API_KEY=your_openai_api_key_here
69 ```
70

testOpenAI1 file match

@shouser•Updated 1 day ago

testOpenAI1 file match

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