Search

3,380 results found for openai (3165ms)

Code
3,285

import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
});
}
const openai = new OpenAI();
try {
}
const stream = await openai.chat.completions.create(body);
if (!body.stream) {
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 { blob } from "https://esm.town/v/std/blob";
import { sqlite } from "https://esm.town/v/std/sqlite";
import { OpenAI } from "https://esm.town/v/std/openai";
import { email } from "https://esm.town/v/std/email";
```
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" },
// --- SERVER-SIDE LOGIC ---
export default async function(req: Request) {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const { PDFExtract } = await import("npm:pdf.js-extract");
const action = url.searchParams.get("action");
const sourceUrl = import.meta.url.replace("esm.town", "val.town");
const openai = new OpenAI();
const MAX_TEXT_ANALYZE = 30000;
agentName: string,
): Promise<object> {
log.push({ agent: agentName, type: "step", message: `Calling OpenAI gpt-4o...` });
try {
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessa
export default async function(req: Request) {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const { PDFExtract } = await import("npm:pdf.js-extract");
const action = url.searchParams.get("action");
const sourceUrl = import.meta.url.replace("esm.town", "val.town");
const openai = new OpenAI();
const MAX_TEXT_SUGGEST = 20000;
const MAX_TEXT_ANALYZE = 30000;
agentName: string,
): Promise<object> {
log.push({ agent: agentName, type: "step", message: `Calling OpenAI gpt-4o...` });
try {
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessa
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" },