Search

3,370 results found for openai (1928ms)

Code
3,275

import { Hono } from "https://esm.sh/hono@3.11.7";
import { OpenAI } from "https://esm.town/v/std/openai";
import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
import { parseProject } from "https://esm.town/v/std/utils@85-main/index.ts";
}
const openai = new OpenAI();
// Prepare messages with history and enhanced system prompt
];
const completion = await openai.chat.completions.create({
messages,
model: "gpt-4o-mini",
<footer class="mt-8 text-center text-gray-500 text-sm">
<p>
Digital 3D AI Teacher - Powered by OpenAI and Three.js
<br>
<a id="view-source" href="#" target="_top" class="text-indigo-500 hover:underline">View
- Detailed facial features with realistic skin, eyes, and hair
- Lifelike animations and expressions
- AI-powered responses using OpenAI's API
- Interactive chat interface
- Educational content delivery
- Advanced lighting setup for photorealistic rendering
- Facial animation system
- OpenAI API for AI responses
- Tailwind CSS for styling
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" },
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" },
import { anthropic } from "npm:@ai-sdk/anthropic";
import { openai } from "npm:@ai-sdk/openai";
import { generateText } from "npm:ai";
import {
try {
const { text, toolCalls, toolResults } = await generateText({
// model: openai(this.modelName),
model: anthropic("claude-3-7-sonnet-20250219"),
tools: this.tools,
import { openai } from "npm:@ai-sdk/openai";
import { streamText, tool } from "npm:ai";
import { z } from "npm:zod";
const result = streamText({
model: openai("gpt-4o"),
messages,
toolChoice: "auto",
import { OpenAI } from "https://esm.town/v/std/openai";
/**
* Simple test to verify OpenAI API key is working
*/
export default async function(): Promise<Response> {
try {
// Check for OpenAI API key
const apiKey = Deno.env.get("OPENAI_API_KEY");
if (!apiKey) {
return new Response(JSON.stringify({
error: "OpenAI API key is missing",
message: "Please set the OPENAI_API_KEY environment variable in Val Town."
}), {
status: 500,
}
// Test OpenAI API
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-3.5-turbo",
messages: [
return new Response(JSON.stringify({
success: true,
message: "OpenAI API key is working correctly",
response: completion.choices[0].message.content
}), {
} catch (error) {
return new Response(JSON.stringify({
error: "OpenAI API test failed",
message: error.message || "Unknown error"
}), {
msd/aa/README.md
7 matches
# AI Course Generator
This Val Town project generates comprehensive course structures from user prompts using OpenAI.
## Features
- Takes a course topic as input and generates a complete course structure
- Uses OpenAI's GPT-4o model for high-quality content generation
- Provides a structured output with course title, description, target audience, prerequisites, l
- Includes a user-friendly web interface
## Project Structure
- `/course-generator.ts` - Core logic for generating course structures using OpenAI
- `/frontend-handler.ts` - HTTP handler that serves the frontend and processes API requests
- `/frontend/index.html` - Web interface for the course generator
## Requirements
- OpenAI API key set as an environment variable in Val Town
## Setup Instructions
1. In Val Town, go to your account settings
2. Add an environment variable named `OPENAI_API_KEY` with your OpenAI API key
3. Deploy both the course-generator.ts and frontend-handler.ts files with HTTP triggers
If the application isn't generating any responses, check the following:
1. **OpenAI API Key**: Make sure you've set the `OPENAI_API_KEY` environment variable in Val Tow
2. **Console Logs**: Check the Val Town logs for any error messages
3. **Browser Console**: Open your browser's developer tools to check for any JavaScript errors
4. **API Limits**: If you're using a free OpenAI API key, you might have hit your usage limits
msd/aa/index.html
1 matches
<footer class="text-center mt-10 text-gray-500 text-sm">
<p>Powered by Val Town and OpenAI</p>
<a href="#" id="viewSource" target="_top" class="text-blue-500 hover:underline">View Sourc
</footer>