Search

3,380 results found for openai (6286ms)

Code
3,285

import { OpenAI } from "https://esm.town/v/std/openai";
// --- Agent Communication Protocol (ACP) & Types --- //
/**
* Agent 6: Synthesizes the first draft. (REAL OpenAI Call)
*/
async function leadWriterAgent(
revisionFeedback?: string,
): Promise<ACP> {
console.log("AGENT: Lead Writer Agent running (calling OpenAI)...");
const openai = new OpenAI();
let userMessage = `
try {
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
});
const draft = response.choices?.[0]?.message?.content;
if (!draft) throw new Error("OpenAI returned empty content.");
return createAcp("lead_writer_agent", "SUCCESS", draft, "text/plain");
} catch (e) {
console.error("OpenAI API Error:", e);
return {
...createAcp("lead_writer_agent", "FAILURE", null),
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" },
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" },
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";
import type { ValInfo, ValSummary } from "../shared/types.ts";
const openai = new OpenAI();
export async function summarizeVal(val: ValInfo): Promise<ValSummary> {
\`\`\``;
const completion = await openai.chat.completions.create({
messages: [
{
import { type Context, Hono } from "https://esm.sh/hono@3.11.7";
import { blob } from "https://esm.town/v/std/blob";
import { OpenAI } from "https://esm.town/v/std/openai";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
import Groq from "npm:groq-sdk";
const app = new Hono();
const openai = new OpenAI();
// Get all voice notes (for admin/dashboard)
async function transcribeAudio(voiceNoteId: string, audioBuffer: ArrayBuffer) {
try {
// Convert ArrayBuffer to File for OpenAI
const audioFile = new File([audioBuffer], "audio.webm", { type: "audio/webm" });