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/?q=openai&page=25&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 2503 results for "openai"(3551ms)

Louai_team_performance_review.ts24 matches

@jeffvincentUpdated 2 weeks ago
12import {
13 AIPerformanceAnalysis,
14 createOpenAIClient,
15 LouOpenAIClient,
16 validatePerformanceData,
17 validateWaiverData,
18 WaiverRecommendation,
19} from "./ai_performance_openai_client.ts";
20import {
21 createPromptConfig,
39 maxWaiverCandidates: number; // Maximum waiver candidates to analyze (default: 15)
40
41 // OpenAI configuration
42 openai: {
43 model: "gpt-4-turbo-preview" | "gpt-4o" | "gpt-3.5-turbo";
44 maxTokens: number;
159export class AITeamPerformanceReviewer {
160 private performanceAnalyzer: LouPerformanceAnalyzer;
161 private openaiClient: LouOpenAIClient;
162 private tokenStorage: LouTokenStorage;
163 private config: AITeamReviewConfig;
169 minConfidenceThreshold: 70,
170 maxWaiverCandidates: 15,
171 openai: {
172 model: "gpt-4-turbo-preview",
173 maxTokens: 4000,
190 // Initialize components
191 this.performanceAnalyzer = new LouPerformanceAnalyzer();
192 this.openaiClient = createOpenAIClient({
193 model: this.config.openai.model,
194 maxTokens: this.config.openai.maxTokens,
195 temperature: this.config.openai.temperature,
196 });
197 this.tokenStorage = new LouTokenStorage();
198
199 console.log(`🤖 AI Team Performance Reviewer initialized with model: ${this.config.openai.model}`);
200 }
201
420 authentication: boolean;
421 yahooAPI: boolean;
422 openAI: boolean;
423 performanceAnalyzer: boolean;
424 };
430 authentication: false,
431 yahooAPI: false,
432 openAI: false,
433 performanceAnalyzer: false,
434 };
445 }
446
447 // Test 2: OpenAI API
448 try {
449 const openAITest = await this.openaiClient.testConnection();
450 results.openAI = openAITest.success;
451 if (!openAITest.success) {
452 errors.push(`OpenAI test failed: ${openAITest.error}`);
453 }
454 console.log(openAITest.success ? "✅ OpenAI test passed" : "❌ OpenAI test failed");
455 } catch (error) {
456 errors.push(`OpenAI test failed: ${error}`);
457 console.log("❌ OpenAI test failed");
458 }
459
679
680 // Execute AI analysis
681 const analysis = await this.openaiClient.analyzeTeamPerformance({
682 teamStats: data.teamStats,
683 playerStats: data.playerStats,
731
732 // Generate AI recommendations
733 const recommendations = await this.openaiClient.getPickupRecommendations(
734 underperformers,
735 data.waiverPlayers,
1---
2description: You can use openai-client when integrating vals to an LLM
3globs:
4alwaysApply: false
5---
6TypeScript interface for interacting with OpenAI's chat models, with optional global rate limiting, and uses Val Town's SQLite for persistent rate limit tracking.
7Key Components
8Message Type: Defines the structure for chat messages (role and content).
9ChatOpenAI(model: string): Factory function returning an object with an invoke(messages) method. This method sends an array of messages to the specified OpenAI chat model and returns the assistant's response.
10GlobalRateLimitedChatOpenAI(model: string, requestsPerSecond: number): Decorator for ChatOpenAI that enforces a global rate limit (requests per second) using a persistent SQLite table.
11GlobalRateLimiter: Class that implements the rate limiting logic. It checks the number of requests in the current time window and throws an error if the limit is exceeded. It uses a table (global_rate_limit_1) in Val Town's SQLite.
12ensureGlobalRateLimitTableExists: Ensures the rate limit tracking table exists in the database at startup.
13Usage
14Use ChatOpenAI(model) for direct, unlimited access to OpenAI chat completions.
15Use GlobalRateLimitedChatOpenAI(model, requestsPerSecond) to enforce a global rate limit on chat completions, suitable for shared or public-facing endpoints.
16Val Town/Platform Notes
17Uses Val Town’s standard SQLite API for persistent storage.
18Designed for server-side use (no browser-specific code).
19No secrets are hardcoded; OpenAI API keys are managed by the OpenAI SDK/environment.

openai-client.cursorrules4 matches

@cricks_unmixed4uUpdated 2 weeks 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" },

openai-clientknowledge.md4 matches

@cricks_unmixed4uUpdated 2 weeks 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" },

securityknowledge.md4 matches

@cricks_unmixed4uUpdated 2 weeks 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" },

security.cursorrules4 matches

@cricks_unmixed4uUpdated 2 weeks 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" },

hm-invoicesv1VAL-TOWN-RULES.md4 matches

@arfanUpdated 2 weeks ago
66Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
67
68### OpenAI
69
70```ts
71import { OpenAI } from "https://esm.town/v/std/openai";
72const openai = new OpenAI();
73const completion = await openai.chat.completions.create({
74 messages: [
75 { role: "user", content: "Say hello in a creative way" },

api_ianmenethil_comopenaiClient.ts5 matches

@ianmenethilUpdated 2 weeks ago
1// Future implementation of OpenAI client for API calls
2import { OpenAI } from "openai";
3
4const openai = new OpenAI({
5 apiKey: Deno.env.get("OPENAI_API_KEY"),
6});
7
8export default openai;
9
13 ENABLED: !!Deno.env.get("FIRECRAWL_API_KEY"),
14 },
15 OPENAI: {
16 API_KEY: Deno.env.get("OPENAI_API_KEY"),
17 BASE_URL: "https://api.openai.com/v1",
18 TIMEOUT: 30000,
19 ENABLED: !!Deno.env.get("OPENAI_API_KEY"),
20 },
21 RESEND: {

api_ianmenethil_comappTypes.ts2 matches

@ianmenethilUpdated 2 weeks ago
209}
210
211export interface OpenAIServiceConfig {
212 API_KEY?: string;
213 BASE_URL: string;
226 TAVILY: TavilyServiceConfig;
227 FIRECRAWL: FirecrawlServiceConfig;
228 OPENAI: OpenAIServiceConfig;
229 RESEND: ResendServiceConfig;
230}

openai2 file matches

@wangqiao1234Updated 5 days ago

openaiproxy2 file matches

@wangqiao1234Updated 5 days 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