Search

4,018 results found for openai (9641ms)

Code
3,914

bomb/legal/main.ts
8 matches
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { nanoid } from "npm:nanoid";
async function runArchitect(textSample: string) {
const openai = new OpenAI();
const context = `
DOCUMENT SAMPLE (First 3000 chars):
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini", // Faster and sufficient for selection
messages: [
async function runAgentAnalysis(agent: any, text: string) {
const openai = new OpenAI();
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
async function synthesizeReport(results: any[]) {
const openai = new OpenAI();
const validResults = results.filter((r) => r.success);
const failedResults = results.filter((r) => !r.success);
overall_risk_rating: "CRITICAL",
executive_summary:
ocess the document.\n\nLogs:\n${errorLog}\n\nPlease check OpenAI API Keys and text extraction qu
document_id: "ERR",
},
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: prompt }],
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// ==========================================
if (!image) throw new Error("No image data");
const openai = new OpenAI();
// --- SYSTEM PROMPT ---
const runAttempt = async (attemptNum) => {
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
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" },
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { nanoid } from "npm:nanoid";
async function distillTheStandard(text: string) {
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { nanoid } from "npm:nanoid";
async function runAgentAnalysis(agent: any, text: string) {
const openai = new OpenAI();
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
async function synthesizeReport(results: any[]) {
const openai = new OpenAI();
const validResults = results.filter((r) => r.success);
`;
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: prompt }],
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { nanoid } from "npm:nanoid";
async function runArchitect(textSample: string) {
const openai = new OpenAI();
const context = `
DOCUMENT SAMPLE (First 4000 chars):
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
async function runAgentAnalysis(agent: any, text: string) {
const openai = new OpenAI();
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
async function synthesizeReport(results: any[]) {
const openai = new OpenAI();
const validResults = results.filter((r) => r.success);
`;
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: prompt }],
import { OpenAI } from "https://esm.town/v/std/openai";
// --- AI SYSTEM PROMPT ---
if (req.method === "POST" && action === "generateTheme") {
try {
const openai = new OpenAI();
const body = await req.json();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
1. Click **Remix**
2. Set `OPENAI_API_KEY` in this val's environment variables
3. Done! You will get an email tomorrow morning.
- **[dashboard.tsx](./dashboard.tsx)** – Displays previous newsletter runs from
blob storage in a simple web UI.
- **[main.ts](./main.ts)** – The scheduled job that calls the OpenAI agent,
processes the results, renders the email, and sends it.
- **[newsletter-template.tsx](./newsletter-template.tsx)** – React component
import { Agent, run, webSearchTool } from "npm:@openai/agents@0.3.0";
import { email } from "https://esm.town/v/std/email?v=11";
import { blob } from "https://esm.town/v/std/blob";
1. Click **Remix**
2. Set `OPENAI_API_KEY` in this val's environment variables
3. Done! You will get an email tomorrow morning.
- **[dashboard.tsx](./dashboard.tsx)** – Displays previous newsletter runs from
blob storage in a simple web UI.
- **[main.ts](./main.ts)** – The scheduled job that calls the OpenAI agent,
processes the results, renders the email, and sends it.
- **[newsletter-template.tsx](./newsletter-template.tsx)** – React component