Search

3,362 results found for openai (1700ms)

Code
3,267

<a href="?q=function" className="example-link">function</a>
<a href="?q=discord" className="example-link">discord</a>
<a href="?q=openai" className="example-link">openai</a>
<a href="?q=react" className="example-link">react</a>
</div>
<a href="?q=function" className="example-link">function</a>
<a href="?q=discord" className="example-link">discord</a>
<a href="?q=openai" className="example-link">openai</a>
<a href="?q=react" className="example-link">react</a>
</div>
import { OpenAI } from "https://esm.town/v/std/openai";
// Initialize OpenAI client
const openai = new OpenAI();
// For debugging
try {
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
try {
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
).join("\n\n");
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
If you encounter issues with the Deep Research Agent, try the following:
1. **Check OpenAI API Access**: Ensure your Val Town account has access to the OpenAI API.
2. **Verify Endpoints**: Make sure you're using the correct URLs for your Val Town username.
## Requirements
This agent uses the OpenAI API via Val Town's standard library. No additional setup is required.
## Limitations
<footer class="mt-8 text-center text-gray-500 text-sm">
<p>Powered by Val Town and OpenAI</p>
<p class="mt-1">
<a href="${import.meta.url.replace("esm.sh", "val.town")}" target="_top" class="text-blu
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 type { ApiResponse, RecommendationRequest, UserProfile } from "../shared/types";
import { drills, initDatabase, initSampleDrills, playlists, sessions, users } from "./database";
generateMusicPlaylist, generateTrainingSession } from "./openai";
// Initialize the Hono app
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
import { OpenAI } from "https://esm.town/v/std/openai";
import { readFile } from "https://esm.town/v/std/utils@85-main/index.ts";
// Initialize OpenAI client
const openai = new OpenAI();
// Database setup
}
// Fallback response generator when OpenAI is not available
function generateFallbackResponse(query: string, memories: Array<{ content: string; tags?: strin
if (memories.length === 0) {
}
// Generate a response using OpenAI, incorporating memories if available
async function generateResponse(query: string, memories: Array<{ content: string; tags?: string
try {
: "I don't have any memories stored yet.\n\n";
console.log(`Sending to OpenAI with ${memories.length} memories in context`);
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
if (!response.choices || response.choices.length === 0) {
console.error('OpenAI returned no choices:', response);
return generateFallbackResponse(query, memories);
}
return response.choices[0].message.content || generateFallbackResponse(query, memories);
} catch (error) {
console.error('Error generating response with OpenAI:', error);
return generateFallbackResponse(query, memories);
}
brian@airbnb.com,Brian Chesky
drew@dropbox.com,Drew Houston
sam@openai.com,Sam Altman
tim@apple.com,Tim Cook
jeff@amazon.com,Jeff Bezos
brian@airbnb.com,Brian Chesky
drew@dropbox.com,Drew Houston
sam@openai.com,Sam Altman
tim@apple.com,Tim Cook
jeff@amazon.com,Jeff Bezos