Search
Code3,166
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { 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" },
import { OpenAI } from "https://deno.land/x/openai@v4.57.0/mod.ts";import { logFood } from "./notion.ts";import { searchFood, getNutrition, type SearchResult, type NutritionResult } from "./usda.ts";}const openaiApiKey = Deno.env.get("OPENAI_API_KEY") || env.OPENAI_API_KEY;const browserUseApiKey = Deno.env.get('BROWSER_USE_API_KEY') || env.BROWSER_USE_API_KEY;console.log("OpenAI API key present:", !!openaiApiKey);console.log("Browser Use API key present:", !!browserUseApiKey);const openai = new OpenAI({ apiKey: openaiApiKey,});const browserUse = new BrowserUseClient({ ]; let completion = await openai.chat.completions.create({ model: "gpt-4o", messages, // Get next response completion = await openai.chat.completions.create({ model: "gpt-4o", messages,
const NR_TYPE = "near_field";const INSTRUCTIONS = ` Greet the user in English, and thank them for trying the new OpenAI Realtime API. Give them a brief summary based on the list below, and then ask if they have any questions. Answer questions using the information below. For questions outside this scope, - higher audio quality - improved handling of alphanumerics (eg, properly understanding credit card and phone numbers) - support for the OpenAI Prompts API - support for MCP-based tools - auto-truncation to reduce context size
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { 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" },
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { 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" },
- 🍎 Web interface for entering food descriptions- 🤖 AI-powered calorie estimation using OpenAI GPT-4o- 📊 Automatic logging to Notion database- 🎨 Clean, responsive UI with TailwindCSS- `NOTION_OAUTH_TOKEN` - Your Notion OAuth token- `OPENAI_API_KEY` - Your OpenAI API key (handled by Val Town's OpenAI integration)### Notion Database- `main.http.ts` - HTTP trigger with web interface and AI integration- `notion.ts` - Notion API integration for logging food entries- Uses Val Town's OpenAI integration for GPT-4o access- Responsive web UI built with TailwindCSSThis version has been migrated from a Bun CLI script to a Val Town HTTP trigger:- ✅ Uses Val Town's OpenAI integration instead of direct OpenAI SDK- ✅ Environment variables use `Deno.env.get()` instead of `process.env`- ✅ ESM imports from `https://esm.sh` for compatibility
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { 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" },
*/import { OpenAI } from "https://esm.town/v/std/openai";import type { ConversationContext, */ private initializeProviders(): void { // OpenAI provider const openaiKey = Deno.env.get('OPENAI_API_KEY'); if (openaiKey) { this.providers.set('openai', { name: 'openai', model: 'gpt-4o-mini', apiKey: openaiKey, maxTokens: 150, temperature: 0.8 let tokensUsed = 0; if (provider.name === 'openai') { response = await this.callOpenAI(provider, prompt); tokensUsed = response.usage?.total_tokens || 0; } else if (provider.name === 'xai') { /** * Call OpenAI API */ private async callOpenAI(provider: AIProvider, prompt: string): Promise<any> { const openai = new OpenAI({ apiKey: provider.apiKey }); const completion = await openai.chat.completions.create({ model: provider.model, messages: [ /** * Call xAI API (similar to OpenAI format) */ private async callXAI(provider: AIProvider, prompt: string): Promise<any> { private extractContent(response: any, providerName: string): string { switch (providerName) { case 'openai': case 'xai': return response.choices?.[0]?.message?.content || '';
try { // For now, just check if environment variables are set const openaiKey = Deno.env.get('OPENAI_API_KEY'); const xaiKey = Deno.env.get('XAI_API_KEY'); if (!openaiKey && !xaiKey) { return { status: 'unhealthy',
### 8.2 External Dependencies- **Database**: External PostgreSQL or SQLite for data persistence- **LLM Services**: OpenAI, xAI, Claude APIs for AI functionality- **Platform APIs**: Direct integration with messaging platform APIs- **Monitoring**: External logging and metrics collection services
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
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": "*",
No docs found