Search

4,051 results found for openai (1255ms)

Code
3,945

import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
/**
}
const completion = await openai.chat.completions.create({
messages: [
{
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
/**
}
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: `Write a haiku about ${text}` }],
model: "gpt-5-nano",
): Promise<string> {
try {
const shouldRun = Deno.env.get("OPENAI_API_KEY") !== null;
const gpt = null; // TODO: Implement OpenAI API call
if (!shouldRun && gpt === null) {
return message; // Return original message if OpenAI unavailable
}
}
return message; // Return original message if OpenAI unavailable or error
} catch (error) {
// AI message generation failed: ${error.message}
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" },
- **Framework**: Hono 4.4
- **Database**: SQLite (libSQL)
- **AI**: OpenAI GPT-4o
- **Frontend**: React 18 (CDN + Babel)
- **Styling**: CSS-in-JS (generated)
├── database.ts # SQLite schema, migrations, CRUD operations
├── auth.ts # Authentication service & middleware
├── engine.ts # AI analysis engine (OpenAI integration)
├── api.ts # REST API route handlers
├── setup.ts # First-run setup wizard
- Val Town account (or Deno runtime)
- OpenAI API key (configured in Val Town)
### Installation
| Variable | Description |
| ---------------- | ------------------------------------------------- |
| `OPENAI_API_KEY` | Your OpenAI API key (auto-configured in Val Town) |
---
## 🙏 Acknowledgments
- OpenAI for GPT-4o
- Val Town for the hosting platform
- Hono for the lightweight framework
*/
import { OpenAI } from "https://esm.town/v/std/openai?v=5";
import {
APP_TAGLINES,
*/
export class PlaybookEngine {
private openai: OpenAI;
/**
*/
constructor() {
this.openai = new OpenAI();
}
async extractBeliefs(text: string): Promise<BeliefExtraction> {
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
): Promise<PhoenixFortressResult> {
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
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 { OpenAI } from "https://esm.town/v/std/openai?v=5";
import {
APP_TAGLINES,
*/
export class PlaybookEngine {
private openai: OpenAI;
/**
*/
constructor() {
this.openai = new OpenAI();
}
async extractBeliefs(text: string): Promise<BeliefExtraction> {
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
): Promise<PhoenixFortressResult> {
try {
const completion = await this.openai.chat.completions.create({
model: DEFAULT_MODEL,
temperature: ANALYSIS_TEMPERATURE,
) sourceValue = "SEO";
else if (
/(chat\.openai\.com|perplexity\.ai|claude\.ai|bard\.google\.com|gemini\.google\.com|you\
.test(ref)
) sourceValue = "IA";