Search

169 results found for openai (465ms)

Code
167

import { IncomingWebhook } from "npm:@slack/webhook";
import { Octokit } from "npm:octokit";
import { OpenAI } from "npm:openai";
// Environment variables
commits: any[],
): Promise<string> {
const openai = new OpenAI();
// Extract commit messages
try {
console.log("prompt", prompt);
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: prompt }],
model: "gpt-5.2-2025-12-11",
// Vibe Engine - Synthesizes prompt stack into OpenAI calls
import { OpenAI } from "https://esm.town/v/std/openai";
import type { PlayedCard, PromptResult } from "../../shared/types.ts";
const prompt = buildPrompt(config, userQuery);
const openai = new OpenAI();
const messages: any[] = [
}
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages,
});
// API: Generate vibe (run OpenAI)
app.post("/api/session/:sessionId/generate", async c => {
const sessionId = c.req.param("sessionId");
### Generation fails
Check that OpenAI integration is working in Val Town console.
## Tips for Fun Sessions
- Val Town account
- Val Town MCP tools installed
- OpenAI API key (automatically provided by Val Town)
## Deployment Steps
## Environment Variables
OpenAI API key is automatically provided by Val Town. No manual setup needed!
If you want to use your own API key:
```bash
own_add_env_var --val "<your-username>/vibe-draft" --key "OPENAI_API_KEY" --value "sk-..." --des
```
Check that `shared/cards.ts` is uploaded correctly and importing properly.
### OpenAI Errors
Verify OpenAI API key is set (should be automatic). Check Val Town console for API errors.
### Database Errors
│ │ ┌─────────┐ ┌──────────┐ ┌───────────────┐ │ │
│ │ │SSE Hub │ │ API Routes│ │ Vibe Engine │ │ │
│ │ │broadcast│ │ /api/* │ │ (OpenAI) │ │ │
│ │ └────┬────┘ └─────┬─────┘ └───────┬───────┘ │ │
│ │ │ │ │ │ │
Vibe Engine Synthesizes Prompt
Call OpenAI API
Save Result to vibe_results Table
"""
5. Call OpenAI with prompt + user query
6. Return response
```
- **SSE Overhead**: ~1KB per client per 30s (heartbeat)
- **Database**: SQLite in-memory for active sessions
- **OpenAI**: 2-5 seconds per generation (gpt-4o-mini)
- **Concurrent Players**: Tested with 10 simultaneous users
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to cre
### OpenAI
```ts
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },
});
// API: search (needs OPENAI_API_KEY)
app.get("/api/search", async (c) => {
const query = c.req.query("q");
if (!query) return c.json({ error: "Missing ?q= parameter" }, 400);
const apiKey = Deno.env.get("OPENAI_API_KEY");
if (!apiKey) return c.json({ error: "Search not available (OPENAI_API_KEY not set)" }, 503);
const limit = parseInt(c.req.query("limit") ?? "20", 10);
const embRes = await fetch("https://api.openai.com/v1/embeddings", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
_2 or _3) to create a fresh table.
### OpenAI
```ts
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },
For orchestrator follow-up:
. **Decision needed**: NLP provider for entity detection (OpenAI, local model, or regex-only MVP
2. **Design review**: Mock up the Discord `#review-portal` card format
3. **Legal/privacy**: Confirm redacted data handling complies with any applicable policies
openai-agents
kidjs
openai-agents
Template to use the OpenAI Agents SDK
Public
openai-agents
EatPraySin
openai-agents
Template to use the OpenAI Agents SDK
Public

Users

No users found

Docs

No docs found