Search

3,307 results found for openai (2055ms)

Code
3,212

import process from "node:process";
import { marked } from "npm:marked";
import { OpenAI } from "npm:openai";
function pm(...lines: string[]): string {
);
const client = new OpenAI({ apiKey: process.env.PERPLEXITY_API_KEY, baseURL: "https://api.perp
const response = await client.chat.completions.create({
model: "sonar",
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" },
}
// Dynamically import OpenAI
const { OpenAI } = await import("https://esm.town/v/std/openai");
// Initialize OpenAI for potential AI processing
const openai = new OpenAI();
// Process and potentially trigger AI agent
const aiResponse = await openai.chat.completions.create({
messages: [
{
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
const { OpenAI } = await import("https://esm.town/v/std/openai");
const KEY = "messageReceiverApp";
// Process with AI if destinations exist
if (aiDestinations.rows.length > 0) {
const openai = new OpenAI();
for (const destination of aiDestinations.rows) {
try {
const aiResponse = await openai.chat.completions.create({
messages: [{
role: "user",
export default async function server(request: Request): Promise<Response> {
if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const body = await request.json();
try {
const completion = await openai.chat.completions.create({
messages: messages,
model: "gpt-4o-mini",
export default async function server(request: Request): Promise<Response> {
if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const body = await request.json();
try {
const completion = await openai.chat.completions.create({
messages: messages,
model: "gpt-4o-mini",
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" },
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" },